Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #run this script as root after installing ArchLinuxArm
- #you can get this script with command curl -LJO https://www.path-to-this-file.com
- userhome="/home/alarm"
- #Change these variables as needed
- #boxstaticname="server1.mysite.com"
- #boxtransientname="ArchPi"
- boxname="ArchPi" #Name of this device to be used as hostname also
- boxdescription="Arch Linux - Raspberry Pi"
- pacman-key --init
- pacman -Syyu --force --noconfirm
- pacman -S --needed --noconfirm sudo bash-completion base-devel wget git tmux libglvnd xorg-server xorg-xinit xf86-video-fbdev libx264 alsa-utils alsa-firmware alsa-plugins openbox obconf compton oblogout lxappearance-obconf tint2 feh ttf-dejavu
- #=============================================================================================
- #extra packages , you might not need, uncomment if you want them
- #pacman -S sdl linux-raspberrypi-headers libcec-rpi kodi-rbp libomxil-bellagio autoconf automake libsdl2-dev libtool libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo libfribidi-dev libfontconfig1-dev libjpeg-dev libgnutls28-dev libluajit-5.1-dev libbluray-dev libtheora-dev libvorbis-dev linux-headers-rpi2 libomxil-bellagio-dev
- #=============================================================================================
- sed -i.bak -e 's?#en_US\.UTF-8 UTF-8?en_US\.UTF-8 UTF-8?g' /etc/locale.gen
- locale-gen
- localectl set-locale LANG=en_US.UTF-8
- LANG= source /etc/profile.d/locale.sh
- export LANG=en_US.UTF-8
- #make default user part of wheel group
- usermod -g users -G wheel,storage,power -s /bin/bash alarm
- #Make nano the default editor and give sudo power to users in group wheel
- perl -i.bak -0pe 's?# %wheel ALL=\(ALL\) ALL\n?%wheel ALL=\(ALL\) ALL\n?' /etc/sudoers
- perl -i.bak -pe 'printf "Defaults editor=/usr/bin/nano\n" if $. == 1' /etc/sudoers
- timedatectl set-ntp true
- tzselect
- hostnamectl set-hostname "$boxname"
- hostnamectl set-hostname "$boxdescription" --pretty
- #hostnamectl set-hostname $boxstaticname --static
- #hostnamectl set-hostname $boxtransientname --transient
- echo -e "127.0.0.1\tlocalhost" >> /etc/hosts
- echo -e "::1\t\tlocalhost" >> /etc/hosts
- echo -e "127.0.1.1\t"$boxname".localdomain\t"$boxname"" >> /etc/hosts
- #little fix to make the mouse work correctly.
- perl -i.bak -pe 's/$/ usbhid.mousepoll=0/' /boot/cmdline.txt
- su alarm -c mkdir -m770 /usr/share/backgrounds && chgrp wheel /usr/share/backgrounds
- su alarm -c mkdir -m770 "$userhome"/.builds "$userhome"/.config
- su alarm -c cp -R /etc/xdg/openbox "$userhome"/.config/
- su alarm -c mkdir -m770 "$userhome"/.builds/st && su alarm -c cd "$userhome"/.builds/st
- #====================== git stuff ===============================
- su alarm -c git clone git://git.suckless.org/st
- make -j4 clean install
- cd "$userhome"/
- git clone https://aur.archlinux.org/trizen-git.git
- cd trizen-git
- makepkg -srci --noconfirm
- git clone https://github.com/dylanaraps/neofetch
- cd neofetch
- make -j4 clean install
- #===================================================================
- su alarm -c touch "$userhome"/.config/openbox/autostart "$userhome"/.nanorc
- echo -e ". ~/.fehbg &\ntint2 &\n" >> "$userhome"/.config/openbox/autostart
- echo -e "set constantshow\n" >> "$userhome"/.nanorc
- wget -O /usr/share/backgrounds/archpi.jpg http://getwallpapers.com/wallpaper/full/9/d/9/1057081-best-arch-linux-wallpaper-1920x1080.jpg
- wget -O /usr/share/backgrounds/arch1.jpg http://getwallpapers.com/wallpaper/full/b/0/9/1056666-arch-linux-wallpaper-1920x1080-for-ios.jpg
- su alarm -c cp /etc/skel/{.bashrc,.bash_profile} "$userhome"/
- su alarm -c touch "$userhome"/.fehbg
- echo -e "feh --recursive --bg-fill --no-fehbg --randomize /usr/share/backgrounds/*" > "$userhome"/.fehbg
- echo -e "\nalias logout='oblogout'\nalias obstart='printf sudo nano ~/.config/openbox/autostart'" >> "$userhome"/.bashrc
- echo -e "alias pacup='sudo pacman -Syyu --noconfirm'" >> "$userhome"/.bashrc
- echo -e "alias pac-clean='sudo pacman -Scvv --noconfirm'" >> "$userhome"/.bashrc
- echo -e "alias bashrc='sudo nano ~/.bashrc && source ~/.bashrc'" >> "$userhome"/.bashrc
- printf "\nif [[ ! \$DISPLAY && \$XDG_VTNR -eq 1 ]]; then\nexec startx\nfi" >> "$userhome"/.bash_profile
- su alarm -c cp /etc/X11/xinit/xinitrc "$userhome"/.xinitrc
- #find and remove conflicting lines from .xinitrc
- sed -i '/^twm &/d' "$userhome"/.xinitrc
- sed -i '/^xclock -/d' "$userhome"/.xinitrc
- sed -i '/^xterm -/d' "$userhome"/.xinitrc
- sed -i '/^exec xterm -/d' "$userhome"/.xinitrc
- #add this line to launch openbox as the defaul window manager
- echo "exec openbox-session" >> "$userhome"/.xinitrc
- #choose wireless interface
- readarray -t interfaces < <(ip -o link show | awk -F ': ' '{print $2}' | grep "wl")
- PS3="Type the number of the interfaceto use for wifi [ENTER]: "
- select i in "${interfaces[@]}"; do
- [[ -n "$i" ]] || { printf "Wrong choice, try again \n\n" >&2; continue; }
- break;
- done
- read -r choseninterface <<< "$i"
- echo -e "You have chosen: "$choseninterface" \n\n"
- ifconfig "$choseninterface" up
- systemctl enable wpa_supplicant@"$choseninterface"
- systemctl enable systemd-networkd
- systemctl enable systemd-resolved
- systemctl enable systemd-timesyncd
- #choose ESSID
- readarray -t ssid < <(iwlist "$choseninterface" scan | grep ESSID | awk -F ':' '{print $2}')
- PS3="Choose Network to connect to [ENTER]: "
- select i in "${ssid[@]}"; do
- [[ -n "$i" ]] || { printf "Wrong choice, try again \n\n" >&2; continue; }
- break;
- done
- read -r chosenssid <<< "$i"
- echo -e "You have chosen "$chosenssid"\n\n"
- #ask for password for chosen connection
- read -p "Enter the password for the selected network and press [ENTER]: " pass
- interfacefile=/etc/wpa_supplicant/wpa_supplicant-"$choseninterface"'.conf'
- chosenssid=$(sed -e 's/^"//' -e 's/"$//' <<< "$chosenssid")
- wpa_passphrase "$chosenssid" "$pass" > "$interfacefile"
- #delete the text password from file
- sed -i '/#psk/d' "$interfacefile"
- sed -i '1s/^/update_config=1\n/' "$interfacefile"
- sed -i '1s/^/ctrl_interface_group=wheel\n/' "$interfacefile"
- sed -i '1s/^/ctrl_interface=\/run\/wpa_supplicant\n/' "$interfacefile"
- touch /etc/systemd/network/wl.network
- echo -e "[Match]\nName=wl*\n\n[Network]\nDHCP=yes\n" > /etc/systemd/network/wl.network
- #change hdmi_group=1 to hdmi_group=2 if using a monitor for better viewing
- perl -i.bak -pe 's/^gpu_mem.*/gpu_mem=320/' /boot/config.txt
- #echo -e "\narm_freq=1000\ncore_freq=500\nsdram_freq=500\nover_voltage=6\n\n" >> /boot/config.txt #some overclocking options
- echo -e "dtparam=audio=on\nhdmi_drive=2\ndisable_overscan=1\nhdmi_mode=16" >> /boot/config.txt
- amixer sset 'PCM' unmute && amixer sset 'PCM' 100% #unmute device, just incase it is muted
- chown -R alarm:wheel "$userhome"
- chage -d 0 alarm
- reboot
Add Comment
Please, Sign In to add comment