Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=================================== System Hostname Info ===================================
- #Change these variables as needed
- boxname="ObscureArch" #Name of this device to be used as hostname also
- boxdescription="Arch Linux - Obscure"
- boxlocation="Office"
- localevar='en_US.UTF-8'
- #====================================== Set locale stuff ====================================
- ##=========== look for comented locale and remove comment tag
- perl -i.bak -pe '!$x && s,(#'"$localevar"' UTF-8),$localevar, && ($x=1)' /etc/locale.gen && locale-gen
- localectl set-locale LANG="$localevar"
- export LANG="$localevar"
- export LANGUAGE="$localevar"
- export LC_ALL="$localevar"
- LANG= source /etc/profile.d/locale.sh #make changes take effect immmidiately
- timedatectl set-local-rtc 0
- timedatectl set-ntp true
- #======================================= Set Time stuff =======================================
- TimeZone=$(tzselect) #prompt to select correct timezone
- test -n "$TimeZone" && ln -sf /usr/share/zoneinfo/"$TimeZone" /etc/localtime #make sure variable is set and symlink it
- #create skel/.config directory under etc and copy locale.conf so when other when users get added they have a copy of it
- rsync -a /etc/locale.conf /etc/skel/.config/locale.conf
- rsync -a /etc/nanorc /etc/skel/.config/nano/nanorc
- touch /etc/skel/.fehbg
- mkdir -pm 0775 /etc/skel/.builds /usr/share/backgrounds
- perl -i.bak -pe 's/#Color/Color/' /etc/pacman.conf # Add color to pacman
- #====================================== Install Programs=======================================
- pacman -Syy --force --noconfirm && pacman-key --init
- #=========== install the good stuff
- pacman -S refind-efi intel-ucode archlinux-keyring sudo ntp bash-completion parted ntfsprogs dosfstools wget git tmux libglvnd xorg-server
- xorg-xinit xf86-video-fbdev libx264 alsa-utils openbox obconf compton conky oblogout lxappearance-obconf tint2 feh ttf-dejavu python
- --needed --noconfirm
- pacman-key --populate archlinux
- refind-install --usedefault "$disk1"
- touch /boot/refind_linux.conf && printf "%s\t%s\n" 'Boot with standard options' "ro root=UUID=$(blkid -s UUID -o value $disk3)" > /boot/refind_linux.conf
- #==============================================================================================
- rsync -a /etc/X11/xinit/xinitrc /etc/skel/.xinitrc
- #find and remove conflicting lines from .xinitrc
- sed -i '/^twm &/d' /etc/skel/.xinitrc
- sed -i '/^xclock -/d' /etc/skel/.xinitrc
- sed -i '/^xterm -/d' /etc/skel/.xinitrc
- sed -i '/^exec xterm -/d' /etc/skel/.xinitrc
- printf "%s\n" 'alias pacup=sudo pacman -Syyu --noconfirm' >> "$userhome"/.bashrc
- printf "%s\n" 'alias pac-clean=sudo pacman -Scvv --noconfirm' >> "$userhome"/.bashrc
- printf "%s\n" 'alias bashrc=sudo nano ~/.bashrc && source ~/.bashrc' >> "$userhome"/.bashrc
- #======================================= Accounts stuff =======================================
- #=========== edit the pam.d/passwd file to secure accounts better
- printf "%s" '#%PAM-1.0
- password required pam_cracklib.so retry=2 minlen=8 difok=4 dcredit=-1 ucredit=-1
- password required pam_unix.so use_authtok sha512 shadow' > /etc/pam.d/passwd
- #=========== create user and ask for password
- echo "Let's create the default user now
- Type the desired username\n"
- read -p 'Username: ' usrname
- userhome="/home/$usrname"
- useradd -d "$userhome" -mG wheel -s /bin/bash "$usrname" && echo "User : $usrname - has been created Now let's set a password for the user\n"
- passwd $usrname
- #=========== uncoment wheel group from sudoers ===========
- 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 #make nano the default visudo editor (print on first line)
- #==============================================================================================
- hostnamectl set-hostname "$boxname" && hostnamectl set-hostname "$boxdescription" --pretty
- hostnamectl set-deployment "development" && hostnamectl set-location "$boxlocation"
- printf "%s\t%s" '127.0.0.1' 'localhost' >> /etc/hosts
- printf "%s\t\t%s" '::1' 'localhost' >> /etc/hosts
- printf "%s\t%s\t%s" '127.0.1.1' "$boxname.localdomain" "$boxname" >> /etc/hosts
- su $usrname -c rsync -a /etc/xdg/openbox "$userhome"/.config/
- cd "$userhome"/.builds
- usecores=(nproc --all)
- #====================== git stuff ===============================
- su $usrname -c git clone git://git.suckless.org/st && cd st #simple trainer
- su $usrname -c make -j"$usecores" clean install
- cd ..
- #=========== trizen(aur)
- su $usrname -c git clone https://aur.archlinux.org/trizen-git.git && cd trizen-git
- su $usrname -c makepkg -srci --noconfirm
- cd ..
- #=========== neofetch
- su $usrname -c git clone https://github.com/dylanaraps/neofetch && cd neofetch
- su $usrname -c make -j"$usecores" clean install
- cd ..
- #=========== nanorc
- su $usrname -c git clone https://github.com/scopatz/nanorc.git "$userhome"/.nano
- echo "include $userhome/*.nanorc" >> $userhome/.nanorc
- cd "$userhome"
- #===================================================================
- su $usrname -c touch "$userhome"/.fehbg
- printf "%s\n" 'feh --recursive --bg-fill --no-fehbg --randomize /usr/share/backgrounds/*' > "$userhome"/.fehbg
- printf "\n%s\n%s\n" 'alias logout=oblogout' 'alias obstart=sudo nano ~/.config/openbox/autostart' >> "$userhome"/.bashrc
- printf "%s\n" 'exec openbox-session' >> "$userhome"/.xinitrc #add this line to launch openbox as the defaul window manager
- su $usrname -c touch "$userhome"/.config/openbox/autostart
- printf "%s\n%s\n" '. ~/.fehbg &' 'tint2 &' >> "$userhome"/.config/openbox/autostart
- printf "%s\n" 'set constantshow' >> "$userhome"/.nanorc
- while IFS= read -r url fileName;do
- su $usrname -c wget -O /usr/share/backgrounds/"$fileName" http://obscuresoft.tk/archbg.txt
- done < list
- #===================================================================
- : <<'END'
- #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 "%s\n\n" 'Wrong choice, try again' >&2; continue; }
- break;
- done
- read -r choseninterface <<< "$i"
- printf "%s\n\n" "You have chosen: $choseninterface"
- ifconfig "$choseninterface" up
- systemctl enable wpa_supplicant@"$choseninterface"
- #===================================================================
- #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 "%s\n\n" 'Wrong choice, try again' >&2; continue; }
- break;
- done
- read -r chosenssid <<< "$i"
- printf "%s\n\n" "You have chosen $chosenssid"
- #ask for password for chosen connection
- read -sp "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"
- END
- #===================================================================
- systemctl enable systemd-networkd
- systemctl enable systemd-resolved
- systemctl enable systemd-timesyncd
- systemctl enable ntpd.service
- systemctl start ntpd.service
- touch /etc/systemd/network/en.network
- printf "%s\n"
- '[Match]
- Name=en*
- [Network]
- DHCP=yes' > /etc/systemd/network/en.network
- amixer sset Master unmute #unmute device, just incase it is muted
- alsamixer
- reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement