Advertisement
Nybble

arch2

Feb 16th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.72 KB | None | 0 0
  1. #=================================== System Hostname Info ===================================
  2. #Change these variables as needed
  3. boxname="ObscureArch" #Name of this device to be used as hostname also
  4. boxdescription="Arch Linux - Obscure"
  5. boxlocation="Office"
  6. localevar='en_US.UTF-8'
  7. #====================================== Set locale stuff ====================================
  8. ##=========== look for comented locale and remove comment tag
  9. perl -i.bak -pe '!$x && s,(#'"$localevar"' UTF-8),$localevar, && ($x=1)' /etc/locale.gen && locale-gen
  10. localectl set-locale LANG="$localevar"
  11. export LANG="$localevar"
  12. export LANGUAGE="$localevar"
  13. export LC_ALL="$localevar"
  14. LANG= source /etc/profile.d/locale.sh #make changes take effect immmidiately
  15. timedatectl set-local-rtc 0
  16. timedatectl set-ntp true
  17. #======================================= Set Time stuff =======================================
  18. TimeZone=$(tzselect) #prompt to select correct timezone
  19. test -n "$TimeZone" && ln -sf /usr/share/zoneinfo/"$TimeZone" /etc/localtime #make sure variable is set and symlink it
  20. #create skel/.config directory under etc and copy locale.conf so when other when users get added they have a copy of it
  21. rsync -a /etc/locale.conf /etc/skel/.config/locale.conf
  22. rsync -a /etc/nanorc /etc/skel/.config/nano/nanorc
  23. touch /etc/skel/.fehbg
  24. mkdir -pm 0775 /etc/skel/.builds /usr/share/backgrounds
  25. perl -i.bak -pe 's/#Color/Color/' /etc/pacman.conf # Add color to pacman
  26. #====================================== Install Programs=======================================
  27. pacman -Syy --force --noconfirm && pacman-key --init
  28. #=========== install the good stuff
  29. pacman -S refind-efi intel-ucode archlinux-keyring sudo ntp bash-completion parted ntfsprogs dosfstools wget git tmux libglvnd xorg-server
  30. xorg-xinit xf86-video-fbdev libx264 alsa-utils openbox obconf compton conky oblogout lxappearance-obconf tint2 feh ttf-dejavu python
  31. --needed --noconfirm
  32. pacman-key --populate archlinux
  33. refind-install --usedefault "$disk1"
  34. 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
  35. #==============================================================================================
  36. rsync -a /etc/X11/xinit/xinitrc /etc/skel/.xinitrc
  37. #find and remove conflicting lines from .xinitrc
  38. sed -i '/^twm &/d' /etc/skel/.xinitrc
  39. sed -i '/^xclock -/d' /etc/skel/.xinitrc
  40. sed -i '/^xterm -/d' /etc/skel/.xinitrc
  41. sed -i '/^exec xterm -/d' /etc/skel/.xinitrc
  42. printf "%s\n" 'alias pacup=sudo pacman -Syyu --noconfirm' >> "$userhome"/.bashrc
  43. printf "%s\n" 'alias pac-clean=sudo pacman -Scvv --noconfirm' >> "$userhome"/.bashrc
  44. printf "%s\n" 'alias bashrc=sudo nano ~/.bashrc && source ~/.bashrc' >> "$userhome"/.bashrc
  45. #======================================= Accounts stuff =======================================
  46. #=========== edit the pam.d/passwd file to secure accounts better
  47. printf "%s" '#%PAM-1.0
  48. password required pam_cracklib.so retry=2 minlen=8 difok=4 dcredit=-1 ucredit=-1
  49. password required pam_unix.so use_authtok sha512 shadow' > /etc/pam.d/passwd
  50. #=========== create user and ask for password
  51. echo "Let's create the default user now
  52. Type the desired username\n"
  53. read -p 'Username: ' usrname
  54. userhome="/home/$usrname"
  55. 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"
  56. passwd $usrname
  57. #=========== uncoment wheel group from sudoers ===========
  58. perl -i.bak -0pe 's?# %wheel ALL=\(ALL\) ALL\n?%wheel ALL=\(ALL\) ALL\n?' /etc/sudoers
  59. 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)
  60. #==============================================================================================
  61. hostnamectl set-hostname "$boxname" && hostnamectl set-hostname "$boxdescription" --pretty
  62. hostnamectl set-deployment "development" && hostnamectl set-location "$boxlocation"
  63.  
  64. printf "%s\t%s" '127.0.0.1' 'localhost' >> /etc/hosts
  65. printf "%s\t\t%s" '::1' 'localhost' >> /etc/hosts
  66. printf "%s\t%s\t%s" '127.0.1.1' "$boxname.localdomain" "$boxname" >> /etc/hosts
  67.  
  68. su $usrname -c rsync -a /etc/xdg/openbox "$userhome"/.config/
  69. cd "$userhome"/.builds
  70. usecores=(nproc --all)
  71. #====================== git stuff ===============================
  72. su $usrname -c git clone git://git.suckless.org/st && cd st #simple trainer
  73. su $usrname -c make -j"$usecores" clean install
  74. cd ..
  75. #=========== trizen(aur)
  76. su $usrname -c git clone https://aur.archlinux.org/trizen-git.git && cd trizen-git
  77. su $usrname -c makepkg -srci --noconfirm
  78. cd ..
  79. #=========== neofetch
  80. su $usrname -c git clone https://github.com/dylanaraps/neofetch && cd neofetch
  81. su $usrname -c make -j"$usecores" clean install
  82. cd ..
  83. #=========== nanorc
  84. su $usrname -c git clone https://github.com/scopatz/nanorc.git "$userhome"/.nano
  85. echo "include $userhome/*.nanorc" >> $userhome/.nanorc
  86. cd "$userhome"
  87. #===================================================================
  88. su $usrname -c touch "$userhome"/.fehbg
  89. printf "%s\n" 'feh --recursive --bg-fill --no-fehbg --randomize /usr/share/backgrounds/*' > "$userhome"/.fehbg
  90. printf "\n%s\n%s\n" 'alias logout=oblogout' 'alias obstart=sudo nano ~/.config/openbox/autostart' >> "$userhome"/.bashrc
  91. printf "%s\n" 'exec openbox-session' >> "$userhome"/.xinitrc #add this line to launch openbox as the defaul window manager
  92.  
  93. su $usrname -c touch "$userhome"/.config/openbox/autostart
  94. printf "%s\n%s\n" '. ~/.fehbg &' 'tint2 &' >> "$userhome"/.config/openbox/autostart
  95. printf "%s\n" 'set constantshow' >> "$userhome"/.nanorc
  96.  
  97. while IFS= read -r url fileName;do
  98. su $usrname -c wget -O /usr/share/backgrounds/"$fileName" http://obscuresoft.tk/archbg.txt
  99. done < list
  100. #===================================================================
  101. : <<'END'
  102. #choose wireless interface
  103. readarray -t interfaces < <(ip -o link show | awk -F ': ' '{print $2}' | grep "wl")
  104. PS3="Type the number of the interfaceto use for wifi [ENTER]: "
  105. select i in "${interfaces[@]}"; do
  106. [[ -n "$i" ]] || { printf "%s\n\n" 'Wrong choice, try again' >&2; continue; }
  107. break;
  108. done
  109. read -r choseninterface <<< "$i"
  110. printf "%s\n\n" "You have chosen: $choseninterface"
  111. ifconfig "$choseninterface" up
  112. systemctl enable wpa_supplicant@"$choseninterface"
  113. #===================================================================
  114. #choose ESSID
  115. readarray -t ssid < <(iwlist "$choseninterface" scan | grep ESSID | awk -F ':' '{print $2}')
  116. PS3="Choose Network to connect to [ENTER]: "
  117. select i in "${ssid[@]}"; do
  118. [[ -n "$i" ]] || { printf "%s\n\n" 'Wrong choice, try again' >&2; continue; }
  119. break;
  120. done
  121. read -r chosenssid <<< "$i"
  122. printf "%s\n\n" "You have chosen $chosenssid"
  123. #ask for password for chosen connection
  124. read -sp "Enter the password for the selected network and press [ENTER]: " pass
  125. interfacefile=/etc/wpa_supplicant/wpa_supplicant-"$choseninterface"'.conf'
  126. chosenssid=$(sed -e 's/^"//' -e 's/"$//' <<< "$chosenssid")
  127. wpa_passphrase "$chosenssid" "$pass" > "$interfacefile"
  128. #delete the text password from file
  129. sed -i '/#psk/d' "$interfacefile"
  130. sed -i '1s/^/update_config=1\n/' "$interfacefile"
  131. sed -i '1s/^/ctrl_interface_group=wheel\n/' "$interfacefile"
  132. sed -i '1s/^/ctrl_interface=\/run\/wpa_supplicant\n/' "$interfacefile"
  133. END
  134. #===================================================================
  135. systemctl enable systemd-networkd
  136. systemctl enable systemd-resolved
  137. systemctl enable systemd-timesyncd
  138. systemctl enable ntpd.service
  139. systemctl start ntpd.service
  140.  
  141. touch /etc/systemd/network/en.network
  142. printf "%s\n"
  143. '[Match]
  144. Name=en*
  145. [Network]
  146. DHCP=yes' > /etc/systemd/network/en.network
  147.  
  148. amixer sset Master unmute #unmute device, just incase it is muted
  149. alsamixer
  150. reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement