arch-post_install_script.sh 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. options=(Y y N n)
  7. supercmd=(sudo doas)
  8. # Section: set su command
  9. read -rp "Use 'doas' or 'sudo' for superuser command?: (sudo|doas)" superuser
  10. while [[ " "${supercmd[@]}" " != *" $superuser "* ]]; do
  11. echo "$superuser: not recognized. Valid options are:"
  12. echo "${supercmd[@]/%/,}"
  13. read -rp "?: (sudo|doas)" superuser
  14. done
  15. if [ "$superuser" == "sudo" ]; then
  16. export su=sudo
  17. elif [ "$superuser" == "doas" ]; then
  18. export su=doas
  19. fi
  20. # Section: Artix. Add arch linux repos
  21. read -rp "Add arch linux repos to Artix linux?: (y|N)" option
  22. while [[ " "${options[@]}" " != *" $option "* ]]; do
  23. echo "$option: not recognized. Valid options are:"
  24. echo "${options[@]/%/,}"
  25. read -rp "?: (y|n)" option
  26. done
  27. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  28. ./artix-add_arch_linux_repositories_support.sh
  29. fi
  30. # Section: Create xinitrc
  31. read -rp "Create .xinit file in user home directory?: (y|N)" option
  32. while [[ " "${options[@]}" " != *" $option "* ]]; do
  33. echo "$option: not recognized. Valid options are:"
  34. echo "${options[@]/%/,}"
  35. read -rp "?: (y|n)" option
  36. done
  37. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  38. ./create_xinitrc.sh
  39. fi
  40. # Section: Disable login manager
  41. read -rp "Disable login manager?: (y|N)" option
  42. while [[ " "${options[@]}" " != *" $option "* ]]; do
  43. echo "$option: not recognized. Valid options are:"
  44. echo "${options[@]/%/,}"
  45. read -rp "?: (y|n)" option
  46. done
  47. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  48. ./disable_login_manager.sh
  49. fi
  50. # Section: Get personal dotfiles
  51. read -rp "Get personal dotfiles backups from Github?: (y|N)" option
  52. while [[ " "${options[@]}" " != *" $option "* ]]; do
  53. echo "$option: not recognized. Valid options are:"
  54. echo "${options[@]/%/,}"
  55. read -rp "?: (y|n)" option
  56. done
  57. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  58. ./get_personal_backup_files.sh
  59. fi
  60. # Section: Configure pacman settings
  61. read -rp "Configure pacman settings?: (Y|n)" option
  62. while [[ " "${options[@]}" " != *" $option "* ]]; do
  63. echo "$option: not recognized. Valid options are:"
  64. echo "${options[@]/%/,}"
  65. read -rp "?: (y|n)" option
  66. done
  67. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  68. ./configure_pacman_settings.sh
  69. fi
  70. # Section: Install common packages
  71. read -rp "Install common packages?: (Y|n)" option
  72. while [[ " "${options[@]}" " != *" $option "* ]]; do
  73. echo "$option: not recognized. Valid options are:"
  74. echo "${options[@]/%/,}"
  75. read -rp "?: (y|n)" option
  76. done
  77. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  78. ./install_common_packages.sh
  79. fi
  80. # Section: Install package 'paru'
  81. read -rp "Install package 'paru'?: (Y|n)" option
  82. while [[ " "${options[@]}" " != *" $option "* ]]; do
  83. echo "$option: not recognized. Valid options are:"
  84. echo "${options[@]/%/,}"
  85. read -rp "?: (y|n)" option
  86. done
  87. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  88. ./install_paru.sh
  89. fi
  90. # Section: Install packages 'suckless'
  91. read -rp "Install packages 'suckless'?: (y|N)" option
  92. while [[ " "${options[@]}" " != *" $option "* ]]; do
  93. echo "$option: not recognized. Valid options are:"
  94. echo "${options[@]/%/,}"
  95. read -rp "?: (y|n)" option
  96. done
  97. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  98. ./install_suckless_tools.sh
  99. fi
  100. # Section: Install packages 'tools'
  101. read -rp "Install packages 'tools'?: (Y|n)" option
  102. while [[ " "${options[@]}" " != *" $option "* ]]; do
  103. echo "$option: not recognized. Valid options are:"
  104. echo "${options[@]/%/,}"
  105. read -rp "?: (y|n)" option
  106. done
  107. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  108. ./install_tools.sh
  109. fi
  110. # Section: Install packages 'testing tools'
  111. read -rp "Install packages 'testing tools'?: (Y|n)" option
  112. while [[ " "${options[@]}" " != *" $option "* ]]; do
  113. echo "$option: not recognized. Valid options are:"
  114. echo "${options[@]/%/,}"
  115. read -rp "?: (y|n)" option
  116. done
  117. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  118. ./install_testing_tools.sh
  119. fi
  120. # Section: Install packages 'testing browsers'
  121. read -rp "Install packages 'testing browsers'?: (Y|n)" option
  122. while [[ " "${options[@]}" " != *" $option "* ]]; do
  123. echo "$option: not recognized. Valid options are:"
  124. echo "${options[@]/%/,}"
  125. read -rp "?: (y|n)" option
  126. done
  127. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  128. ./install_testing_browsers.sh
  129. fi
  130. # Section: Install packages 'other browsers'
  131. read -rp "Install packages 'other browsers'?: (y|N)" option
  132. while [[ " "${options[@]}" " != *" $option "* ]]; do
  133. echo "$option: not recognized. Valid options are:"
  134. echo "${options[@]/%/,}"
  135. read -rp "?: (y|n)" option
  136. done
  137. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  138. ./install_other_browsers.sh
  139. fi
  140. # Section: Install packages 'android tools'
  141. read -rp "Install packages 'android tools'?: (Y|n)" option
  142. while [[ " "${options[@]}" " != *" $option "* ]]; do
  143. echo "$option: not recognized. Valid options are:"
  144. echo "${options[@]/%/,}"
  145. read -rp "?: (y|n)" option
  146. done
  147. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  148. ./install_android_tools.sh
  149. fi
  150. # Section: Install packages 'appium'
  151. read -rp "Install packages 'appium'?: (Y|n)" option
  152. while [[ " "${options[@]}" " != *" $option "* ]]; do
  153. echo "$option: not recognized. Valid options are:"
  154. echo "${options[@]/%/,}"
  155. read -rp "?: (y|n)" option
  156. done
  157. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  158. ./install_appium.sh
  159. fi
  160. # Section: Clean temporary AUR files
  161. read -rp "Clean temporary AUR files?: (Y|n)" option
  162. while [[ " "${options[@]}" " != *" $option "* ]]; do
  163. echo "$option: not recognized. Valid options are:"
  164. echo "${options[@]/%/,}"
  165. read -rp "?: (y|n)" option
  166. done
  167. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  168. ./clean_temporary_aur_files.sh
  169. fi
  170. # Section: Create user aliases in bash_aliases file
  171. read -rp "Create user aliases in bash_aliases file?: (Y|n)" option
  172. while [[ " "${options[@]}" " != *" $option "* ]]; do
  173. echo "$option: not recognized. Valid options are:"
  174. echo "${options[@]/%/,}"
  175. read -rp "?: (y|n)" option
  176. done
  177. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  178. ./create_user_aliases.sh
  179. fi
  180. # Section: Generate ssh keys
  181. read -rp "Generate ssh keys?: (Y|n)" option
  182. while [[ " "${options[@]}" " != *" $option "* ]]; do
  183. echo "$option: not recognized. Valid options are:"
  184. echo "${options[@]/%/,}"
  185. read -rp "?: (y|n)" option
  186. done
  187. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  188. ./generate_ssh_keys.sh
  189. fi
  190. # Section: Add ssh key to Github account
  191. read -rp "Add ssh key to Github account?: (y|N)" option
  192. while [[ " "${options[@]}" " != *" $option "* ]]; do
  193. echo "$option: not recognized. Valid options are:"
  194. echo "${options[@]/%/,}"
  195. read -rp "?: (y|n)" option
  196. done
  197. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  198. ./add_ssh_key_to_github.sh
  199. fi
  200. # Section: Apply fix for misbehaving java applications
  201. read -rp "Apply fix for misbehaving java applications?: (Y|n)" option
  202. while [[ " "${options[@]}" " != *" $option "* ]]; do
  203. echo "$option: not recognized. Valid options are:"
  204. echo "${options[@]/%/,}"
  205. read -rp "?: (y|n)" option
  206. done
  207. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  208. ./apply_java_applications_fix.sh
  209. fi
  210. # Section: Set keyboard layout
  211. read -rp "Set keyboard layout?: (Y|n)" option
  212. while [[ " "${options[@]}" " != *" $option "* ]]; do
  213. echo "$option: not recognized. Valid options are:"
  214. echo "${options[@]/%/,}"
  215. read -rp "?: (y|n)" option
  216. done
  217. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  218. ./set_keyboard_layout.sh
  219. fi
  220. # Section: Configure Git
  221. read -rp "Configure Git?: (Y|n)" option
  222. while [[ " "${options[@]}" " != *" $option "* ]]; do
  223. echo "$option: not recognized. Valid options are:"
  224. echo "${options[@]/%/,}"
  225. read -rp "?: (y|n)" option
  226. done
  227. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  228. ./configure_git.sh
  229. fi
  230. # Section: Clone personal repos
  231. read -rp "Clone personal repos?: (y|N)" option
  232. while [[ " "${options[@]}" " != *" $option "* ]]; do
  233. echo "$option: not recognized. Valid options are:"
  234. echo "${options[@]/%/,}"
  235. read -rp "?: (y|n)" option
  236. done
  237. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  238. ./clone_personal_repos.sh
  239. fi
  240. # Section: Set java default version
  241. read -rp "Set java default version?: (Y|n)" option
  242. while [[ " "${options[@]}" " != *" $option "* ]]; do
  243. echo "$option: not recognized. Valid options are:"
  244. echo "${options[@]/%/,}"
  245. read -rp "?: (y|n)" option
  246. done
  247. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  248. ./set_java_default_version.sh
  249. fi
  250. # Section: Start and configure services
  251. read -rp "Start and configure services?: (y|N)" option
  252. while [[ " "${options[@]}" " != *" $option "* ]]; do
  253. echo "$option: not recognized. Valid options are:"
  254. echo "${options[@]/%/,}"
  255. read -rp "?: (y|n)" option
  256. done
  257. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  258. ./start_services.sh
  259. fi
  260. # Section: Enable Bash git prompt
  261. read -rp "Enable Bash git prompt?: (Y|n)" option
  262. while [[ " "${options[@]}" " != *" $option "* ]]; do
  263. echo "$option: not recognized. Valid options are:"
  264. echo "${options[@]/%/,}"
  265. read -rp "?: (y|n)" option
  266. done
  267. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  268. ./enable_bash_git_prompt.sh
  269. fi
  270. # Section: Update clamav antivirus
  271. read -rp "Update clamav antivirus?: (Y|n)" option
  272. while [[ " "${options[@]}" " != *" $option "* ]]; do
  273. echo "$option: not recognized. Valid options are:"
  274. echo "${options[@]/%/,}"
  275. read -rp "?: (y|n)" option
  276. done
  277. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  278. ./update_clamav.sh
  279. fi
  280. # Section: Set PATH in ~/bashrc file
  281. read -rp "Set PATH in ~/bashrc file?: (Y|n)" option
  282. while [[ " "${options[@]}" " != *" $option "* ]]; do
  283. echo "$option: not recognized. Valid options are:"
  284. echo "${options[@]/%/,}"
  285. read -rp "?: (y|n)" option
  286. done
  287. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  288. ./create_bin_directory.sh
  289. fi
  290. # Section: Nvidia optimus
  291. read -rp "Set nvidia optimus integrated card?: (y|N)" option
  292. while [[ " "${options[@]}" " != *" $option "* ]]; do
  293. echo "$option: not recognized. Valid options are:"
  294. echo "${options[@]/%/,}"
  295. read -rp "?: (y|n)" option
  296. done
  297. if [[ "$option" == "y" || "$option" == "Y" ]]; then
  298. ./configure_nvidia_optimus.sh
  299. fi