hyperfi.sh 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990
  1. #!/bin/bash
  2. # shellcheck disable=SC2181
  3. # Hyperbola GNU+Linux-libre Fast Install (hyperfi)
  4. # --------------------------------
  5. # Last author : Jesus E.
  6. # First author : MatMoul
  7. # https://github.com/MatMoul
  8. # http://sourceforge.net/u/matmoul
  9. # project : https://github.com/MatMoul/archfi
  10. # http://sourceforge.net/projects/archfi/
  11. # First license : LGPL-3.0 (http://opensource.org/licenses/lgpl-3.0.html)
  12. # Second license : GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
  13. #
  14. # Reference : https://wiki.hyperbola.info/doku.php?id=en:guide:installation
  15. apptitle="Hyperbola GNU+Linux-Libre Fast Install (hyperfi) - Version: 0.4.0 (GPLv3)"
  16. baseurl=https://git.sr.ht/~heckyel/hyperfi/blob/master
  17. cpl=0
  18. skipfont="0"
  19. fspkgs=""
  20. # --------------------------------------------------------
  21. mainmenu(){
  22. if [ "${1}" = "" ]; then
  23. nextitem="."
  24. else
  25. nextitem=${1}
  26. fi
  27. options=()
  28. options+=("${txtlanguage}" "Language")
  29. options+=("${txtsetkeymap}" "(loadkeys ...)")
  30. options+=("${txteditor}" "(${txtoptional})")
  31. options+=("${txtdiskpartmenu}" "")
  32. options+=("${txtselectpartsmenu}" "")
  33. options+=("" "")
  34. options+=("${txtreboot}" "")
  35. sel=$(whiptail --backtitle "${apptitle}" --title "${txtmainmenu}" --menu "" --cancel-button "${txtexit}" --default-item "${nextitem}" 0 0 0 \
  36. "${options[@]}" \
  37. 3>&1 1>&2 2>&3)
  38. if [ "$?" = "0" ]; then
  39. case ${sel} in
  40. "${txtlanguage}")
  41. chooselanguage
  42. nextitem="${txtsetkeymap}"
  43. ;;
  44. "${txtsetkeymap}")
  45. setkeymap
  46. nextitem="${txtdiskpartmenu}"
  47. ;;
  48. "${txteditor}")
  49. chooseeditor
  50. nextitem="${txtdiskpartmenu}"
  51. ;;
  52. "${txtdiskpartmenu}")
  53. diskpartmenu
  54. nextitem="${txtselectpartsmenu}"
  55. ;;
  56. "${txtselectpartsmenu}")
  57. selectparts
  58. nextitem="${txtreboot}"
  59. ;;
  60. "${txthelp}")
  61. help
  62. nextitem="${txtreboot}"
  63. ;;
  64. "${txtchangelog}")
  65. showchangelog
  66. nextitem="${txtreboot}"
  67. ;;
  68. "${txtreboot}")
  69. rebootpc
  70. nextitem="${txtreboot}"
  71. ;;
  72. esac
  73. mainmenu "${nextitem}"
  74. else
  75. clear
  76. fi
  77. }
  78. chooselanguage(){
  79. options=()
  80. options+=("Arabic" "(By Mohammad Alawadi)")
  81. options+=("Brazilian" "(By MaxWilliamJF)")
  82. options+=("Dutch" "(By bowero)")
  83. options+=("English" "(By MatMoul)")
  84. options+=("French" "(By MatMoul)")
  85. options+=("German" "(By untergrundbiber)")
  86. options+=("Greek" "(By quelotic)")
  87. options+=("Italian" "(By thegoldgoat)")
  88. options+=("Hungarian" "(By KardiWeb)")
  89. options+=("Norwegian" "(By mrboen94)")
  90. options+=("Polish" "(By dawidd6)")
  91. options+=("Portuguese" "(By hugok)")
  92. options+=("Russian" "(By Anonymous_Prodject)")
  93. options+=("Spanish" "(By Mystogab)")
  94. options+=("Turkish" "(By c0b41)")
  95. sel=$(whiptail --backtitle "${apptitle}" --title "${txtlanguage}" --menu "" 0 0 0 \
  96. "${options[@]}" \
  97. 3>&1 1>&2 2>&3)
  98. if [ "$?" = "0" ]; then
  99. clear
  100. if [ "${sel}" = "English" ]; then
  101. loadstrings
  102. else
  103. eval "$(curl -L "${baseurl}/lng/${sel}" | sed '/^#/ d')"
  104. fi
  105. if [ "${skipfont}" = "0" ]; then
  106. eval "$(setfont "${font}")"
  107. fi
  108. font=
  109. if [ "$(grep "^#${locale}" /etc/locale.gen)" != "" ]; then
  110. sed -i "/#${locale}/s/^#//g" /etc/locale.gen
  111. locale-gen
  112. fi
  113. export LANG=${locale}
  114. fi
  115. }
  116. setkeymap(){
  117. items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
  118. options=()
  119. for item in ${items}; do
  120. options+=("${item%%.*}" "")
  121. done
  122. keymap=$(whiptail --backtitle "${apptitle}" --title "${txtsetkeymap}" --menu "" 0 0 0 \
  123. "${options[@]}" \
  124. 3>&1 1>&2 2>&3)
  125. if [ "$?" = "0" ]; then
  126. clear
  127. echo "loadkeys ${keymap}"
  128. loadkeys "${keymap}"
  129. pressanykey
  130. fi
  131. }
  132. chooseeditor(){
  133. options=()
  134. options+=("nano" "")
  135. options+=("vim" "")
  136. options+=("vi" "")
  137. options+=("edit" "")
  138. sel=$(whiptail --backtitle "${apptitle}" --title "${txteditor}" --menu "" 0 0 0 \
  139. "${options[@]}" \
  140. 3>&1 1>&2 2>&3)
  141. if [ "$?" = "0" ]; then
  142. clear
  143. echo "export EDITOR=${sel}"
  144. export EDITOR=${sel}
  145. EDITOR=${sel}
  146. pressanykey
  147. fi
  148. }
  149. rebootpc(){
  150. if (whiptail --backtitle "${apptitle}" --title "${txtreboot}" --yesno "${txtreboot} ?" --defaultno 0 0); then
  151. clear
  152. reboot
  153. fi
  154. }
  155. # --------------------------------------------------------
  156. # --------------------------------------------------------
  157. selectdisk(){
  158. items=$(lsblk -d -p -n -l -o NAME,SIZE -e 7,11)
  159. options=()
  160. IFS_ORIG=$IFS
  161. IFS=$'\n'
  162. for item in ${items}
  163. do
  164. options+=("${item}" "")
  165. done
  166. IFS=$IFS_ORIG
  167. result=$(whiptail --backtitle "${apptitle}" --title "${1}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
  168. if [ "$?" != "0" ]
  169. then
  170. return 1
  171. fi
  172. echo "${result%%\ *}"
  173. return 0
  174. }
  175. diskpartmenu(){
  176. if [ "${1}" = "" ]; then
  177. nextitem="."
  178. else
  179. nextitem=${1}
  180. fi
  181. options=()
  182. if [ "${eficomputer}" == "0" ]; then
  183. options+=("${txtautoparts} (gpt)" "")
  184. options+=("${txtautoparts} (dos)" "")
  185. else
  186. options+=("${txtautoparts} (gpt,efi)" "")
  187. options+=("${txtautoparts} (gpt)" "")
  188. options+=("${txtautoparts} (dos)" "")
  189. options+=("${txtautoparts} (gpt,bios+efi,noswap)" "")
  190. fi
  191. options+=("${txteditparts} (cfdisk)" "")
  192. options+=("${txteditparts} (cgdisk)" "")
  193. sel=$(whiptail --backtitle "${apptitle}" --title "${txtdiskpartmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextitem}" 0 0 0 \
  194. "${options[@]}" \
  195. 3>&1 1>&2 2>&3)
  196. if [ "$?" = "0" ]; then
  197. case ${sel} in
  198. "${txtautoparts} (dos)")
  199. diskpartautodos
  200. nextitem="${txtautoparts} (dos)"
  201. ;;
  202. "${txtautoparts} (gpt)")
  203. diskpartautogpt
  204. nextitem="${txtautoparts} (gpt)"
  205. ;;
  206. "${txtautoparts} (gpt,efi)")
  207. diskpartautoefi
  208. nextitem="${txtautoparts} (gpt,efi)"
  209. ;;
  210. "${txtautoparts} (gpt,bios+efi,noswap)")
  211. diskpartautoefiusb
  212. nextitem="${txtautoparts} (gpt,bios+efi,noswap)"
  213. ;;
  214. "${txteditparts} (cfdisk)")
  215. diskpartcfdisk
  216. nextitem="${txteditparts} (cfdisk)"
  217. ;;
  218. "${txteditparts} (cgdisk)")
  219. diskpartcgdisk
  220. nextitem="${txteditparts} (cgdisk)"
  221. ;;
  222. esac
  223. diskpartmenu "${nextitem}"
  224. fi
  225. }
  226. diskpartautodos(){
  227. device=$(selectdisk "${txtautoparts} (dos)")
  228. if [ "$?" = "0" ]; then
  229. if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (dos)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0); then
  230. clear
  231. echo "${txtautopartclear}"
  232. parted "${device}" mklabel msdos
  233. sleep 1
  234. echo "${txtautopartcreate//%1/boot}"
  235. echo -e "n\np\n\n\n+512M\na\nw" | fdisk "${device}"
  236. sleep 1
  237. echo "${txtautopartcreate//%1/swap}"
  238. swapsize=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
  239. swapsize=$((swapsize/1000))"M"
  240. echo -e "n\np\n\n\n+${swapsize}\nt\n\n82\nw" | fdisk "${device}"
  241. sleep 1
  242. echo "${txtautopartcreate//%1/root}"
  243. echo -e "n\np\n\n\n\nw" | fdisk "${device}"
  244. sleep 1
  245. echo ""
  246. pressanykey
  247. if [ "${device::8}" == "/dev/nvm" ]; then
  248. bootdev=${device}"p1"
  249. swapdev=${device}"p2"
  250. rootdev=${device}"p3"
  251. else
  252. bootdev=${device}"1"
  253. swapdev=${device}"2"
  254. rootdev=${device}"3"
  255. fi
  256. efimode="0"
  257. fi
  258. fi
  259. }
  260. diskpartautogpt(){
  261. device=$(selectdisk "${txtautoparts} (gpt)")
  262. if [ "$?" = "0" ]; then
  263. if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0); then
  264. clear
  265. echo "${txtautopartclear}"
  266. parted "${device}" mklabel gpt
  267. echo "${txtautopartcreate//%1/BIOS boot}"
  268. sgdisk "${device}" -n=1:0:+31M -t=1:ef02
  269. echo "${txtautopartcreate//%1/boot}"
  270. sgdisk "${device}" -n=2:0:+512M
  271. echo "${txtautopartcreate//%1/swap}"
  272. swapsize=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
  273. swapsize=$((swapsize/1000))"M"
  274. sgdisk "${device}" -n=3:0:+${swapsize} -t=3:8200
  275. echo "${txtautopartcreate//%1/root}"
  276. sgdisk "${device}" -n=4:0:0
  277. echo ""
  278. pressanykey
  279. if [ "${device::8}" == "/dev/nvm" ]; then
  280. bootdev=${device}"p2"
  281. swapdev=${device}"p3"
  282. rootdev=${device}"p4"
  283. else
  284. bootdev=${device}"2"
  285. swapdev=${device}"3"
  286. rootdev=${device}"4"
  287. fi
  288. efimode="0"
  289. fi
  290. fi
  291. }
  292. diskpartautoefi(){
  293. device=$(selectdisk "${txtautoparts} (gpt,efi)")
  294. if [ "$?" = "0" ]; then
  295. if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0); then
  296. clear
  297. echo "${txtautopartclear}"
  298. parted "${device}" mklabel gpt
  299. echo "${txtautopartcreate//%1/EFI boot}"
  300. sgdisk "${device}" -n=1:0:+1024M -t=1:ef00
  301. echo "${txtautopartcreate//%1/swap}"
  302. swapsize=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
  303. swapsize=$((swapsize/1000))"M"
  304. sgdisk "${device}" -n=2:0:+${swapsize} -t=2:8200
  305. echo "${txtautopartcreate//%1/root}"
  306. sgdisk "${device}" -n=3:0:0
  307. echo ""
  308. pressanykey
  309. if [ "${device::8}" == "/dev/nvm" ]; then
  310. bootdev=${device}"p1"
  311. swapdev=${device}"p2"
  312. rootdev=${device}"p3"
  313. else
  314. bootdev=${device}"1"
  315. swapdev=${device}"2"
  316. rootdev=${device}"3"
  317. fi
  318. efimode="1"
  319. fi
  320. fi
  321. }
  322. diskpartautoefiusb(){
  323. device=$(selectdisk "${txtautoparts} (gpt,efi)")
  324. if [ "$?" = "0" ]; then
  325. if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0); then
  326. clear
  327. echo "${txtautopartclear}"
  328. parted "${device}" mklabel gpt
  329. echo "${txtautopartcreate//%1/EFI boot}"
  330. sgdisk "${device}" -n=1:0:+1024M -t=1:ef00
  331. echo "${txtautopartcreate//%1/BIOS boot}"
  332. sgdisk "${device}" -n=2:0:+31M -t=2:ef02
  333. echo "${txtautopartcreate//%1/root}"
  334. sgdisk "${device}" -n=3:0:0
  335. echo "${txthybridpartcreate}"
  336. echo -e "r\nh\n3\nN\n\nY\nN\nw\nY\n" | gdisk "${device}"
  337. echo ""
  338. pressanykey
  339. if [ "${device::8}" == "/dev/nvm" ]; then
  340. bootdev=${device}"p1"
  341. swapdev=
  342. rootdev=${device}"p3"
  343. else
  344. bootdev=${device}"1"
  345. swapdev=
  346. rootdev=${device}"3"
  347. fi
  348. efimode="2"
  349. fi
  350. fi
  351. }
  352. diskpartcfdisk(){
  353. device=$( selectdisk "${txteditparts} (cfdisk)" )
  354. if [ "$?" = "0" ]; then
  355. clear
  356. cfdisk "${device}"
  357. fi
  358. }
  359. diskpartcgdisk(){
  360. device=$( selectdisk "${txteditparts} (cgdisk)" )
  361. if [ "$?" = "0" ]; then
  362. clear
  363. cgdisk "${device}"
  364. fi
  365. }
  366. # --------------------------------------------------------
  367. # --------------------------------------------------------
  368. selectparts(){
  369. items=$(lsblk -p -n -l -o NAME -e 7,11)
  370. options=()
  371. for item in ${items}; do
  372. options+=("${item}" "")
  373. done
  374. bootdev=$(whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/boot}" --default-item "${bootdev}" 0 0 0 \
  375. "none" "-" \
  376. "${options[@]}" \
  377. 3>&1 1>&2 2>&3)
  378. if [ ! "$?" = "0" ]; then
  379. return 1
  380. else
  381. if [ "${bootdev}" = "none" ]; then
  382. bootdev=
  383. fi
  384. fi
  385. swapdev=$(whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/swap}" --default-item "${swapdev}" 0 0 0 \
  386. "none" "-" \
  387. "${options[@]}" \
  388. 3>&1 1>&2 2>&3)
  389. if [ ! "$?" = "0" ]; then
  390. return 1
  391. else
  392. if [ "${swapdev}" = "none" ]; then
  393. swapdev=
  394. fi
  395. fi
  396. rootdev=$(whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/root}" --default-item "${rootdev}" 0 0 0 \
  397. "${options[@]}" \
  398. 3>&1 1>&2 2>&3)
  399. if [ ! "$?" = "0" ]; then
  400. return 1
  401. fi
  402. realrootdev=${rootdev}
  403. homedev=$(whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/home}" 0 0 0 \
  404. "none" "-" \
  405. "${options[@]}" \
  406. 3>&1 1>&2 2>&3)
  407. if [ ! "$?" = "0" ]; then
  408. return 1
  409. else
  410. if [ "${homedev}" = "none" ]; then
  411. homedev=
  412. fi
  413. fi
  414. msg="${txtselecteddevices}\n\n"
  415. msg=${msg}"boot : ${bootdev}\n"
  416. msg=${msg}"swap : ${swapdev}\n"
  417. msg=${msg}"root : ${rootdev}\n"
  418. msg=${msg}"home : ${homedev}\n\n"
  419. if (whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --yesno "${msg}" 0 0); then
  420. isnvme=0
  421. if [ "${bootdev::8}" == "/dev/nvm" ]; then
  422. isnvme=1
  423. fi
  424. if [ "${rootdev::8}" == "/dev/nvm" ]; then
  425. isnvme=1
  426. fi
  427. mountmenu
  428. fi
  429. }
  430. # --------------------------------------------------------
  431. # --------------------------------------------------------
  432. mountmenu(){
  433. if [ "${1}" = "" ]; then
  434. nextitem="."
  435. else
  436. nextitem=${1}
  437. fi
  438. options=()
  439. options+=("${txtformatdevices}" "")
  440. options+=("${txtmount}" "${txtmountdesc}")
  441. sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatmountmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextitem}" 0 0 0 \
  442. "${options[@]}" \
  443. 3>&1 1>&2 2>&3)
  444. if [ "$?" = "0" ]; then
  445. case ${sel} in
  446. "${txtformatdevices}")
  447. formatdevices
  448. nextitem="${txtmount}"
  449. ;;
  450. "${txtmount}")
  451. mountparts
  452. nextitem="${txtmount}"
  453. ;;
  454. esac
  455. mountmenu "${nextitem}"
  456. fi
  457. }
  458. formatdevices(){
  459. if (whiptail --backtitle "${apptitle}" --title "${txtformatdevices}" --yesno "${txtformatdeviceconfirm}" --defaultno 0 0); then
  460. fspkgs=""
  461. if [ ! "${bootdev}" = "" ]; then
  462. formatbootdevice boot "${bootdev}"
  463. fi
  464. if [ ! "${swapdev}" = "" ]; then
  465. formatswapdevice swap" ${swapdev}"
  466. fi
  467. formatdevice root "${rootdev}"
  468. if [ ! "${homedev}" = "" ]; then
  469. formatdevice home "${homedev}"
  470. fi
  471. fi
  472. }
  473. formatbootdevice(){
  474. options=()
  475. if [ "${efimode}" == "1" ]||[ "${efimode}" = "2" ]; then
  476. options+=("fat32" "(EFI)")
  477. fi
  478. options+=("ext2" "")
  479. options+=("ext3" "")
  480. options+=("ext4" "")
  481. if [ ! "${efimode}" = "1" ]&&[ ! "${efimode}" = "2" ]; then
  482. options+=("fat32" "(EFI)")
  483. fi
  484. sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
  485. "${options[@]}" \
  486. 3>&1 1>&2 2>&3)
  487. if [ ! "$?" = "0" ]; then
  488. return 1
  489. fi
  490. clear
  491. echo "${txtformatingpart//%1/${2}} ${sel}"
  492. echo "----------------------------------------------"
  493. case ${sel} in
  494. ext2)
  495. echo "mkfs.ext2 ${2}"
  496. mkfs.ext2 "${2}"
  497. ;;
  498. ext3)
  499. echo "mkfs.ext3 ${2}"
  500. mkfs.ext3 "${2}"
  501. ;;
  502. ext4)
  503. echo "mkfs.ext4 ${2}"
  504. mkfs.ext4 "${2}"
  505. ;;
  506. fat32)
  507. fspkgs=("${fspkgs[@]} dosfstools")
  508. echo "mkfs.fat ${2}"
  509. mkfs.fat "${2}"
  510. ;;
  511. esac
  512. echo ""
  513. pressanykey
  514. }
  515. formatswapdevice(){
  516. options=()
  517. options+=("swap" "")
  518. sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
  519. "${options[@]}" \
  520. 3>&1 1>&2 2>&3)
  521. if [ ! "$?" = "0" ]; then
  522. return 1
  523. fi
  524. clear
  525. echo "${txtformatingpart//%1/${swapdev}} swap"
  526. echo "----------------------------------------------------"
  527. case ${sel} in
  528. swap)
  529. echo "mkswap ${swapdev}"
  530. mkswap "${swapdev}"
  531. echo ""
  532. pressanykey
  533. ;;
  534. esac
  535. clear
  536. }
  537. formatdevice(){
  538. options=()
  539. options+=("btrfs" "")
  540. options+=("ext4" "")
  541. options+=("ext3" "")
  542. options+=("ext2" "")
  543. options+=("xfs" "")
  544. options+=("f2fs" "")
  545. options+=("jfs" "")
  546. options+=("reiserfs" "")
  547. if [ ! "${3}" = "noluks" ]; then
  548. options+=("luks" "encrypted")
  549. fi
  550. sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
  551. "${options[@]}" \
  552. 3>&1 1>&2 2>&3)
  553. if [ ! "$?" = "0" ]; then
  554. return 1
  555. fi
  556. clear
  557. echo "${txtformatingpart//%1/${2}} ${sel}"
  558. echo "----------------------------------------------"
  559. case ${sel} in
  560. btrfs)
  561. fspkgs=("${fspkgs[@]} btrfs-progs")
  562. echo "mkfs.btrfs -f ${2}"
  563. mkfs.btrfs -f "${2}"
  564. if [ "${1}" = "root" ]; then
  565. echo "mount ${2} /mnt"
  566. echo "btrfs subvolume create /mnt/root"
  567. echo "btrfs subvolume set-default /mnt/root"
  568. echo "umount /mnt"
  569. mount "${2}" /mnt
  570. btrfs subvolume create /mnt/root
  571. btrfs subvolume set-default /mnt/root
  572. umount /mnt
  573. fi
  574. ;;
  575. ext4)
  576. echo "mkfs.ext4 ${2}"
  577. mkfs.ext4 "${2}"
  578. ;;
  579. ext3)
  580. echo "mkfs.ext3 ${2}"
  581. mkfs.ext3 "${2}"
  582. ;;
  583. ext2)
  584. echo "mkfs.ext2 ${2}"
  585. mkfs.ext2 "${2}"
  586. ;;
  587. xfs)
  588. fspkgs=("${fspkgs[@]} xfsprogs")
  589. echo "mkfs.xfs -f ${2}"
  590. mkfs.xfs -f "${2}"
  591. ;;
  592. f2fs)
  593. fspkgs=("${fspkgs[@]} f2fs-tools")
  594. echo "mkfs.f2fs -f $2"
  595. mkfs.f2fs -f "${2}"
  596. ;;
  597. jfs)
  598. fspkgs=("${fspkgs[@]} jfsutils")
  599. echo "mkfs.jfs -f ${2}"
  600. mkfs.jfs -f "${2}"
  601. ;;
  602. reiserfs)
  603. fspkgs=("${fspkgs[@]} reiserfsprogs")
  604. echo "mkfs.reiserfs -f ${2}"
  605. mkfs.reiserfs -f "${2}"
  606. ;;
  607. luks)
  608. echo "${txtcreateluksdevice}"
  609. echo "cryptsetup luksFormat ${2}"
  610. cryptsetup luksFormat "${2}"
  611. if [ ! "$?" = "0" ]; then
  612. pressanykey
  613. return 1
  614. fi
  615. pressanykey
  616. echo ""
  617. echo "${txtopenluksdevice}"
  618. echo "cryptsetup luksOpen ${2} ${1}"
  619. cryptsetup luksOpen "${2}" "${1}"
  620. if [ ! "$?" = "0" ]; then
  621. pressanykey
  622. return 1
  623. fi
  624. pressanykey
  625. options=()
  626. options+=("normal" "")
  627. options+=("fast" "")
  628. sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "Wipe device ?" --cancel-button="${txtignore}" 0 0 0 \
  629. "${options[@]}" \
  630. 3>&1 1>&2 2>&3)
  631. if [ "$?" = "0" ]; then
  632. case ${sel} in
  633. normal)
  634. echo "dd if=/dev/zero of=/dev/mapper/${1}"
  635. dd if=/dev/zero of=/dev/mapper/"${1}" & PID=$! &>/dev/null
  636. ;;
  637. fast)
  638. echo "dd if=/dev/zero of=/dev/mapper/${1} bs=60M"
  639. dd if=/dev/zero of=/dev/mapper/"${1}" bs=60M & PID=$! &>/dev/null
  640. ;;
  641. esac
  642. clear
  643. sleep 1
  644. while kill -USR1 ${PID} &>/dev/null
  645. do
  646. sleep 1
  647. done
  648. fi
  649. echo ""
  650. pressanykey
  651. formatdevice "${1}" /dev/mapper/"${1}" noluks
  652. if [ "${1}" = "root" ]; then
  653. realrootdev=${rootdev}
  654. rootdev=/dev/mapper/${1}
  655. luksroot=1
  656. luksrootuuid=$(cryptsetup luksUUID "${2}")
  657. else
  658. case ${1} in
  659. home) homedev=/dev/mapper/"${1}" ;;
  660. esac
  661. luksdrive=1
  662. crypttab="\n${1} UUID=$(cryptsetup luksUUID "${2}") none"
  663. fi
  664. echo ""
  665. echo "${txtluksdevicecreated}"
  666. ;;
  667. esac
  668. echo ""
  669. pressanykey
  670. }
  671. mountparts(){
  672. clear
  673. echo "mount ${rootdev} /mnt"
  674. mount "${rootdev}" /mnt
  675. echo "mkdir /mnt/{boot,home}"
  676. mkdir /mnt/{boot,home} 2>/dev/null
  677. if [ ! "${bootdev}" = "" ]; then
  678. echo "mount ${bootdev} /mnt/boot"
  679. mount "${bootdev}" /mnt/boot
  680. fi
  681. if [ ! "${swapdev}" = "" ]; then
  682. echo "swapon ${swapdev}"
  683. swapon "${swapdev}"
  684. fi
  685. if [ ! "${homedev}" = "" ]; then
  686. echo "mount ${homedev} /mnt/home"
  687. mount "${homedev}" /mnt/home
  688. fi
  689. pressanykey
  690. installmenu
  691. }
  692. # --------------------------------------------------------
  693. # --------------------------------------------------------
  694. installmenu(){
  695. if [ "${1}" = "" ]; then
  696. nextitem="${txtinstallhyperbola}"
  697. else
  698. nextitem=${1}
  699. fi
  700. options=()
  701. options+=("${txtselectmirrorsbycountry}" "(${txtoptional})")
  702. options+=("${txteditmirrorlist}" "(${txtoptional})")
  703. options+=("${txteditpacmanconf}" "(${txtoptional})")
  704. options+=("${txtinstallhyperbola}" "pacstrap")
  705. options+=("${txtconfighyperbola}" "")
  706. sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \
  707. "${options[@]}" \
  708. 3>&1 1>&2 2>&3)
  709. if [ "$?" = "0" ]; then
  710. case ${sel} in
  711. "${txtselectmirrorsbycountry}")
  712. selectmirrorsbycountry
  713. nextitem="${txtinstallhyperbola}"
  714. ;;
  715. "${txteditmirrorlist}")
  716. ${EDITOR} /etc/pacman.d/mirrorlist
  717. nextitem="${txtinstallhyperbola}"
  718. ;;
  719. "${txteditpacmanconf}")
  720. ${EDITOR} /etc/pacman.conf
  721. nextitem="${txtinstallhyperbola}"
  722. ;;
  723. "${txtinstallhyperbola}")
  724. if(installbase); then
  725. nextitem="${txtconfighyperbola}"
  726. fi
  727. ;;
  728. "${txtconfighyperbola}")
  729. archmenu
  730. nextitem="${txtconfighyperbola}"
  731. ;;
  732. esac
  733. installmenu "${nextitem}"
  734. else
  735. unmountdevices
  736. fi
  737. }
  738. selectmirrorsbycountry() {
  739. if [[ ! -f /etc/pacman.d/mirrorlist.backup ]]; then
  740. cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
  741. fi
  742. items=$( sed -n "/^##.*/N; {s/^## \(.*\)\nServer.*/\1/p}" < /etc/pacman.d/mirrorlist.backup | sort -u )
  743. options=()
  744. IFS_ORIG=$IFS
  745. IFS=$'\n'
  746. for item in ${items}; do
  747. options+=("${item}" "")
  748. done
  749. IFS=$IFS_ORIG
  750. country=$(whiptail --backtitle "${apptitle}" --title "${txtselectcountry}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
  751. if [ "$?" != "0" ]; then
  752. return 1
  753. fi
  754. sed "s/^\(Server .*\)/\#\1/;/^## $country/N; {s/^\(## .*\n\)\#Server \(.*\)/\1Server \2/}" < /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
  755. }
  756. installbase(){
  757. pkgs="base"
  758. options=()
  759. options+=("linux-libre-lts" "")
  760. sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallhyperbolakernel}" --menu "" 0 0 0 \
  761. "${options[@]}" \
  762. 3>&1 1>&2 2>&3)
  763. if [ "$?" = "0" ]; then
  764. pkgs+=" ${sel}"
  765. else
  766. return 1
  767. fi
  768. options=()
  769. options+=("kernel-firmware" "(${txtoptional})" on)
  770. sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallhyperbolafirmwares}" --checklist "" 0 0 0 \
  771. "${options[@]}" \
  772. 3>&1 1>&2 2>&3)
  773. if [ ! "$?" = "0" ]; then
  774. return 1
  775. fi
  776. for itm in $sel; do
  777. pkgs="$pkgs ${itm//\"/}"
  778. done
  779. options=()
  780. for value in "${fspkgs[@]}"; do
  781. if [[ "${value}" == *"dosfstools"* ]]; then
  782. options+=("dosfstools" "" on)
  783. else
  784. options+=("dosfstools" "" off)
  785. fi
  786. if [[ "${value}" == *"btrfs-progs"* ]]; then
  787. options+=("btrfs-progs" "" on)
  788. else
  789. options+=("btrfs-progs" "" off)
  790. fi
  791. if [[ "${value}" == *"xfsprogs"* ]]; then
  792. options+=("xfsprogs" "" on)
  793. else
  794. options+=("xfsprogs" "" off)
  795. fi
  796. if [[ "${value}" == *"f2fs-tools"* ]]; then
  797. options+=("f2fs-tools" "" on)
  798. else
  799. options+=("f2fs-tools" "" off)
  800. fi
  801. if [[ "${value}" == *"jfsutils"* ]]; then
  802. options+=("jfsutils" "" on)
  803. else
  804. options+=("jfsutils" "" off)
  805. fi
  806. if [[ "${value}" == *"reiserfsprogs"* ]]; then
  807. options+=("reiserfsprogs" "" on)
  808. else
  809. options+=("reiserfsprogs" "" off)
  810. fi
  811. done
  812. options+=("lvm2" "" off)
  813. options+=("dmraid" "" off)
  814. sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallhyperbolafilesystems}" --checklist "" 0 0 0 \
  815. "${options[@]}" \
  816. 3>&1 1>&2 2>&3)
  817. if [ ! "$?" = "0" ]; then
  818. return 1
  819. fi
  820. for itm in $sel; do
  821. pkgs="$pkgs ${itm//\"/}"
  822. done
  823. if [[ ${cpl} == 1 ]]; then
  824. sed -i '/^\s*$/d' /tmp/hyperfi-custom-package-list
  825. sed -i '/^#/ d' /tmp/hyperfi-custom-package-list
  826. options=()
  827. while read -r pkg; do
  828. options+=("${pkg}" "" on)
  829. done < /tmp/hyperfi-custom-package-list
  830. sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallhyperbolacustompackagelist}" --checklist "" 0 0 0 \
  831. "${options[@]}" \
  832. 3>&1 1>&2 2>&3)
  833. if [ ! "$?" = "0" ]; then
  834. return 1
  835. fi
  836. for itm in $sel; do
  837. pkgs="$pkgs ${itm//\"/}"
  838. done
  839. fi
  840. clear
  841. echo "pacstrap /mnt ${pkgs}"
  842. # shellcheck disable=SC2086
  843. pacstrap /mnt ${pkgs}
  844. pressanykey
  845. }
  846. unmountdevices(){
  847. clear
  848. echo "umount -R /mnt"
  849. umount -R /mnt
  850. if [ ! "${swapdev}" = "" ]; then
  851. echo "swapoff ${swapdev}"
  852. swapoff "${swapdev}"
  853. fi
  854. pressanykey
  855. }
  856. # --------------------------------------------------------
  857. # --------------------------------------------------------
  858. archmenu(){
  859. if [ "${1}" = "" ]; then
  860. nextitem="."
  861. else
  862. nextitem=${1}
  863. fi
  864. options=()
  865. options+=("${txtsethostname}" "/etc/hostname")
  866. options+=("${txtsetkeymap}" "/etc/vconsole.conf")
  867. options+=("${txtsetfont}" "/etc/vconsole.conf (${txtoptional})")
  868. options+=("${txtsetlocale}" "/etc/locale.conf, /etc/locale.gen")
  869. options+=("${txtsettime}" "/etc/localtime")
  870. options+=("${txtsetrootpassword}" "")
  871. options+=("${txtgenerate//%1/fstab}" "")
  872. if [ "${luksdrive}" = "1" ]; then
  873. options+=("${txtgenerate//%1/crypttab}" "")
  874. fi
  875. if [ "${luksroot}" = "1" ]; then
  876. options+=("${txtgenerate//%1/mkinitcpio.conf-luks}" "(encrypt hooks)")
  877. fi
  878. if [ "${isnvme}" = "1" ]; then
  879. options+=("${txtgenerate//%1/mkinitcpio.conf-nvme}" "(nvme module)")
  880. fi
  881. options+=("${txtedit//%1/fstab}" "(${txtoptional})")
  882. options+=("${txtedit//%1/crypttab}" "(${txtoptional})")
  883. options+=("${txtedit//%1/mkinitcpio.conf}" "(${txtoptional})")
  884. options+=("${txtedit//%1/mirrorlist}" "(${txtoptional})")
  885. options+=("${txtedit//%1/pacman.conf}" "(${txtoptional})")
  886. options+=("${txtbootloader}" "")
  887. options+=("${txtextrasmenu}" "")
  888. options+=("hyperdi" "${txthyperdidesc}")
  889. sel=$(whiptail --backtitle "${apptitle}" --title "${txthyperbolainstallmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextitem}" 0 0 0 \
  890. "${options[@]}" \
  891. 3>&1 1>&2 2>&3)
  892. if [ "$?" = "0" ]; then
  893. case ${sel} in
  894. "${txtsethostname}")
  895. archsethostname
  896. nextitem="${txtsetkeymap}"
  897. ;;
  898. "${txtsetkeymap}")
  899. archsetkeymap
  900. nextitem="${txtsetlocale}"
  901. ;;
  902. "${txtsetfont}")
  903. archsetfont
  904. nextitem="${txtsetlocale}"
  905. ;;
  906. "${txtsetlocale}")
  907. archsetlocale
  908. nextitem="${txtsettime}"
  909. ;;
  910. "${txtsettime}")
  911. archsettime
  912. nextitem="${txtsetrootpassword}"
  913. ;;
  914. "${txtsetrootpassword}")
  915. archsetrootpassword
  916. nextitem="${txtgenerate//%1/fstab}"
  917. ;;
  918. "${txtgenerate//%1/fstab}")
  919. archgenfstabmenu
  920. if [ "${luksdrive}" = "1" ]; then
  921. nextitem="${txtgenerate//%1/crypttab}"
  922. else
  923. if [ "${luksroot}" = "1" ]; then
  924. nextitem="${txtgenerate//%1/mkinitcpio.conf-luks}"
  925. else
  926. if [ "${isnvme}" = "1" ]; then
  927. nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
  928. else
  929. nextitem="${txtbootloader}"
  930. fi
  931. fi
  932. fi
  933. ;;
  934. "${txtgenerate//%1/crypttab}")
  935. archgencrypttab
  936. if [ "${luksroot}" = "1" ]; then
  937. nextitem="${txtgenerate//%1/mkinitcpio.conf-luks}"
  938. else
  939. if [ "${isnvme}" = "1" ]; then
  940. nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
  941. else
  942. nextitem="${txtbootloader}"
  943. fi
  944. fi
  945. ;;
  946. "${txtgenerate//%1/mkinitcpio.conf-luks}")
  947. archgenmkinitcpioluks
  948. if [ "${isnvme}" = "1" ]; then
  949. nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
  950. else
  951. nextitem="${txtbootloader}"
  952. fi
  953. ;;
  954. "${txtgenerate//%1/mkinitcpio.conf-nvme}")
  955. archgenmkinitcpionvme
  956. nextitem="${txtbootloader}"
  957. ;;
  958. "${txtedit//%1/fstab}")
  959. ${EDITOR} /mnt/etc/fstab
  960. nextitem="${txtedit//%1/fstab}"
  961. ;;
  962. "${txtedit//%1/crypttab}")
  963. ${EDITOR} /mnt/etc/crypttab
  964. nextitem="${txtedit//%1/crypttab}"
  965. ;;
  966. "${txtedit//%1/mkinitcpio.conf}")
  967. archeditmkinitcpio
  968. nextitem="${txtedit//%1/mkinitcpio.conf}"
  969. ;;
  970. "${txtedit//%1/mirrorlist}")
  971. ${EDITOR} /mnt/etc/pacman.d/mirrorlist
  972. nextitem="${txtedit//%1/mirrorlist}"
  973. ;;
  974. "${txtedit//%1/pacman.conf}")
  975. ${EDITOR} /mnt/etc/pacman.conf
  976. nextitem="${txtedit//%1/pacman.conf}"
  977. ;;
  978. "${txtbootloader}")
  979. archbootloadermenu
  980. nextitem="${txtextrasmenu}"
  981. ;;
  982. "${txtextrasmenu}")
  983. archextrasmenu
  984. nextitem="hyperdi"
  985. ;;
  986. "hyperdi")
  987. installhyperdi
  988. nextitem="hyperdi"
  989. ;;
  990. esac
  991. archmenu "${nextitem}"
  992. fi
  993. }
  994. archchroot(){
  995. echo "arch-chroot /mnt /root"
  996. cp "${0}" /mnt/root
  997. chmod 755 /mnt/root/"$(basename "${0}")"
  998. arch-chroot /mnt /root/"$(basename "${0}")" --chroot "${1}" "${2}"
  999. rm /mnt/root/"$(basename "${0}")"
  1000. echo "exit"
  1001. }
  1002. archsethostname(){
  1003. hostname=$(whiptail --backtitle "${apptitle}" --title "${txtsethostname}" --inputbox "" 0 0 "hyperbola" 3>&1 1>&2 2>&3)
  1004. if [ "$?" = "0" ]; then
  1005. clear
  1006. echo "echo \"${hostname}\" > /mnt/etc/hostname"
  1007. echo "${hostname}" > /mnt/etc/hostname
  1008. pressanykey
  1009. fi
  1010. }
  1011. archsetkeymap(){
  1012. items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
  1013. options=()
  1014. defsel=""
  1015. for item in ${items}; do
  1016. if [ "${item%%.*}" == "${keymap}" ]; then
  1017. defsel="${item%%.*}"
  1018. fi
  1019. options+=("${item%%.*}" "")
  1020. done
  1021. keymap=$(whiptail --backtitle "${apptitle}" --title "${txtsetkeymap}" --menu "" --default-item "${defsel}" 0 0 0 \
  1022. "${options[@]}" \
  1023. 3>&1 1>&2 2>&3)
  1024. if [ "$?" = "0" ]; then
  1025. clear
  1026. echo "echo \"KEYMAP=${keymap}\" > /mnt/etc/vconsole.conf"
  1027. echo "KEYMAP=${keymap}" > /mnt/etc/vconsole.conf
  1028. echo "sed -e \"s|^keymap=\\\"us\\\"|keymap=\\\"${keymap}\\\"|g\" -i /mnt/etc/conf.d/keymaps"
  1029. sed -e "s|^keymap=\"us\"|keymap=\"${keymap}\"|g" -i /mnt/etc/conf.d/keymaps
  1030. pressanykey
  1031. fi
  1032. }
  1033. archsetfont(){
  1034. items=$(find /usr/share/kbd/consolefonts/*.psfu.gz -printf "%f\n")
  1035. options=()
  1036. for item in ${items}; do
  1037. options+=("${item%%.*}" "")
  1038. done
  1039. vcfont=$(whiptail --backtitle "${apptitle}" --title "${txtsetfont} (${txtoptional})" --menu "" 0 0 0 \
  1040. "${options[@]}" \
  1041. 3>&1 1>&2 2>&3)
  1042. if [ "$?" = "0" ]; then
  1043. clear
  1044. echo "echo \"FONT=${vcfont}\" >> /mnt/etc/vconsole.conf"
  1045. echo "FONT=${vcfont}" >> /mnt/etc/vconsole.conf
  1046. pressanykey
  1047. fi
  1048. }
  1049. archsetlocale(){
  1050. items=$(ls /usr/share/i18n/locales)
  1051. options=()
  1052. defsel=""
  1053. for item in ${items}; do
  1054. if [ "${defsel}" == "" ]&&[ "${keymap::2}" == "${item::2}" ]; then
  1055. defsel="${item}"
  1056. fi
  1057. options+=("${item}" "")
  1058. done
  1059. locale=$(whiptail --backtitle "${apptitle}" --title "${txtsetlocale}" --menu "" --default-item "${defsel}" 0 0 0 \
  1060. "${options[@]}" \
  1061. 3>&1 1>&2 2>&3)
  1062. if [ "$?" = "0" ]; then
  1063. clear
  1064. echo "echo \"LANG=${locale}.UTF-8\" > /mnt/etc/locale.conf"
  1065. echo "LANG=${locale}.UTF-8" > /mnt/etc/locale.conf
  1066. echo "echo \"LC_COLLATE=C\" >> /mnt/etc/locale.conf"
  1067. echo "LC_COLLATE=C" >> /mnt/etc/locale.conf
  1068. echo "sed -i '/#${locale}.UTF-8/s/^#//g' /mnt/etc/locale.gen"
  1069. sed -i '/#'"${locale}"'.UTF-8/s/^#//g' /mnt/etc/locale.gen
  1070. archchroot setlocale
  1071. pressanykey
  1072. fi
  1073. }
  1074. archsetlocalechroot(){
  1075. echo "locale-gen"
  1076. locale-gen
  1077. exit
  1078. }
  1079. archsettime(){
  1080. items=$(find /usr/share/zoneinfo/ -mindepth 1 -maxdepth 1 -type d -printf '%f/\n' | sort)
  1081. options=()
  1082. for item in ${items}; do
  1083. options+=("${item}" "")
  1084. done
  1085. timezone=$(whiptail --backtitle "${apptitle}" --title "${txtsettime}" --menu "" 0 0 0 \
  1086. "${options[@]}" \
  1087. 3>&1 1>&2 2>&3)
  1088. if [ ! "$?" = "0" ]; then
  1089. return 1
  1090. fi
  1091. items=$(ls /mnt/usr/share/zoneinfo/"${timezone}"/)
  1092. options=()
  1093. for item in ${items}; do
  1094. options+=("${item}" "")
  1095. done
  1096. timezone=${timezone}/$(whiptail --backtitle "${apptitle}" --title "${txtsettime}" --menu "" 0 0 0 \
  1097. "${options[@]}" \
  1098. 3>&1 1>&2 2>&3)
  1099. if [ ! "$?" = "0" ]; then
  1100. return 1
  1101. fi
  1102. clear
  1103. echo "ln -sf /mnt/usr/share/zoneinfo/${timezone} /mnt/etc/localtime"
  1104. ln -sf /usr/share/zoneinfo/"${timezone}" /mnt/etc/localtime
  1105. pressanykey
  1106. options=()
  1107. options+=("UTC" "")
  1108. options+=("Local" "")
  1109. sel=$(whiptail --backtitle "${apptitle}" --title "${txtsettime}" --menu "${txthwclock}" 0 0 0 \
  1110. "${options[@]}" \
  1111. 3>&1 1>&2 2>&3)
  1112. if [ ! "$?" = "0" ]; then
  1113. return 1
  1114. fi
  1115. clear
  1116. case ${sel} in
  1117. "${txthwclockutc}")
  1118. archchroot settimeutc
  1119. ;;
  1120. "${txthwclocklocal}")
  1121. archchroot settimelocal
  1122. ;;
  1123. esac
  1124. pressanykey
  1125. }
  1126. archsettimeutcchroot(){
  1127. echo "hwclock --systohc --utc"
  1128. hwclock --systohc --utc
  1129. exit
  1130. }
  1131. archsettimelocalchroot(){
  1132. echo "hwclock --systohc --localtime"
  1133. hwclock --systohc --localtime
  1134. exit
  1135. }
  1136. archsetrootpassword(){
  1137. clear
  1138. archchroot setrootpassword
  1139. pressanykey
  1140. }
  1141. archsetrootpasswordchroot(){
  1142. echo "passwd root"
  1143. passed=1
  1144. while [[ ${passed} != 0 ]]; do
  1145. passwd root
  1146. passed=$?
  1147. done
  1148. exit
  1149. }
  1150. archgenfstabmenu(){
  1151. options=()
  1152. options+=("UUID" "genfstab -U")
  1153. options+=("LABEL" "genfstab -L")
  1154. options+=("PARTUUID" "genfstab -t PARTUUID")
  1155. options+=("PARTLABEL" "genfstab -t PARTLABEL")
  1156. sel=$(whiptail --backtitle "${apptitle}" --title "${txtgenerate//%1/fstab}" --menu "" --cancel-button "${txtback}" --default-item "${nextitem}" 0 0 0 \
  1157. "${options[@]}" \
  1158. 3>&1 1>&2 2>&3)
  1159. if [ "$?" = "0" ]; then
  1160. case ${sel} in
  1161. "UUID")
  1162. clear
  1163. echo "genfstab -U -p /mnt > /mnt/etc/fstab"
  1164. genfstab -U -p /mnt > /mnt/etc/fstab
  1165. ;;
  1166. "LABEL")
  1167. clear
  1168. echo "genfstab -L -p /mnt > /mnt/etc/fstab"
  1169. genfstab -L -p /mnt > /mnt/etc/fstab
  1170. ;;
  1171. "PARTUUID")
  1172. clear
  1173. echo "genfstab -t PARTUUID -p /mnt > /mnt/etc/fstab"
  1174. genfstab -t PARTUUID -p /mnt > /mnt/etc/fstab
  1175. ;;
  1176. "PARTLABEL")
  1177. clear
  1178. echo "genfstab -t PARTLABEL -p /mnt > /mnt/etc/fstab"
  1179. genfstab -t PARTLABEL -p /mnt > /mnt/etc/fstab
  1180. ;;
  1181. esac
  1182. fi
  1183. pressanykey
  1184. }
  1185. archgencrypttab(){
  1186. clear
  1187. echo "echo -e \"${crypttab}\" >> /mnt/etc/crypttab"
  1188. echo -e "${crypttab}" >> /mnt/etc/crypttab
  1189. pressanykey
  1190. }
  1191. archgenmkinitcpioluks(){
  1192. clear
  1193. echo "sed -i \"s/block filesystems/block encrypt filesystems/g\" /mnt/etc/mkinitcpio.conf"
  1194. sed -i "s/block filesystems/block encrypt filesystems/g" /mnt/etc/mkinitcpio.conf
  1195. archchroot genmkinitcpio
  1196. pressanykey
  1197. }
  1198. archgenmkinitcpionvme(){
  1199. clear
  1200. echo "sed -i \"s/MODULES=()/MODULES=(nvme)/g\" /mnt/etc/mkinitcpio.conf"
  1201. sed -i "s/MODULES=()/MODULES=(nvme)/g" /mnt/etc/mkinitcpio.conf
  1202. archchroot genmkinitcpio
  1203. pressanykey
  1204. }
  1205. archeditmkinitcpio(){
  1206. ${EDITOR} /mnt/etc/mkinitcpio.conf
  1207. if (whiptail --backtitle "${apptitle}" --title "${txtedit//%1/mkinitcpio.conf}" --yesno "${txtgenerate//%1/mkinitcpio} ?" 0 0); then
  1208. clear
  1209. archchroot genmkinitcpio
  1210. pressanykey
  1211. fi
  1212. }
  1213. archgenmkinitcpiochroot(){
  1214. echo "mkinitcpio -p linux-libre-lts"
  1215. mkinitcpio -p linux-libre-lts
  1216. exit
  1217. }
  1218. archbootloadermenu(){
  1219. options=()
  1220. options+=("grub" "")
  1221. if [ "${efimode}" == "1" ]; then
  1222. options+=("refind" "")
  1223. fi
  1224. if [ "${efimode}" != "2" ]; then
  1225. options+=("syslinux" "")
  1226. fi
  1227. sel=$(whiptail --backtitle "${apptitle}" --title "${txtbootloadermenu}" --menu "" --cancel-button "${txtback}" 0 0 0 \
  1228. "${options[@]}" \
  1229. 3>&1 1>&2 2>&3)
  1230. if [ "$?" = "0" ]; then
  1231. case ${sel} in
  1232. "grub") archbootloadergrubmenu;;
  1233. "refind") archbootloaderrefindmenu;;
  1234. "syslinux")archbootloadersyslinuxbmenu;;
  1235. esac
  1236. fi
  1237. }
  1238. archbootloadergrubmenu(){
  1239. if [ "${1}" = "" ]; then
  1240. nextblitem="."
  1241. else
  1242. nextblitem=${1}
  1243. fi
  1244. options=()
  1245. options+=("${txtinstall//%1/grub}" "pacstrap grub (efibootmgr), grub-mkconfig")
  1246. options+=("${txtedit//%1/grub}" "(${txtoptional})")
  1247. options+=("${txtinstall//%1/bootloader}" "grub-install")
  1248. sel=$(whiptail --backtitle "${apptitle}" --title "${txtbootloadergrubmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextblitem}" 0 0 0 \
  1249. "${options[@]}" \
  1250. 3>&1 1>&2 2>&3)
  1251. if [ "$?" = "0" ]; then
  1252. case ${sel} in
  1253. "${txtinstall//%1/grub}")
  1254. archgrubinstall
  1255. nextblitem="${txtinstall//%1/bootloader}"
  1256. ;;
  1257. "${txtedit//%1/grub}")
  1258. ${EDITOR} /mnt/etc/default/grub
  1259. if (whiptail --backtitle "${apptitle}" --title "${txtedit//%1/grub}" --yesno "${txtrungrubmakeconfig}" 0 0) ; then
  1260. clear
  1261. archchroot grubinstall
  1262. pressanykey
  1263. fi
  1264. nextblitem="${txtinstall//%1/bootloader}"
  1265. ;;
  1266. "${txtinstall//%1/bootloader}")
  1267. archgrubinstallbootloader
  1268. nextblitem="${txtinstall//%1/bootloader}"
  1269. ;;
  1270. esac
  1271. archbootloadergrubmenu "${nextblitem}"
  1272. fi
  1273. }
  1274. archgrubinstall(){
  1275. clear
  1276. echo "pacstrap /mnt grub"
  1277. pacstrap /mnt grub
  1278. pressanykey
  1279. if [ "${eficomputer}" == "1" ]; then
  1280. if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
  1281. if (whiptail --backtitle "${apptitle}" --title "${txtinstall//%1/efibootmgr}" --yesno "${txtefibootmgr}" 0 0) ; then
  1282. clear
  1283. echo "pacstrap /mnt efibootmgr"
  1284. pacstrap /mnt efibootmgr
  1285. pressanykey
  1286. fi
  1287. else
  1288. if (whiptail --backtitle "${apptitle}" --title "${txtinstall//%1/efibootmgr}" --yesno "${txtefibootmgr}" --defaultno 0 0) ; then
  1289. clear
  1290. echo "pacstrap /mnt efibootmgr"
  1291. pacstrap /mnt efibootmgr
  1292. pressanykey
  1293. fi
  1294. fi
  1295. fi
  1296. if [ "${luksroot}" = "1" ]; then
  1297. if (whiptail --backtitle "${apptitle}" --title "${txtinstall//%1/grub}" --yesno "${txtgrubluksdetected}" 0 0) ; then
  1298. clear
  1299. echo "sed -e \"s|GRUB_CMDLINE_LINUX=\\\"\\\"|GRUB_CMDLINE_LINUX=\\\"cryptdevice=/dev/disk/by-uuid/${luksrootuuid}:root\\\"|g\" -i /mnt/etc/default/grub"
  1300. sed -e "s|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uuid/${luksrootuuid}:root\"|g" -i /mnt/etc/default/grub
  1301. pressanykey
  1302. fi
  1303. fi
  1304. clear
  1305. archchroot grubinstall
  1306. pressanykey
  1307. }
  1308. archgrubinstallchroot(){
  1309. echo "mkdir /boot/grub"
  1310. echo "grub-mkconfig -o /boot/grub/grub.cfg"
  1311. mkdir /boot/grub
  1312. grub-mkconfig -o /boot/grub/grub.cfg
  1313. exit
  1314. }
  1315. archgrubinstallbootloader(){
  1316. device=$( selectdisk "${txtinstall//%1/bootloader}" )
  1317. if [ "$?" = "0" ]; then
  1318. if [ "${eficomputer}" == "1" ]; then
  1319. options=()
  1320. if [ "${efimode}" = "1" ]; then
  1321. options+=("EFI" "")
  1322. options+=("BIOS" "")
  1323. options+=("BIOS+EFI" "")
  1324. elif [ "${efimode}" = "2" ]; then
  1325. options+=("BIOS+EFI" "")
  1326. options+=("BIOS" "")
  1327. options+=("EFI" "")
  1328. else
  1329. options+=("BIOS" "")
  1330. options+=("EFI" "")
  1331. options+=("BIOS+EFI" "")
  1332. fi
  1333. sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstall//%1/bootloader}" --menu "" --cancel-button "${txtback}" 0 0 0 \
  1334. "${options[@]}" \
  1335. 3>&1 1>&2 2>&3)
  1336. if [ "$?" = "0" ]; then
  1337. clear
  1338. case ${sel} in
  1339. "BIOS") archchroot grubbootloaderinstall "${device}";;
  1340. "EFI") archchroot grubbootloaderefiinstall "${device}";;
  1341. "BIOS+EFI") archchroot grubbootloaderefiusbinstall "${device}";;
  1342. esac
  1343. pressanykey
  1344. fi
  1345. else
  1346. clear
  1347. archchroot grubbootloaderinstall "${device}"
  1348. pressanykey
  1349. fi
  1350. fi
  1351. }
  1352. archgrubinstallbootloaderchroot(){
  1353. if [ ! "${1}" = "none" ]; then
  1354. echo "grub-install --target=i386-pc --recheck ${1}"
  1355. grub-install --target=i386-pc --recheck "${1}"
  1356. fi
  1357. exit
  1358. }
  1359. archgrubinstallbootloaderefichroot(){
  1360. if [ ! "${1}" = "none" ]; then
  1361. echo "grub-install --target=x86_64-efi --efi-directory=/boot --recheck ${1}"
  1362. grub-install --target=x86_64-efi --efi-directory=/boot --recheck "${1}"
  1363. isvbox=$(lspci | grep "VirtualBox G")
  1364. if [ "${isvbox}" ]; then
  1365. echo "VirtualBox detected, creating startup.nsh..."
  1366. printf '%s' '\EFI\arch\grubx64.efi' > /boot/startup.nsh
  1367. fi
  1368. fi
  1369. exit
  1370. }
  1371. archgrubinstallbootloaderefiusbchroot(){
  1372. if [ ! "${1}" = "none" ]; then
  1373. echo "grub-install --target=i386-pc --recheck ${1}"
  1374. grub-install --target=i386-pc --recheck "${1}"
  1375. echo "grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck ${1}"
  1376. grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck "${1}"
  1377. isvbox=$(lspci | grep "VirtualBox G")
  1378. if [ "${isvbox}" ]; then
  1379. echo "VirtualBox detected, creating startup.nsh..."
  1380. printf '%s' '\EFI\arch\grubx64.efi' > /boot/startup.nsh
  1381. fi
  1382. fi
  1383. exit
  1384. }
  1385. archbootloadersyslinuxbmenu(){
  1386. if [ "${1}" = "" ]; then
  1387. nextblitem="."
  1388. else
  1389. nextblitem=${1}
  1390. fi
  1391. options=()
  1392. options+=("${txtinstall//%1/syslinux}" "pacstrap syslinux (gptfdisk,mtools)")
  1393. options+=("${txtedit//%1/syslinux}" "(${txtoptional})")
  1394. options+=("${txtinstall//%1/bootloader}" "syslinux-install_update")
  1395. sel=$(whiptail --backtitle "${apptitle}" --title "${txtbootloadersyslinuxmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextblitem}" 0 0 0 \
  1396. "${options[@]}" \
  1397. 3>&1 1>&2 2>&3)
  1398. if [ "$?" = "0" ]; then
  1399. case ${sel} in
  1400. "${txtinstall//%1/syslinux}")
  1401. archsyslinuxinstall
  1402. nextblitem="${txtinstall//%1/bootloader}"
  1403. ;;
  1404. "${txtedit//%1/syslinux}")
  1405. ${EDITOR} /mnt/boot/syslinux/syslinux.cfg
  1406. nextblitem="${txtinstall//%1/bootloader}"
  1407. ;;
  1408. "${txtinstall//%1/bootloader}")
  1409. archsyslinuxinstallbootloader
  1410. nextblitem="${txtinstall//%1/bootloader}"
  1411. ;;
  1412. esac
  1413. archbootloadersyslinuxbmenu "${nextblitem}"
  1414. fi
  1415. }
  1416. archsyslinuxinstall(){
  1417. clear
  1418. if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
  1419. echo "${txtsyslinuxaddefibootmgr}"
  1420. additionalpkg=${additionalpkg}"efibootmgr "
  1421. fi
  1422. if [ "${isnvme}" = "1" ]; then
  1423. if [ "$(parted "${realrootdev::(-2)}" print|grep gpt)" != "" ]; then
  1424. echo "${txtsyslinuxaddgptfdisk}"
  1425. additionalpkg=${additionalpkg}"gptfdisk "
  1426. fi
  1427. else
  1428. if [ "$(parted "${realrootdev::8}" print|grep gpt)" != "" ]; then
  1429. echo "${txtsyslinuxaddgptfdisk}"
  1430. additionalpkg=${additionalpkg}"gptfdisk "
  1431. fi
  1432. fi
  1433. if [ "${bootdev}" != "" ]; then
  1434. if [ "$(parted "${bootdev}" print|grep fat)" != "" ]; then
  1435. echo "${txtsyslinuxaddmtools}"
  1436. additionalpkg=${additionalpkg}"mtools "
  1437. fi
  1438. fi
  1439. echo "pacstrap /mnt syslinux ${additionalpkg}"
  1440. # shellcheck disable=SC2086
  1441. pacstrap /mnt syslinux ${additionalpkg}
  1442. pressanykey
  1443. clear
  1444. echo "Updating /boot/syslinux/syslinux.cfg"
  1445. if [ "${luksroot}" = "1" ]; then
  1446. echo "sed -i \"/APPEND\ root=/c\ APPEND root=/dev/mapper/root cryptdevice=${realrootdev}:root rw\" /mnt/boot/syslinux/syslinux.cfg"
  1447. sed -i "/APPEND\ root=/c\ APPEND root=/dev/mapper/root cryptdevice=${realrootdev}:root\ rw" /mnt/boot/syslinux/syslinux.cfg
  1448. else
  1449. echo "sed -i \"/APPEND\ root=/c\ APPEND root=${rootdev} rw\" /mnt/boot/syslinux/syslinux.cfg"
  1450. sed -i "/APPEND\ root=/c\ APPEND root=${rootdev}\ rw" /mnt/boot/syslinux/syslinux.cfg
  1451. fi
  1452. pressanykey
  1453. }
  1454. archsyslinuxinstallbootloader(){
  1455. clear
  1456. if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
  1457. archchroot syslinuxbootloaderefiinstall "${bootdev}"
  1458. else
  1459. archchroot syslinuxbootloaderinstall "${bootdev}"
  1460. fi
  1461. pressanykey
  1462. }
  1463. archsyslinuxinstallbootloaderchroot(){
  1464. if [ ! "${1}" = "none" ]; then
  1465. echo "syslinux-install_update -i -a -m"
  1466. syslinux-install_update -i -a -m
  1467. fi
  1468. exit
  1469. }
  1470. archsyslinuxinstallbootloaderefichroot(){
  1471. if [ ! "${1}" = "none" ]; then
  1472. echo "cp -r /usr/lib/syslinux/efi64/* /boot/syslinux"
  1473. cp -r /usr/lib/syslinux/efi64/* /boot/syslinux
  1474. if [ "${1::8}" == "/dev/nvm" ]; then
  1475. echo "efibootmgr --create --disk ${1::(-2)} --part ${1:(-1)} --loader /syslinux/syslinux.efi --label \"Syslinux\" --verbose"
  1476. efibootmgr --create --disk "${1::(-2)}" --part "${1:(-1)}" --loader /syslinux/syslinux.efi --label "Syslinux" --verbose
  1477. else
  1478. echo "efibootmgr --create --disk ${1::8} --part ${1:(-1)} --loader /syslinux/syslinux.efi --label \"Syslinux\" --verbose"
  1479. efibootmgr --create --disk "${1::8}" --part "${1:(-1)}" --loader /syslinux/syslinux.efi --label "Syslinux" --verbose
  1480. fi
  1481. isvbox=$(lspci | grep "VirtualBox G")
  1482. if [ "${isvbox}" ]; then
  1483. echo "VirtualBox detected, creating startup.nsh..."
  1484. printf '%s' '\syslinux\syslinux.efi' > /boot/startup.nsh
  1485. fi
  1486. fi
  1487. exit
  1488. }
  1489. archbootloaderrefindmenu(){
  1490. if [ "${1}" = "" ]; then
  1491. nextblitem="."
  1492. else
  1493. nextblitem=${1}
  1494. fi
  1495. options=()
  1496. options+=("${txtinstall//%1/refind}" "pacstrap refind-efi")
  1497. options+=("${txtedit//%1/refind_linux.conf}" "(${txtoptional})")
  1498. sel=$(whiptail --backtitle "${apptitle}" --title "${txtbootloaderrefindmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextblitem}" 0 0 0 \
  1499. "${options[@]}" \
  1500. 3>&1 1>&2 2>&3)
  1501. if [ "$?" = "0" ]; then
  1502. case ${sel} in
  1503. "${txtinstall//%1/refind}")
  1504. archrefindinstall
  1505. nextblitem="${txtedit//%1/refind_linux.conf}"
  1506. ;;
  1507. "${txtedit//%1/refind_linux.conf}")
  1508. ${EDITOR} /mnt/boot/refind_linux.conf
  1509. nextblitem="${txtedit//%1/refind_linux.conf}"
  1510. ;;
  1511. esac
  1512. archbootloaderrefindmenu "${nextblitem}"
  1513. fi
  1514. }
  1515. archrefindinstall(){
  1516. clear
  1517. echo "pacstrap /mnt refind-efi"
  1518. echo "archchroot refindbootloaderinstall ${realrootdev}"
  1519. echo "echo \"\\\"Hyperbola GNU+Linux-libre \\\" \\\"root=UUID=${rootuuid} rw add_efi_memmap\\\"\" > /mnt/boot/refind_linux.conf"
  1520. echo "echo \"\\\"Hyperbola GNU+Linux-libre Fallback\\\" \\\"root=UUID=${rootuuid} rw add_efi_memmap initrd=/initramfs-linux-fallback.img\\\"\" >> /mnt/boot/refind_linux.conf"
  1521. pacstrap /mnt refind-efi
  1522. archchroot refindbootloaderinstall "${realrootdev}"
  1523. rootuuid=$(blkid -s UUID -o value "${realrootdev}")
  1524. echo "\"Hyperbola GNU+Linux-libre \" \"root=UUID=${rootuuid} rw add_efi_memmap\"" > /mnt/boot/refind_linux.conf
  1525. echo "\"Hyperbola GNU+Linux-libre Fallback\" \"root=UUID=${rootuuid} rw add_efi_memmap initrd=/initramfs-linux-fallback.img\"" >> /mnt/boot/refind_linux.conf
  1526. pressanykey
  1527. }
  1528. archrefindinstallchroot(){
  1529. #--usedefault /dev/sdXY --alldrivers
  1530. echo "refind-install"
  1531. refind-install
  1532. isvbox=$(lspci | grep "VirtualBox G")
  1533. if [ "${isvbox}" ]; then
  1534. echo "VirtualBox detected, creating startup.nsh..."
  1535. printf '%s' '\EFI\refind\refind_x64.efi' > /boot/startup.nsh
  1536. fi
  1537. }
  1538. archextrasmenu(){
  1539. pkgs=""
  1540. options=()
  1541. # personal start
  1542. options+=("openntpd" "" on)
  1543. options+=("ldns" "" on)
  1544. options+=("emacs" "" on)
  1545. options+=("xenocara-server" "" on)
  1546. options+=("xenocara-xinit" "" on)
  1547. options+=("xenocara" "" on)
  1548. options+=("ttf-liberation" "" on)
  1549. options+=("ttf-dejavu" "" on)
  1550. options+=("mesa mesa-demos" "" on)
  1551. options+=("alsa-lib" "" on)
  1552. options+=("iceweasel-uxp" "" on)
  1553. options+=("iceweasel-uxp-l10n-es-es" "" on)
  1554. options+=("aspell-i18n-dict-et" "" on)
  1555. options+=("binutils" "" on)
  1556. options+=("zlib" "" on)
  1557. options+=("bzip2" "" on)
  1558. options+=("unar" "" on)
  1559. options+=("lrzip" "" on)
  1560. options+=("p7zip" "" on)
  1561. options+=("zip" "" on)
  1562. options+=("libzip" "" on)
  1563. options+=("unzip" "" on)
  1564. options+=("udevil" "" on)
  1565. options+=("dash" "" on)
  1566. options+=("ntfs-3g" "" on)
  1567. options+=("exfat-utils" "" on)
  1568. options+=("dosfstools" "" on)
  1569. options+=("wget" "" on)
  1570. options+=("picom" "" on)
  1571. options+=("feh" "" on)
  1572. options+=("sakura" "" on)
  1573. options+=("ttf-hack" "" on)
  1574. options+=("hspell" "" on)
  1575. options+=("libretools" "" on)
  1576. options+=("tree" "" on)
  1577. options+=("htop" "" on)
  1578. options+=("aspell-i18n-dict-es" "" on)
  1579. options+=("aspell-i18n-dict-de" "" on)
  1580. options+=("scrot" "" on)
  1581. options+=("herbe" "" on)
  1582. options+=("wmctrl" "" on)
  1583. options+=("xclip" "" on)
  1584. options+=("espeak" "" on)
  1585. options+=("doas" "" on)
  1586. # personal end
  1587. options+=("nano" "" on)
  1588. options+=("screen" "" on)
  1589. options+=("vim" "" on)
  1590. options+=("dhcpcd" "" on)
  1591. options+=("wpa_supplicant" "" on)
  1592. options+=("iw" "" on)
  1593. options+=("net-tools" "" on)
  1594. options+=("bind-tools" "" on)
  1595. sel=$(whiptail --backtitle "${apptitle}" --title "${txtextrasmenu}" --checklist "" 0 0 0 \
  1596. "${options[@]}" \
  1597. 3>&1 1>&2 2>&3)
  1598. if [ ! "$?" = "0" ]; then
  1599. return 1
  1600. fi
  1601. for itm in $sel; do
  1602. pkgs="$pkgs ${itm//\"/}"
  1603. done
  1604. clear
  1605. echo "pacstrap /mnt ${pkgs}"
  1606. # shellcheck disable=SC2086
  1607. pacstrap /mnt ${pkgs}
  1608. if [[ "${pkgs}" == *"dhcpcd"* ]]; then
  1609. archchroot enabledhcpcd
  1610. fi
  1611. if [[ "${pkgs}" == *"wpa_supplicant"* ]]; then
  1612. archchroot enablewpa_supplicant
  1613. fi
  1614. pressanykey
  1615. }
  1616. archenabledhcpcdchroot(){
  1617. echo "rc-update add dhcpcd default"
  1618. rc-update add dhcpcd default
  1619. exit
  1620. }
  1621. archenablewpa_supplicantchroot(){
  1622. echo "rc-update add wpa_supplicant default"
  1623. rc-update add wpa_supplicant default
  1624. exit
  1625. }
  1626. installhyperdi(){
  1627. txtinstallhyperdi="Hyperbola GNU+Linux-libre Desktop Install (hyperdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nHyperbola GNU+Linux-libre Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?"
  1628. if(whiptail --backtitle "${apptitle}" --title "hyperdi" --yesno "${txtinstallhyperdi}" 0 0); then
  1629. clear
  1630. echo "pacstrap /mnt wget libnewt"
  1631. pacstrap /mnt wget libnewt
  1632. fi
  1633. if [ "$?" = "0" ]; then
  1634. options=()
  1635. options+=("${txthyperdiinstallandlaunch}" "")
  1636. options+=("${txthyperdilaunch}" "")
  1637. options+=("${txthyperdiinstall}" "")
  1638. sel=$(whiptail --backtitle "${apptitle}" --title "${txthyperdimenu}" --menu "" --cancel-button "${txtback}" 0 0 0 \
  1639. "${options[@]}" \
  1640. 3>&1 1>&2 2>&3)
  1641. if [ "$?" = "0" ]; then
  1642. case ${sel} in
  1643. "${txthyperdiinstallandlaunch}") archchroot hyperdiinstallandlaunch;;
  1644. "${txthyperdilaunch}") archchroot hyperdilaunch;;
  1645. "${txthyperdiinstall}")
  1646. clear
  1647. archchroot hyperdiinstall
  1648. pressanykey
  1649. ;;
  1650. esac
  1651. fi
  1652. fi
  1653. }
  1654. hyperdidownload(){
  1655. txtselectserver="Select source server :"
  1656. txtback="Back"
  1657. options=()
  1658. options+=("sourceforge.net" "recommended")
  1659. options+=("github.com" "")
  1660. sel=$(whiptail --backtitle "${apptitle}" --title "${txtselectserver}" --menu "" --cancel-button "${txtback}" 0 0 0 \
  1661. "${options[@]}" \
  1662. 3>&1 1>&2 2>&3)
  1663. if [ "$?" = "0" ]; then
  1664. case ${sel} in
  1665. "sourceforge.net")
  1666. hyperdiurl=hyperdi.sourceforge.net/hyperdi
  1667. ;;
  1668. "github.com")
  1669. hyperdiurl=matmoul.github.io/hyperdi >hyperdi
  1670. ;;
  1671. esac
  1672. fi
  1673. echo "curl -L ${hyperdiurl} >hyperdi"
  1674. curl -L "${hyperdiurl}" > hyperdi
  1675. }
  1676. hyperdiinstallandlaunchchroot(){
  1677. cd || return
  1678. hyperdidownload
  1679. sh hyperdi -i
  1680. hyperdi --chroot
  1681. exit
  1682. }
  1683. hyperdilaunchchroot(){
  1684. cd || return
  1685. hyperdidownload
  1686. sh hyperdi --chroot
  1687. rm hyperdi
  1688. exit
  1689. }
  1690. hyperdiinstallchroot(){
  1691. cd || return
  1692. hyperdidownload
  1693. sh hyperdi -i
  1694. exit
  1695. }
  1696. # --------------------------------------------------------
  1697. # --------------------------------------------------------
  1698. pressanykey(){
  1699. read -r -n1 -p "${txtpressanykey}"
  1700. }
  1701. loadstrings(){
  1702. locale=en_US.UTF-8
  1703. #font=
  1704. txtexit="Exit"
  1705. txtback="Back"
  1706. txtignore="Ignore"
  1707. txtselectserver="Select source server :"
  1708. txtmainmenu="Main Menu"
  1709. txtlanguage="Language"
  1710. txtsetkeymap="Set Keyboard Layout"
  1711. txteditor="Editor"
  1712. txtdiskpartmenu="Disk Partitions"
  1713. txtselectpartsmenu="Select Partitions and Install"
  1714. txthelp="Help"
  1715. txtchangelog="Changelog"
  1716. txtreboot="Reboot"
  1717. txtautoparts="Auto Partitions"
  1718. txteditparts="Edit Partitions"
  1719. txtautopartsconfirm="Selected device : %1\n\nAll data will be erased ! \n\nContinue ?"
  1720. txtautopartclear="Clear all partition data"
  1721. txtautopartcreate="Create %1 partition"
  1722. txthybridpartcreate="Set hybrid MBR"
  1723. txtselectdevice="Select %1 device :"
  1724. txtselecteddevices="Selected devices :"
  1725. txtformatmountmenu="Format and Mount"
  1726. txtformatdevices="Format Devices"
  1727. txtformatdevice="Format Device"
  1728. txtmount="Mount"
  1729. txtunmount="Unmount"
  1730. txtmountdesc="Install or Config"
  1731. txtformatdeviceconfirm="Warning, all data on selected devices will be erased ! \nFormat devices ?"
  1732. txtselectpartformat="Select partition format for %1 :"
  1733. txtformatingpart="Formatting partition %1 as"
  1734. txtcreateluksdevice="Create luks device :"
  1735. txtopenluksdevice="Open luks device :"
  1736. txtluksdevicecreated="luks device created !"
  1737. txtinstallmenu="Install Menu"
  1738. txthyperbolainstallmenu="Hyperbola Install Menu"
  1739. txtselectmirrorsbycountry="Select mirrors by country"
  1740. txtselectcountry="Select country"
  1741. txteditmirrorlist="Edit mirrorlist"
  1742. txteditpacmanconf="Edit pacman.conf"
  1743. txtinstallhyperbola="Install Hyperbola GNU+Linux-libre - "
  1744. txtinstallhyperbolakernel="Kernel"
  1745. txtinstallhyperbolafirmwares="Firmwares"
  1746. txtinstallhyperbolafilesystems="File Systems"
  1747. txtinstallhyperbolacustompackagelist="Custom Package List"
  1748. txtconfighyperbola="Config Hyperbola GNU+Linux-libre"
  1749. txtsethostname="Set Computer Name"
  1750. txtsetfont="Set Font"
  1751. txtsetlocale="Set Locale"
  1752. txtsettime="Set Time"
  1753. txtsetrootpassword="Set root password"
  1754. txthwclock="Hardware clock :"
  1755. txthwclockutc="UTC"
  1756. txthwclocklocal="Local"
  1757. txtbootloader="Bootloader"
  1758. txtbootloadermenu="Choose your bootloader"
  1759. txtefibootmgr="efibootmgr is required for EFI computers."
  1760. txtbootloadergrubmenu="Grub Install Menu"
  1761. txtrungrubmakeconfig="Run grub-mkconfig ?"
  1762. txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?"
  1763. txtbootloadersyslinuxmenu="Syslinux Install Menu"
  1764. txtsyslinuxaddefibootmgr="EFI install require efibootmgr"
  1765. txtsyslinuxaddgptfdisk="GPT disk require gptfdisk"
  1766. txtsyslinuxaddmtools="FAT boot part require mtools"
  1767. txtbootloaderrefindmenu="rEFInd Install Menu"
  1768. txtextrasmenu="Extras"
  1769. txtoptional="Optional"
  1770. txtgenerate="Generate %1"
  1771. txtedit="Edit %1"
  1772. txtinstall="Install %1"
  1773. txtpressanykey="Press any key to continue."
  1774. txthyperdimenu="Hyperbola Desktop Install"
  1775. txthyperdidesc="Full desktop install script"
  1776. txtinstallhyperdi="Hyperbola GNU+Linux-libre Desktop Install (hyperdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nHyperbola GNU+Linux-libre Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?"
  1777. txthyperdiinstallandlaunch="Install and run hyperdi"
  1778. txthyperdiinstall="Install hyperdi"
  1779. txthyperdilaunch="Launch hyperdi"
  1780. }
  1781. # --------------------------------------------------------
  1782. # --------------------------------------------------------
  1783. while (( "$#" )); do
  1784. case ${1} in
  1785. --help)
  1786. echo "hyperfi"
  1787. echo "------"
  1788. echo "-cpl | --custom-package-list url Set custom package list url"
  1789. echo "-sf | --skip-font Skip setfont from language files"
  1790. echo "-efiX -efi0 : disable EFI, -efi1 efi inst, -efi2 efi hybrid inst"
  1791. echo "-t | --test hypergit name branch Test hyperfi script and language"
  1792. exit 0
  1793. ;;
  1794. -cpl | --custom-package-list)
  1795. curl -L "${2}" > /tmp/hyperfi-custom-package-list
  1796. if [[ "$?" != "0" ]]; then
  1797. echo "Error downloading custom package list"
  1798. exit 0
  1799. fi
  1800. cpl=1
  1801. ;;
  1802. -sf | --skip-font) skipfont=1;;
  1803. -t | --test)
  1804. curl -o hyperfi "https://hgit.ga/${2}/hyperfi/raw/branch/${3}/hyperfi"
  1805. sh hyperfi -tt "${2}" "${3}"
  1806. exit 0
  1807. ;;
  1808. -tt) baseurl="https://hgit.ga/${2}/hyperfi/raw/branch/${3}";;
  1809. -efi0)
  1810. efimode=0
  1811. ;;
  1812. -efi1)
  1813. eficomputer=1
  1814. efimode=1
  1815. ;;
  1816. -efi2)
  1817. eficomputer=1
  1818. efimode=2
  1819. ;;
  1820. --chroot)
  1821. chroot=1
  1822. command=${2}
  1823. args=${3}
  1824. ;;
  1825. esac
  1826. shift
  1827. done
  1828. if [ "${chroot}" = "1" ]; then
  1829. case ${command} in
  1830. 'setrootpassword') archsetrootpasswordchroot;;
  1831. 'setlocale') archsetlocalechroot;;
  1832. 'settimeutc') archsettimeutcchroot;;
  1833. 'settimelocal') archsettimelocalchroot;;
  1834. 'genmkinitcpio') archgenmkinitcpiochroot;;
  1835. 'enabledhcpcd') archenabledhcpcdchroot;;
  1836. 'enablewpa_supplicant') archenablewpa_supplicantchroot;;
  1837. 'grubinstall') archgrubinstallchroot;;
  1838. 'grubbootloaderinstall') archgrubinstallbootloaderchroot "${args}";;
  1839. 'grubbootloaderefiinstall') archgrubinstallbootloaderefichroot "${args}";;
  1840. 'grubbootloaderefiusbinstall') archgrubinstallbootloaderefiusbchroot "${args}";;
  1841. 'syslinuxbootloaderinstall') archsyslinuxinstallbootloaderchroot "${args}";;
  1842. 'syslinuxbootloaderefiinstall') archsyslinuxinstallbootloaderefichroot "${args}";;
  1843. 'refindbootloaderinstall') archrefindinstallchroot "${args}";;
  1844. 'hyperdiinstallandlaunch') hyperdiinstallandlaunchchroot;;
  1845. 'hyperdiinstall') hyperdiinstallchroot;;
  1846. 'hyperdilaunch') hyperdilaunchchroot;;
  1847. esac
  1848. else
  1849. pacman -S --needed arch-install-scripts wget libnewt
  1850. dmesg |grep efi: > /dev/null
  1851. if [ "$?" == "1" ]; then
  1852. if [ "${eficomputer}" != "1" ]; then
  1853. eficomputer=0
  1854. fi
  1855. else
  1856. eficomputer=1
  1857. if [ "${efimode}" == "" ]; then
  1858. efimode=1
  1859. fi
  1860. fi
  1861. loadstrings
  1862. EDITOR=nano
  1863. mainmenu
  1864. fi
  1865. exit 0
  1866. # --------------------------------------------------------