installer.sh.in 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540
  1. #!/bin/bash
  2. #-
  3. # Copyright (c) 2012-2015 Juan Romero Pardines <[email protected]>.
  4. # 2012 Dave Elusive <[email protected]>.
  5. # All rights reserved.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions
  9. # are met:
  10. # 1. Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. # 2. Redistributions in binary form must reproduce the above copyright
  13. # notice, this list of conditions and the following disclaimer in the
  14. # documentation and/or other materials provided with the distribution.
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18. # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21. # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. #-
  27. # Make sure we don't inherit these from env.
  28. SOURCE_DONE=
  29. HOSTNAME_DONE=
  30. KEYBOARD_DONE=
  31. LOCALE_DONE=
  32. TIMEZONE_DONE=
  33. ROOTPASSWORD_DONE=
  34. USERLOGIN_DONE=
  35. USERPASSWORD_DONE=
  36. USERNAME_DONE=
  37. USERGROUPS_DONE=
  38. USERACCOUNT_DONE=
  39. BOOTLOADER_DONE=
  40. PARTITIONS_DONE=
  41. NETWORK_DONE=
  42. FILESYSTEMS_DONE=
  43. MIRROR_DONE=
  44. TARGETDIR=/mnt/target
  45. LOG=/dev/tty8
  46. CONF_FILE=/tmp/.void-installer.conf
  47. if [ ! -f $CONF_FILE ]; then
  48. touch -f $CONF_FILE
  49. fi
  50. ANSWER=$(mktemp -t vinstall-XXXXXXXX || exit 1)
  51. TARGET_FSTAB=$(mktemp -t vinstall-fstab-XXXXXXXX || exit 1)
  52. trap "DIE" INT TERM QUIT
  53. # disable printk
  54. if [ -w /proc/sys/kernel/printk ]; then
  55. echo 0 >/proc/sys/kernel/printk
  56. fi
  57. # Detect if this is an EFI system.
  58. if [ -e /sys/firmware/efi/systab ]; then
  59. EFI_SYSTEM=1
  60. EFI_FW_BITS=$(cat /sys/firmware/efi/fw_platform_size)
  61. if [ $EFI_FW_BITS -eq 32 ]; then
  62. EFI_TARGET=i386-efi
  63. else
  64. EFI_TARGET=x86_64-efi
  65. fi
  66. fi
  67. # dialog colors
  68. BLACK="\Z0"
  69. RED="\Z1"
  70. GREEN="\Z2"
  71. YELLOW="\Z3"
  72. BLUE="\Z4"
  73. MAGENTA="\Z5"
  74. CYAN="\Z6"
  75. WHITE="\Z7"
  76. BOLD="\Zb"
  77. REVERSE="\Zr"
  78. UNDERLINE="\Zu"
  79. RESET="\Zn"
  80. # Properties shared per widget.
  81. MENULABEL="${BOLD}Use UP and DOWN keys to navigate \
  82. menus. Use TAB to switch between buttons and ENTER to select.${RESET}"
  83. MENUSIZE="14 60 0"
  84. INPUTSIZE="8 60"
  85. MSGBOXSIZE="8 70"
  86. YESNOSIZE="$INPUTSIZE"
  87. WIDGET_SIZE="10 70"
  88. DIALOG() {
  89. rm -f $ANSWER
  90. dialog --colors --keep-tite --no-shadow --no-mouse \
  91. --backtitle "${BOLD}${WHITE}Void Linux installation -- https://www.voidlinux.org (@@MKLIVE_VERSION@@)${RESET}" \
  92. --cancel-label "Back" --aspect 20 "$@" 2>$ANSWER
  93. return $?
  94. }
  95. INFOBOX() {
  96. # Note: dialog --infobox and --keep-tite don't work together
  97. dialog --colors --no-shadow --no-mouse \
  98. --backtitle "${BOLD}${WHITE}Void Linux installation -- https://www.voidlinux.org (@@MKLIVE_VERSION@@)${RESET}" \
  99. --title "${TITLE}" --aspect 20 --infobox "$@"
  100. }
  101. DIE() {
  102. rval=$1
  103. [ -z "$rval" ] && rval=0
  104. clear
  105. rm -f $ANSWER $TARGET_FSTAB
  106. # reenable printk
  107. if [ -w /proc/sys/kernel/printk ]; then
  108. echo 4 >/proc/sys/kernel/printk
  109. fi
  110. umount_filesystems
  111. exit $rval
  112. }
  113. set_option() {
  114. if grep -Eq "^${1}.*" $CONF_FILE; then
  115. sed -i -e "/^${1}.*/d" $CONF_FILE
  116. fi
  117. echo "${1} ${2}" >>$CONF_FILE
  118. }
  119. get_option() {
  120. echo $(grep -E "^${1}.*" $CONF_FILE|sed -e "s|${1}||")
  121. }
  122. # ISO-639 language names for locales
  123. iso639_language() {
  124. case "$1" in
  125. aa) echo "Afar" ;;
  126. af) echo "Afrikaans" ;;
  127. an) echo "Aragonese" ;;
  128. ar) echo "Arabic" ;;
  129. ast) echo "Asturian" ;;
  130. be) echo "Belgian" ;;
  131. bg) echo "Bulgarian" ;;
  132. bhb) echo "Bhili" ;;
  133. br) echo "Breton" ;;
  134. bs) echo "Bosnian" ;;
  135. ca) echo "Catalan" ;;
  136. cs) echo "Czech" ;;
  137. cy) echo "Welsh" ;;
  138. da) echo "Danish" ;;
  139. de) echo "German" ;;
  140. el) echo "Greek" ;;
  141. en) echo "English" ;;
  142. es) echo "Spanish" ;;
  143. et) echo "Estonian" ;;
  144. eu) echo "Basque" ;;
  145. fi) echo "Finnish" ;;
  146. fo) echo "Faroese" ;;
  147. fr) echo "French" ;;
  148. ga) echo "Irish" ;;
  149. gd) echo "Scottish Gaelic" ;;
  150. gl) echo "Galician" ;;
  151. gv) echo "Manx" ;;
  152. he) echo "Hebrew" ;;
  153. hr) echo "Croatian" ;;
  154. hsb) echo "Upper Sorbian" ;;
  155. hu) echo "Hungarian" ;;
  156. id) echo "Indonesian" ;;
  157. is) echo "Icelandic" ;;
  158. it) echo "Italian" ;;
  159. iw) echo "Hebrew" ;;
  160. ja) echo "Japanese" ;;
  161. ka) echo "Georgian" ;;
  162. kk) echo "Kazakh" ;;
  163. kl) echo "Kalaallisut" ;;
  164. ko) echo "Korean" ;;
  165. ku) echo "Kurdish" ;;
  166. kw) echo "Cornish" ;;
  167. lg) echo "Ganda" ;;
  168. lt) echo "Lithuanian" ;;
  169. lv) echo "Latvian" ;;
  170. mg) echo "Malagasy" ;;
  171. mi) echo "Maori" ;;
  172. mk) echo "Macedonian" ;;
  173. ms) echo "Malay" ;;
  174. mt) echo "Maltese" ;;
  175. nb) echo "Norwegian Bokmål" ;;
  176. nl) echo "Dutch" ;;
  177. nn) echo "Norwegian Nynorsk" ;;
  178. oc) echo "Occitan" ;;
  179. om) echo "Oromo" ;;
  180. pl) echo "Polish" ;;
  181. pt) echo "Portugese" ;;
  182. ro) echo "Romanian" ;;
  183. ru) echo "Russian" ;;
  184. sk) echo "Slovak" ;;
  185. sl) echo "Slovenian" ;;
  186. so) echo "Somali" ;;
  187. sq) echo "Albanian" ;;
  188. st) echo "Southern Sotho" ;;
  189. sv) echo "Swedish" ;;
  190. tcy) echo "Tulu" ;;
  191. tg) echo "Tajik" ;;
  192. th) echo "Thai" ;;
  193. tl) echo "Tagalog" ;;
  194. tr) echo "Turkish" ;;
  195. uk) echo "Ukrainian" ;;
  196. uz) echo "Uzbek" ;;
  197. wa) echo "Walloon" ;;
  198. xh) echo "Xhosa" ;;
  199. yi) echo "Yiddish" ;;
  200. zh) echo "Chinese" ;;
  201. zu) echo "Zulu" ;;
  202. *) echo "$1" ;;
  203. esac
  204. }
  205. # ISO-3166 country codes for locales
  206. iso3166_country() {
  207. case "$1" in
  208. AD) echo "Andorra" ;;
  209. AE) echo "United Arab Emirates" ;;
  210. AL) echo "Albania" ;;
  211. AR) echo "Argentina" ;;
  212. AT) echo "Austria" ;;
  213. AU) echo "Australia" ;;
  214. BA) echo "Bonsia and Herzegovina" ;;
  215. BE) echo "Belgium" ;;
  216. BG) echo "Bulgaria" ;;
  217. BH) echo "Bahrain" ;;
  218. BO) echo "Bolivia" ;;
  219. BR) echo "Brazil" ;;
  220. BW) echo "Botswana" ;;
  221. BY) echo "Belarus" ;;
  222. CA) echo "Canada" ;;
  223. CH) echo "Switzerland" ;;
  224. CL) echo "Chile" ;;
  225. CN) echo "China" ;;
  226. CO) echo "Colombia" ;;
  227. CR) echo "Costa Rica" ;;
  228. CY) echo "Cyprus" ;;
  229. CZ) echo "Czech Republic" ;;
  230. DE) echo "Germany" ;;
  231. DJ) echo "Djibouti" ;;
  232. DK) echo "Denmark" ;;
  233. DO) echo "Dominican Republic" ;;
  234. DZ) echo "Algeria" ;;
  235. EC) echo "Ecuador" ;;
  236. EE) echo "Estonia" ;;
  237. EG) echo "Egypt" ;;
  238. ES) echo "Spain" ;;
  239. FI) echo "Finland" ;;
  240. FO) echo "Faroe Islands" ;;
  241. FR) echo "France" ;;
  242. GB) echo "Great Britain" ;;
  243. GE) echo "Georgia" ;;
  244. GL) echo "Greenland" ;;
  245. GR) echo "Greece" ;;
  246. GT) echo "Guatemala" ;;
  247. HK) echo "Hong Kong" ;;
  248. HN) echo "Honduras" ;;
  249. HR) echo "Croatia" ;;
  250. HU) echo "Hungary" ;;
  251. ID) echo "Indonesia" ;;
  252. IE) echo "Ireland" ;;
  253. IL) echo "Israel" ;;
  254. IN) echo "India" ;;
  255. IQ) echo "Iraq" ;;
  256. IS) echo "Iceland" ;;
  257. IT) echo "Italy" ;;
  258. JO) echo "Jordan" ;;
  259. JP) echo "Japan" ;;
  260. KE) echo "Kenya" ;;
  261. KR) echo "Korea, Republic of" ;;
  262. KW) echo "Kuwait" ;;
  263. KZ) echo "Kazakhstan" ;;
  264. LB) echo "Lebanon" ;;
  265. LT) echo "Lithuania" ;;
  266. LU) echo "Luxembourg" ;;
  267. LV) echo "Latvia" ;;
  268. LY) echo "Libya" ;;
  269. MA) echo "Morocco" ;;
  270. MG) echo "Madagascar" ;;
  271. MK) echo "Macedonia" ;;
  272. MT) echo "Malta" ;;
  273. MX) echo "Mexico" ;;
  274. MY) echo "Malaysia" ;;
  275. NI) echo "Nicaragua" ;;
  276. NL) echo "Netherlands" ;;
  277. NO) echo "Norway" ;;
  278. NZ) echo "New Zealand" ;;
  279. OM) echo "Oman" ;;
  280. PA) echo "Panama" ;;
  281. PE) echo "Peru" ;;
  282. PH) echo "Philippines" ;;
  283. PL) echo "Poland" ;;
  284. PR) echo "Puerto Rico" ;;
  285. PT) echo "Portugal" ;;
  286. PY) echo "Paraguay" ;;
  287. QA) echo "Qatar" ;;
  288. RO) echo "Romania" ;;
  289. RU) echo "Russian Federation" ;;
  290. SA) echo "Saudi Arabia" ;;
  291. SD) echo "Sudan" ;;
  292. SE) echo "Sweden" ;;
  293. SG) echo "Singapore" ;;
  294. SI) echo "Slovenia" ;;
  295. SK) echo "Slovakia" ;;
  296. SO) echo "Somalia" ;;
  297. SV) echo "El Salvador" ;;
  298. SY) echo "Syria" ;;
  299. TH) echo "Thailand" ;;
  300. TJ) echo "Tajikistan" ;;
  301. TN) echo "Tunisia" ;;
  302. TR) echo "Turkey" ;;
  303. TW) echo "Taiwan" ;;
  304. UA) echo "Ukraine" ;;
  305. UG) echo "Uganda" ;;
  306. US) echo "United States of America" ;;
  307. UY) echo "Uruguay" ;;
  308. UZ) echo "Uzbekistan" ;;
  309. VE) echo "Venezuela" ;;
  310. YE) echo "Yemen" ;;
  311. ZA) echo "South Africa" ;;
  312. ZW) echo "Zimbabwe" ;;
  313. *) echo "$1" ;;
  314. esac
  315. }
  316. show_disks() {
  317. local dev size sectorsize gbytes
  318. # IDE
  319. for dev in $(ls /sys/block|grep -E '^hd'); do
  320. if [ "$(cat /sys/block/$dev/device/media)" = "disk" ]; then
  321. # Find out nr sectors and bytes per sector;
  322. echo "/dev/$dev"
  323. size=$(cat /sys/block/$dev/size)
  324. sectorsize=$(cat /sys/block/$dev/queue/hw_sector_size)
  325. gbytes="$(($size * $sectorsize / 1024 / 1024 / 1024))"
  326. echo "size:${gbytes}GB;sector_size:$sectorsize"
  327. fi
  328. done
  329. # SATA/SCSI and Virtual disks (virtio)
  330. for dev in $(ls /sys/block|grep -E '^([sv]|xv)d|mmcblk|nvme'); do
  331. echo "/dev/$dev"
  332. size=$(cat /sys/block/$dev/size)
  333. sectorsize=$(cat /sys/block/$dev/queue/hw_sector_size)
  334. gbytes="$(($size * $sectorsize / 1024 / 1024 / 1024))"
  335. echo "size:${gbytes}GB;sector_size:$sectorsize"
  336. done
  337. # cciss(4) devices
  338. for dev in $(ls /dev/cciss 2>/dev/null|grep -E 'c[0-9]d[0-9]$'); do
  339. echo "/dev/cciss/$dev"
  340. size=$(cat /sys/block/cciss\!$dev/size)
  341. sectorsize=$(cat /sys/block/cciss\!$dev/queue/hw_sector_size)
  342. gbytes="$(($size * $sectorsize / 1024 / 1024 / 1024))"
  343. echo "size:${gbytes}GB;sector_size:$sectorsize"
  344. done
  345. }
  346. show_partitions() {
  347. local dev fstype fssize p part
  348. set -- $(show_disks)
  349. while [ $# -ne 0 ]; do
  350. disk=$(basename $1)
  351. shift 2
  352. # ATA/SCSI/SATA
  353. for p in /sys/block/$disk/$disk*; do
  354. if [ -d $p ]; then
  355. part=$(basename $p)
  356. fstype=$(lsblk -nfr /dev/$part|awk '{print $2}'|head -1)
  357. [ "$fstype" = "iso9660" ] && continue
  358. [ "$fstype" = "crypto_LUKS" ] && continue
  359. [ "$fstype" = "LVM2_member" ] && continue
  360. fssize=$(lsblk -nr /dev/$part|awk '{print $4}'|head -1)
  361. echo "/dev/$part"
  362. echo "size:${fssize:-unknown};fstype:${fstype:-none}"
  363. fi
  364. done
  365. done
  366. # Device Mapper
  367. for p in /dev/mapper/*; do
  368. part=$(basename $p)
  369. [ "${part}" = "live-rw" ] && continue
  370. [ "${part}" = "live-base" ] && continue
  371. [ "${part}" = "control" ] && continue
  372. fstype=$(lsblk -nfr $p|awk '{print $2}'|head -1)
  373. fssize=$(lsblk -nr $p|awk '{print $4}'|head -1)
  374. echo "${p}"
  375. echo "size:${fssize:-unknown};fstype:${fstype:-none}"
  376. done
  377. # Software raid (md)
  378. for p in $(ls -d /dev/md* 2>/dev/null|grep '[0-9]'); do
  379. part=$(basename $p)
  380. if cat /proc/mdstat|grep -qw $part; then
  381. fstype=$(lsblk -nfr /dev/$part|awk '{print $2}')
  382. [ "$fstype" = "crypto_LUKS" ] && continue
  383. [ "$fstype" = "LVM2_member" ] && continue
  384. fssize=$(lsblk -nr /dev/$part|awk '{print $4}')
  385. echo "$p"
  386. echo "size:${fssize:-unknown};fstype:${fstype:-none}"
  387. fi
  388. done
  389. # cciss(4) devices
  390. for part in $(ls /dev/cciss 2>/dev/null|grep -E 'c[0-9]d[0-9]p[0-9]+'); do
  391. fstype=$(lsblk -nfr /dev/cciss/$part|awk '{print $2}')
  392. [ "$fstype" = "crypto_LUKS" ] && continue
  393. [ "$fstype" = "LVM2_member" ] && continue
  394. fssize=$(lsblk -nr /dev/cciss/$part|awk '{print $4}')
  395. echo "/dev/cciss/$part"
  396. echo "size:${fssize:-unknown};fstype:${fstype:-none}"
  397. done
  398. if [ -e /sbin/lvs ]; then
  399. # LVM
  400. lvs --noheadings|while read lvname vgname perms size; do
  401. echo "/dev/mapper/${vgname}-${lvname}"
  402. echo "size:${size};fstype:lvm"
  403. done
  404. fi
  405. }
  406. menu_filesystems() {
  407. local dev fstype fssize mntpoint reformat
  408. while true; do
  409. DIALOG --ok-label "Change" --cancel-label "Done" \
  410. --title " Select the partition to edit " --menu "$MENULABEL" \
  411. ${MENUSIZE} $(show_partitions)
  412. [ $? -ne 0 ] && return
  413. dev=$(cat $ANSWER)
  414. DIALOG --title " Select the filesystem type for $dev " \
  415. --menu "$MENULABEL" ${MENUSIZE} \
  416. "btrfs" "Oracle's Btrfs" \
  417. "ext2" "Linux ext2 (no journaling)" \
  418. "ext3" "Linux ext3 (journal)" \
  419. "ext4" "Linux ext4 (journal)" \
  420. "f2fs" "Flash-Friendly Filesystem" \
  421. "swap" "Linux swap" \
  422. "vfat" "FAT32" \
  423. "xfs" "SGI's XFS"
  424. if [ $? -eq 0 ]; then
  425. fstype=$(cat $ANSWER)
  426. else
  427. continue
  428. fi
  429. if [ "$fstype" != "swap" ]; then
  430. DIALOG --inputbox "Please specify the mount point for $dev:" ${INPUTSIZE}
  431. if [ $? -eq 0 ]; then
  432. mntpoint=$(cat $ANSWER)
  433. elif [ $? -eq 1 ]; then
  434. continue
  435. fi
  436. else
  437. mntpoint=swap
  438. fi
  439. DIALOG --yesno "Do you want to create a new filesystem on $dev?" ${YESNOSIZE}
  440. if [ $? -eq 0 ]; then
  441. reformat=1
  442. elif [ $? -eq 1 ]; then
  443. reformat=0
  444. else
  445. continue
  446. fi
  447. fssize=$(lsblk -nr $dev|awk '{print $4}')
  448. set -- "$fstype" "$fssize" "$mntpoint" "$reformat"
  449. if [ -n "$1" -a -n "$2" -a -n "$3" -a -n "$4" ]; then
  450. local bdev=$(basename $dev)
  451. local ddev=$(basename $(dirname $dev))
  452. if [ "$ddev" != "dev" ]; then
  453. sed -i -e "/^MOUNTPOINT \/dev\/${ddev}\/${bdev}.*/d" $CONF_FILE
  454. else
  455. sed -i -e "/^MOUNTPOINT \/dev\/${bdev}.*/d" $CONF_FILE
  456. fi
  457. echo "MOUNTPOINT $dev $1 $2 $3 $4" >>$CONF_FILE
  458. fi
  459. done
  460. }
  461. menu_partitions() {
  462. DIALOG --title " Select the disk to partition " \
  463. --menu "$MENULABEL" ${MENUSIZE} $(show_disks)
  464. if [ $? -eq 0 ]; then
  465. local device=$(cat $ANSWER)
  466. DIALOG --title " Select the software for partitioning " \
  467. --menu "$MENULABEL" ${MENUSIZE} \
  468. "cfdisk" "Easy to use" \
  469. "fdisk" "More advanced"
  470. if [ $? -eq 0 ]; then
  471. local software=$(cat $ANSWER)
  472. DIALOG --title "Modify Partition Table on $device" --msgbox "\n
  473. ${BOLD}${software} will be executed in disk $device.${RESET}\n\n
  474. For BIOS systems, MBR or GPT partition tables are supported.\n
  475. To use GPT on PC BIOS systems an empty partition of 1MB must be added\n
  476. at the first 2GB of the disk with the TOGGLE \`bios_grub' enabled.\n
  477. ${BOLD}NOTE: you don't need this on EFI systems.${RESET}\n\n
  478. For EFI systems GPT is mandatory and a FAT32 partition with at least\n
  479. 100MB must be created with the TOGGLE \`boot', this will be used as\n
  480. EFI System Partition. This partition must have mountpoint as \`/boot/efi'.\n\n
  481. At least 1 partition is required for the rootfs (/).\n
  482. For swap, RAM*2 must be really enough. For / 600MB are required.\n\n
  483. ${BOLD}WARNING: /usr is not supported as a separate partition.${RESET}\n
  484. ${RESET}\n" 18 80
  485. if [ $? -eq 0 ]; then
  486. while true; do
  487. clear; $software $device; PARTITIONS_DONE=1
  488. break
  489. done
  490. else
  491. return
  492. fi
  493. fi
  494. fi
  495. }
  496. menu_keymap() {
  497. local _keymaps="$(find /usr/share/kbd/keymaps/ -type f -iname "*.map.gz" -printf "%f\n" | sed 's|.map.gz||g' | sort)"
  498. local _KEYMAPS=
  499. for f in ${_keymaps}; do
  500. _KEYMAPS="${_KEYMAPS} ${f} -"
  501. done
  502. while true; do
  503. DIALOG --title " Select your keymap " --menu "$MENULABEL" 14 70 14 ${_KEYMAPS}
  504. if [ $? -eq 0 ]; then
  505. set_option KEYMAP "$(cat $ANSWER)"
  506. loadkeys "$(cat $ANSWER)"
  507. KEYBOARD_DONE=1
  508. break
  509. else
  510. return
  511. fi
  512. done
  513. }
  514. set_keymap() {
  515. local KEYMAP=$(get_option KEYMAP)
  516. if [ -f /etc/vconsole.conf ]; then
  517. sed -i -e "s|KEYMAP=.*|KEYMAP=$KEYMAP|g" $TARGETDIR/etc/vconsole.conf
  518. else
  519. sed -i -e "s|#\?KEYMAP=.*|KEYMAP=$KEYMAP|g" $TARGETDIR/etc/rc.conf
  520. fi
  521. }
  522. menu_locale() {
  523. local _locales="$(grep -E '\.UTF-8' /etc/default/libc-locales|awk '{print $1}'|sed -e 's/^#//')"
  524. local LOCALES ISO639 ISO3166
  525. local TMPFILE=$(mktemp -t vinstall-XXXXXXXX || exit 1)
  526. INFOBOX "Scanning locales ..." 4 60
  527. for f in ${_locales}; do
  528. eval $(echo $f | awk 'BEGIN { FS="." } \
  529. { FS="_"; split($1, a); printf "ISO639=%s ISO3166=%s\n", a[1], a[2] }')
  530. echo "$f|$(iso639_language $ISO639) ($(iso3166_country $ISO3166))|" >> $TMPFILE
  531. done
  532. clear
  533. # Sort by ISO-639 language names
  534. LOCALES=$(sort -t '|' -k 2 < $TMPFILE | xargs | sed -e's/| /|/g')
  535. rm -f $TMPFILE
  536. while true; do
  537. (IFS="|"; DIALOG --title " Select your locale " --menu "$MENULABEL" 18 70 18 ${LOCALES})
  538. if [ $? -eq 0 ]; then
  539. set_option LOCALE "$(cat $ANSWER)"
  540. LOCALE_DONE=1
  541. break
  542. else
  543. return
  544. fi
  545. done
  546. }
  547. set_locale() {
  548. if [ -f $TARGETDIR/etc/default/libc-locales ]; then
  549. local LOCALE="$(get_option LOCALE)"
  550. : "${LOCALE:=C.UTF-8}"
  551. sed -i -e "s|LANG=.*|LANG=$LOCALE|g" $TARGETDIR/etc/locale.conf
  552. # Uncomment locale from /etc/default/libc-locales and regenerate it.
  553. sed -e "/${LOCALE}/s/^\#//" -i $TARGETDIR/etc/default/libc-locales
  554. echo "Running xbps-reconfigure -f glibc-locales ..." >$LOG
  555. chroot $TARGETDIR xbps-reconfigure -f glibc-locales >$LOG 2>&1
  556. fi
  557. }
  558. menu_timezone() {
  559. local areas=(Africa America Antarctica Arctic Asia Atlantic Australia Europe Indian Pacific)
  560. local area locations location
  561. while (IFS='|'; DIALOG ${area:+--default-item|"$area"} --title " Select area " --menu "$MENULABEL" 19 51 19 $(printf '%s||' "${areas[@]}")); do
  562. area=$(cat $ANSWER)
  563. read -a locations -d '\n' < <(find /usr/share/zoneinfo/$area -type f -printf '%P\n' | sort)
  564. if (IFS='|'; DIALOG --title " Select location (${area}) " --menu "$MENULABEL" 19 51 19 $(printf '%s||' "${locations[@]//_/ }")); then
  565. location=$(tr ' ' '_' < $ANSWER)
  566. set_option TIMEZONE "$area/$location"
  567. TIMEZONE_DONE=1
  568. return 0
  569. else
  570. continue
  571. fi
  572. done
  573. return 1
  574. }
  575. set_timezone() {
  576. local TIMEZONE="$(get_option TIMEZONE)"
  577. ln -sf "/usr/share/zoneinfo/${TIMEZONE}" "${TARGETDIR}/etc/localtime"
  578. }
  579. menu_hostname() {
  580. while true; do
  581. DIALOG --inputbox "Set the machine hostname:" ${INPUTSIZE}
  582. if [ $? -eq 0 ]; then
  583. set_option HOSTNAME "$(cat $ANSWER)"
  584. HOSTNAME_DONE=1
  585. break
  586. else
  587. return
  588. fi
  589. done
  590. }
  591. set_hostname() {
  592. local hostname="$(get_option HOSTNAME)"
  593. echo "${hostname:-void}" > $TARGETDIR/etc/hostname
  594. }
  595. menu_rootpassword() {
  596. local _firstpass _secondpass _again _desc
  597. while true; do
  598. if [ -z "${_firstpass}" ]; then
  599. _desc="Enter the root password"
  600. else
  601. _again=" again"
  602. fi
  603. DIALOG --insecure --passwordbox "${_desc}${_again}" ${INPUTSIZE}
  604. if [ $? -eq 0 ]; then
  605. if [ -z "${_firstpass}" ]; then
  606. _firstpass="$(cat $ANSWER)"
  607. else
  608. _secondpass="$(cat $ANSWER)"
  609. fi
  610. if [ -n "${_firstpass}" -a -n "${_secondpass}" ]; then
  611. if [ "${_firstpass}" != "${_secondpass}" ]; then
  612. INFOBOX "Passwords do not match! Please enter again." 6 60
  613. unset _firstpass _secondpass _again
  614. sleep 2 && clear && continue
  615. fi
  616. set_option ROOTPASSWORD "${_firstpass}"
  617. ROOTPASSWORD_DONE=1
  618. break
  619. fi
  620. else
  621. return
  622. fi
  623. done
  624. }
  625. set_rootpassword() {
  626. echo "root:$(get_option ROOTPASSWORD)" | chroot $TARGETDIR chpasswd -c SHA512
  627. }
  628. menu_useraccount() {
  629. local _firstpass _secondpass _desc _again
  630. local _groups _status _group _checklist
  631. local _preset _userlogin
  632. while true; do
  633. _preset=$(get_option USERLOGIN)
  634. [ -z "$_preset" ] && _preset="void"
  635. DIALOG --inputbox "Enter a primary login name:" ${INPUTSIZE} "$_preset"
  636. if [ $? -eq 0 ]; then
  637. _userlogin="$(cat $ANSWER)"
  638. # based on useradd(8) § Caveats
  639. if [ "${#_userlogin}" -le 32 ] && [[ "${_userlogin}" =~ ^[a-z_][a-z0-9_-]*[$]?$ ]]; then
  640. set_option USERLOGIN "${_userlogin}"
  641. USERLOGIN_DONE=1
  642. break
  643. else
  644. INFOBOX "Invalid login name! Please try again." 6 60
  645. unset _userlogin
  646. sleep 2 && clear && continue
  647. fi
  648. else
  649. return
  650. fi
  651. done
  652. while true; do
  653. _preset=$(get_option USERNAME)
  654. [ -z "$_preset" ] && _preset="Void User"
  655. DIALOG --inputbox "Enter a display name for login '$(get_option USERLOGIN)' :" \
  656. ${INPUTSIZE} "$_preset"
  657. if [ $? -eq 0 ]; then
  658. set_option USERNAME "$(cat $ANSWER)"
  659. USERNAME_DONE=1
  660. break
  661. else
  662. return
  663. fi
  664. done
  665. while true; do
  666. if [ -z "${_firstpass}" ]; then
  667. _desc="Enter the password for login '$(get_option USERLOGIN)'"
  668. else
  669. _again=" again"
  670. fi
  671. DIALOG --insecure --passwordbox "${_desc}${_again}" ${INPUTSIZE}
  672. if [ $? -eq 0 ]; then
  673. if [ -z "${_firstpass}" ]; then
  674. _firstpass="$(cat $ANSWER)"
  675. else
  676. _secondpass="$(cat $ANSWER)"
  677. fi
  678. if [ -n "${_firstpass}" -a -n "${_secondpass}" ]; then
  679. if [ "${_firstpass}" != "${_secondpass}" ]; then
  680. INFOBOX "Passwords do not match! Please enter again." 6 60
  681. unset _firstpass _secondpass _again
  682. sleep 2 && clear && continue
  683. fi
  684. set_option USERPASSWORD "${_firstpass}"
  685. USERPASSWORD_DONE=1
  686. break
  687. fi
  688. else
  689. return
  690. fi
  691. done
  692. _groups="wheel,audio,video,floppy,cdrom,optical,kvm,xbuilder"
  693. while true; do
  694. _desc="Select group membership for login '$(get_option USERLOGIN)':"
  695. for _group in $(cat /etc/group); do
  696. _gid="$(echo ${_group} | cut -d: -f3)"
  697. _group="$(echo ${_group} | cut -d: -f1)"
  698. _status="$(echo ${_groups} | grep -w ${_group})"
  699. if [ -z "${_status}" ]; then
  700. _status=off
  701. else
  702. _status=on
  703. fi
  704. # ignore the groups of root, existing users, and package groups
  705. if [[ "${_gid}" -ge 1000 || "${_group}" = "_"* || "${_group}" = "root" ]]; then
  706. continue
  707. fi
  708. if [ -z "${_checklist}" ]; then
  709. _checklist="${_group} ${_group}:${_gid} ${_status}"
  710. else
  711. _checklist="${_checklist} ${_group} ${_group}:${_gid} ${_status}"
  712. fi
  713. done
  714. DIALOG --no-tags --checklist "${_desc}" 20 60 18 ${_checklist}
  715. if [ $? -eq 0 ]; then
  716. set_option USERGROUPS $(cat $ANSWER | sed -e's| |,|g')
  717. USERGROUPS_DONE=1
  718. break
  719. else
  720. return
  721. fi
  722. done
  723. }
  724. set_useraccount() {
  725. [ -z "$USERACCOUNT_DONE" ] && return
  726. chroot $TARGETDIR useradd -m -G "$(get_option USERGROUPS)" \
  727. -c "$(get_option USERNAME)" "$(get_option USERLOGIN)"
  728. echo "$(get_option USERLOGIN):$(get_option USERPASSWORD)" | \
  729. chroot $TARGETDIR chpasswd -c SHA512
  730. }
  731. menu_bootloader() {
  732. while true; do
  733. DIALOG --title " Select the disk to install the bootloader" \
  734. --menu "$MENULABEL" ${MENUSIZE} $(show_disks) none "Manage bootloader otherwise"
  735. if [ $? -eq 0 ]; then
  736. set_option BOOTLOADER "$(cat $ANSWER)"
  737. BOOTLOADER_DONE=1
  738. break
  739. else
  740. return
  741. fi
  742. done
  743. while true; do
  744. DIALOG --yesno "Use a graphical terminal for the boot loader?" ${YESNOSIZE}
  745. if [ $? -eq 0 ]; then
  746. set_option TEXTCONSOLE 0
  747. break
  748. elif [ $? -eq 1 ]; then
  749. set_option TEXTCONSOLE 1
  750. break
  751. else
  752. return
  753. fi
  754. done
  755. }
  756. set_bootloader() {
  757. local dev=$(get_option BOOTLOADER) grub_args=
  758. if [ "$dev" = "none" ]; then return; fi
  759. # Check if it's an EFI system via efivars module.
  760. if [ -n "$EFI_SYSTEM" ]; then
  761. grub_args="--target=$EFI_TARGET --efi-directory=/boot/efi --bootloader-id=void_grub --recheck"
  762. fi
  763. echo "Running grub-install $grub_args $dev..." >$LOG
  764. chroot $TARGETDIR grub-install $grub_args $dev >$LOG 2>&1
  765. if [ $? -ne 0 ]; then
  766. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  767. failed to install GRUB to $dev!\nCheck $LOG for errors." ${MSGBOXSIZE}
  768. DIE 1
  769. fi
  770. echo "Running grub-mkconfig on $TARGETDIR..." >$LOG
  771. chroot $TARGETDIR grub-mkconfig -o /boot/grub/grub.cfg >$LOG 2>&1
  772. if [ $? -ne 0 ]; then
  773. DIALOG --msgbox "${BOLD}${RED}ERROR${RESET}: \
  774. failed to run grub-mkconfig!\nCheck $LOG for errors." ${MSGBOXSIZE}
  775. DIE 1
  776. fi
  777. }
  778. test_network() {
  779. # Reset the global variable to ensure that network is accessible for this test.
  780. NETWORK_DONE=
  781. rm -f otime && \
  782. xbps-uhelper fetch https://repo-default.voidlinux.org/current/otime >$LOG 2>&1
  783. local status=$?
  784. rm -f otime
  785. if [ "$status" -eq 0 ]; then
  786. DIALOG --msgbox "Network is working properly!" ${MSGBOXSIZE}
  787. NETWORK_DONE=1
  788. return 1
  789. fi
  790. if [ "$1" = "nm" ]; then
  791. DIALOG --msgbox "Network Manager is enabled but network is inaccessible, please set it up externally with nmcli, nmtui, or the Network Manager tray applet." ${MSGBOXSIZE}
  792. else
  793. DIALOG --msgbox "Network is inaccessible, please set it up properly." ${MSGBOXSIZE}
  794. fi
  795. }
  796. configure_wifi() {
  797. local dev="$1" ssid enc pass _wpasupconf=/etc/wpa_supplicant/wpa_supplicant.conf
  798. DIALOG --form "Wireless configuration for ${dev}\n(encryption type: wep or wpa)" 0 0 0 \
  799. "SSID:" 1 1 "" 1 16 30 0 \
  800. "Encryption:" 2 1 "" 2 16 4 3 \
  801. "Password:" 3 1 "" 3 16 63 0 || return 1
  802. readarray -t values <<<$(cat $ANSWER)
  803. ssid="${values[0]}"; enc="${values[1]}"; pass="${values[2]}"
  804. if [ -z "$ssid" ]; then
  805. DIALOG --msgbox "Invalid SSID." ${MSGBOXSIZE}
  806. return 1
  807. elif [ -z "$enc" -o "$enc" != "wep" -a "$enc" != "wpa" ]; then
  808. DIALOG --msgbox "Invalid encryption type (possible values: wep or wpa)." ${MSGBOXSIZE}
  809. return 1
  810. elif [ -z "$pass" ]; then
  811. DIALOG --msgbox "Invalid AP password." ${MSGBOXSIZE}
  812. fi
  813. # reset the configuration to the default, if necessary
  814. # otherwise backup the configuration
  815. if [ -f ${_wpasupconf}.orig ]; then
  816. cp -f ${_wpasupconf}.orig ${_wpasupconf}
  817. else
  818. cp -f ${_wpasupconf} ${_wpasupconf}.orig
  819. fi
  820. if [ "$enc" = "wep" ]; then
  821. cat << EOF >> ${_wpasupconf}
  822. network={
  823. ssid="$ssid"
  824. wep_key0="$pass"
  825. wep_tx_keyidx=0
  826. auth_alg=SHARED
  827. }
  828. EOF
  829. else
  830. wpa_passphrase "$ssid" "$pass" >> ${_wpasupconf}
  831. fi
  832. sv restart wpa_supplicant
  833. configure_net_dhcp $dev
  834. return $?
  835. }
  836. configure_net() {
  837. local dev="$1" rval
  838. DIALOG --yesno "Do you want to use DHCP for $dev?" ${YESNOSIZE}
  839. rval=$?
  840. if [ $rval -eq 0 ]; then
  841. configure_net_dhcp $dev
  842. elif [ $rval -eq 1 ]; then
  843. configure_net_static $dev
  844. fi
  845. }
  846. iface_setup() {
  847. ip addr show dev $1 | grep -q -e 'inet ' -e 'inet6 '
  848. return $?
  849. }
  850. configure_net_dhcp() {
  851. local dev="$1"
  852. iface_setup $dev
  853. if [ $? -eq 1 ]; then
  854. sv restart dhcpcd 2>&1 | tee $LOG | \
  855. DIALOG --progressbox "Initializing $dev via DHCP..." ${WIDGET_SIZE}
  856. if [ $? -ne 0 ]; then
  857. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} failed to run dhcpcd. See $LOG for details." ${MSGBOXSIZE}
  858. return 1
  859. fi
  860. export -f iface_setup
  861. timeout 10s bash -c "while true; do iface_setup $dev; sleep 0.25; done"
  862. if [ $? -eq 1 ]; then
  863. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} DHCP request failed for $dev. Check $LOG for errors." ${MSGBOXSIZE}
  864. return 1
  865. fi
  866. fi
  867. test_network
  868. if [ $? -eq 1 ]; then
  869. set_option NETWORK "${dev} dhcp"
  870. fi
  871. }
  872. configure_net_static() {
  873. local ip gw dns1 dns2 dev=$1
  874. DIALOG --form "Static IP configuration for $dev:" 0 0 0 \
  875. "IP address:" 1 1 "192.168.0.2" 1 21 20 0 \
  876. "Gateway:" 2 1 "192.168.0.1" 2 21 20 0 \
  877. "DNS Primary" 3 1 "8.8.8.8" 3 21 20 0 \
  878. "DNS Secondary" 4 1 "8.8.4.4" 4 21 20 0 || return 1
  879. set -- $(cat $ANSWER)
  880. ip=$1; gw=$2; dns1=$3; dns2=$4
  881. echo "running: ip link set dev $dev up" >$LOG
  882. ip link set dev $dev up >$LOG 2>&1
  883. if [ $? -ne 0 ]; then
  884. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} Failed to bring $dev interface." ${MSGBOXSIZE}
  885. return 1
  886. fi
  887. echo "running: ip addr add $ip dev $dev" >$LOG
  888. ip addr add $ip dev $dev >$LOG 2>&1
  889. if [ $? -ne 0 ]; then
  890. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} Failed to set ip to the $dev interface." ${MSGBOXSIZE}
  891. return 1
  892. fi
  893. ip route add default via $gw >$LOG 2>&1
  894. if [ $? -ne 0 ]; then
  895. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} failed to setup your gateway." ${MSGBOXSIZE}
  896. return 1
  897. fi
  898. echo "nameserver $dns1" >/etc/resolv.conf
  899. echo "nameserver $dns2" >>/etc/resolv.conf
  900. test_network
  901. if [ $? -eq 1 ]; then
  902. set_option NETWORK "${dev} static $ip $gw $dns1 $dns2"
  903. fi
  904. }
  905. menu_network() {
  906. local dev addr f DEVICES
  907. if [ -e /var/service/NetworkManager ]; then
  908. test_network nm
  909. return
  910. fi
  911. for f in $(ls /sys/class/net); do
  912. [ "$f" = "lo" ] && continue
  913. addr=$(cat /sys/class/net/$f/address)
  914. DEVICES="$DEVICES $f $addr"
  915. done
  916. DIALOG --title " Select the network interface to configure " \
  917. --menu "$MENULABEL" ${MENUSIZE} ${DEVICES}
  918. if [ $? -eq 0 ]; then
  919. dev=$(cat $ANSWER)
  920. if $(echo $dev|egrep -q "^wl.*" 2>/dev/null); then
  921. configure_wifi $dev
  922. else
  923. configure_net $dev
  924. fi
  925. fi
  926. }
  927. validate_useraccount() {
  928. # don't check that USERNAME has been set because it can be empty
  929. local USERLOGIN=$(get_option USERLOGIN)
  930. local USERPASSWORD=$(get_option USERPASSWORD)
  931. local USERGROUPS=$(get_option USERGROUPS)
  932. if [ -n "$USERLOGIN" ] && [ -n "$USERPASSWORD" ] && [ -n "$USERGROUPS" ]; then
  933. USERACCOUNT_DONE=1
  934. fi
  935. }
  936. validate_filesystems() {
  937. local mnts dev size fstype mntpt mkfs rootfound fmt
  938. local usrfound efi_system_partition
  939. local bootdev=$(get_option BOOTLOADER)
  940. unset TARGETFS
  941. mnts=$(grep -E '^MOUNTPOINT.*' $CONF_FILE)
  942. set -- ${mnts}
  943. while [ $# -ne 0 ]; do
  944. fmt=""
  945. dev=$2; fstype=$3; size=$4; mntpt="$5"; mkfs=$6
  946. shift 6
  947. if [ "$mntpt" = "/" ]; then
  948. rootfound=1
  949. elif [ "$mntpt" = "/usr" ]; then
  950. usrfound=1
  951. elif [ "$fstype" = "vfat" -a "$mntpt" = "/boot/efi" ]; then
  952. efi_system_partition=1
  953. fi
  954. if [ "$mkfs" -eq 1 ]; then
  955. fmt="NEW FILESYSTEM: "
  956. fi
  957. if [ -z "$TARGETFS" ]; then
  958. TARGETFS="${fmt}$dev ($size) mounted on $mntpt as ${fstype}\n"
  959. else
  960. TARGETFS="${TARGETFS}${fmt}${dev} ($size) mounted on $mntpt as ${fstype}\n"
  961. fi
  962. done
  963. if [ -z "$rootfound" ]; then
  964. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  965. the mount point for the root filesystem (/) has not yet been configured." ${MSGBOXSIZE}
  966. return 1
  967. elif [ -n "$usrfound" ]; then
  968. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  969. /usr mount point has been configured but is not supported, please remove it to continue." ${MSGBOXSIZE}
  970. return 1
  971. elif [ -n "$EFI_SYSTEM" -a "$bootdev" != "none" -a -z "$efi_system_partition" ]; then
  972. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  973. The EFI System Partition has not yet been configured, please create it\n
  974. as FAT32, mountpoint /boot/efi and at least with 100MB of size." ${MSGBOXSIZE}
  975. return 1
  976. fi
  977. FILESYSTEMS_DONE=1
  978. }
  979. create_filesystems() {
  980. local mnts dev mntpt fstype fspassno mkfs size rv uuid
  981. mnts=$(grep -E '^MOUNTPOINT.*' $CONF_FILE | sort -k 5)
  982. set -- ${mnts}
  983. while [ $# -ne 0 ]; do
  984. dev=$2; fstype=$3; mntpt="$5"; mkfs=$6
  985. shift 6
  986. # swap partitions
  987. if [ "$fstype" = "swap" ]; then
  988. swapoff $dev >/dev/null 2>&1
  989. if [ "$mkfs" -eq 1 ]; then
  990. mkswap $dev >$LOG 2>&1
  991. if [ $? -ne 0 ]; then
  992. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  993. failed to create swap on ${dev}!\ncheck $LOG for errors." ${MSGBOXSIZE}
  994. DIE 1
  995. fi
  996. fi
  997. swapon $dev >$LOG 2>&1
  998. if [ $? -ne 0 ]; then
  999. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  1000. failed to activate swap on $dev!\ncheck $LOG for errors." ${MSGBOXSIZE}
  1001. DIE 1
  1002. fi
  1003. # Add entry for target fstab
  1004. uuid=$(blkid -o value -s UUID "$dev")
  1005. echo "UUID=$uuid none swap defaults 0 0" >>$TARGET_FSTAB
  1006. continue
  1007. fi
  1008. if [ "$mkfs" -eq 1 ]; then
  1009. case "$fstype" in
  1010. btrfs) MKFS="mkfs.btrfs -f"; modprobe btrfs >$LOG 2>&1;;
  1011. ext2) MKFS="mke2fs -F"; modprobe ext2 >$LOG 2>&1;;
  1012. ext3) MKFS="mke2fs -F -j"; modprobe ext3 >$LOG 2>&1;;
  1013. ext4) MKFS="mke2fs -F -t ext4"; modprobe ext4 >$LOG 2>&1;;
  1014. f2fs) MKFS="mkfs.f2fs -f"; modprobe f2fs >$LOG 2>&1;;
  1015. vfat) MKFS="mkfs.vfat -F32"; modprobe vfat >$LOG 2>&1;;
  1016. xfs) MKFS="mkfs.xfs -f -i sparse=0"; modprobe xfs >$LOG 2>&1;;
  1017. esac
  1018. TITLE="Check $LOG for details ..."
  1019. INFOBOX "Creating filesystem $fstype on $dev for $mntpt ..." 8 60
  1020. echo "Running $MKFS $dev..." >$LOG
  1021. $MKFS $dev >$LOG 2>&1; rv=$?
  1022. if [ $rv -ne 0 ]; then
  1023. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  1024. failed to create filesystem $fstype on $dev!\ncheck $LOG for errors." ${MSGBOXSIZE}
  1025. DIE 1
  1026. fi
  1027. fi
  1028. # Mount rootfs the first one.
  1029. [ "$mntpt" != "/" ] && continue
  1030. mkdir -p $TARGETDIR
  1031. echo "Mounting $dev on $mntpt ($fstype)..." >$LOG
  1032. mount -t $fstype $dev $TARGETDIR >$LOG 2>&1
  1033. if [ $? -ne 0 ]; then
  1034. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  1035. failed to mount $dev on ${mntpt}! check $LOG for errors." ${MSGBOXSIZE}
  1036. DIE 1
  1037. fi
  1038. # Add entry to target fstab
  1039. uuid=$(blkid -o value -s UUID "$dev")
  1040. if [ "$fstype" = "f2fs" -o "$fstype" = "btrfs" -o "$fstype" = "xfs" ]; then
  1041. fspassno=0
  1042. else
  1043. fspassno=1
  1044. fi
  1045. echo "UUID=$uuid $mntpt $fstype defaults 0 $fspassno" >>$TARGET_FSTAB
  1046. done
  1047. # mount all filesystems in target rootfs
  1048. mnts=$(grep -E '^MOUNTPOINT.*' $CONF_FILE | sort -k 5)
  1049. set -- ${mnts}
  1050. while [ $# -ne 0 ]; do
  1051. dev=$2; fstype=$3; mntpt="$5"
  1052. shift 6
  1053. [ "$mntpt" = "/" -o "$fstype" = "swap" ] && continue
  1054. mkdir -p ${TARGETDIR}${mntpt}
  1055. echo "Mounting $dev on $mntpt ($fstype)..." >$LOG
  1056. mount -t $fstype $dev ${TARGETDIR}${mntpt} >$LOG 2>&1
  1057. if [ $? -ne 0 ]; then
  1058. DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \
  1059. failed to mount $dev on $mntpt! check $LOG for errors." ${MSGBOXSIZE}
  1060. DIE
  1061. fi
  1062. # Add entry to target fstab
  1063. uuid=$(blkid -o value -s UUID "$dev")
  1064. if [ "$fstype" = "f2fs" -o "$fstype" = "btrfs" -o "$fstype" = "xfs" ]; then
  1065. fspassno=0
  1066. else
  1067. fspassno=2
  1068. fi
  1069. echo "UUID=$uuid $mntpt $fstype defaults 0 $fspassno" >>$TARGET_FSTAB
  1070. done
  1071. }
  1072. mount_filesystems() {
  1073. for f in sys proc dev; do
  1074. [ ! -d $TARGETDIR/$f ] && mkdir $TARGETDIR/$f
  1075. echo "Mounting $TARGETDIR/$f..." >$LOG
  1076. mount --rbind /$f $TARGETDIR/$f >$LOG 2>&1
  1077. done
  1078. }
  1079. umount_filesystems() {
  1080. local mnts="$(grep -E '^MOUNTPOINT.*swap.*$' $CONF_FILE | sort -r -k 5)"
  1081. set -- ${mnts}
  1082. while [ $# -ne 0 ]; do
  1083. local dev=$2; local fstype=$3
  1084. shift 6
  1085. if [ "$fstype" = "swap" ]; then
  1086. echo "Disabling swap space on $dev..." >$LOG
  1087. swapoff $dev >$LOG 2>&1
  1088. continue
  1089. fi
  1090. done
  1091. echo "Unmounting $TARGETDIR..." >$LOG
  1092. umount -R $TARGETDIR >$LOG 2>&1
  1093. }
  1094. log_and_count() {
  1095. local progress whole tenth
  1096. while read line; do
  1097. echo "$line" >$LOG
  1098. copy_count=$((copy_count + 1))
  1099. progress=$((1000 * copy_count / copy_total))
  1100. if [ "$progress" != "$copy_progress" ]; then
  1101. whole=$((progress / 10))
  1102. tenth=$((progress % 10))
  1103. printf "Progress: %d.%d%% (%d of %d files)\n" $whole $tenth $copy_count $copy_total
  1104. copy_progress=$progress
  1105. fi
  1106. done
  1107. }
  1108. copy_rootfs() {
  1109. local tar_in="--create --one-file-system --xattrs"
  1110. TITLE="Check $LOG for details ..."
  1111. INFOBOX "Counting files, please be patient ..." 4 60
  1112. copy_total=$(tar ${tar_in} -v -f /dev/null / 2>/dev/null | wc -l)
  1113. export copy_total copy_count=0 copy_progress=
  1114. clear
  1115. tar ${tar_in} -f - / 2>/dev/null | \
  1116. tar --extract --xattrs --xattrs-include='*' --preserve-permissions -v -f - -C $TARGETDIR | \
  1117. log_and_count | \
  1118. DIALOG --title "${TITLE}" \
  1119. --progressbox "Copying live image to target rootfs." 5 60
  1120. if [ $? -ne 0 ]; then
  1121. DIE 1
  1122. fi
  1123. unset copy_total copy_count copy_percent
  1124. }
  1125. install_packages() {
  1126. local _grub= _syspkg=
  1127. if [ -n "$EFI_SYSTEM" ]; then
  1128. if [ $EFI_FW_BITS -eq 32 ]; then
  1129. _grub="grub-i386-efi"
  1130. else
  1131. _grub="grub-x86_64-efi"
  1132. fi
  1133. else
  1134. _grub="grub"
  1135. fi
  1136. _syspkg="base-system"
  1137. mkdir -p $TARGETDIR/var/db/xbps/keys $TARGETDIR/usr/share
  1138. cp -a /usr/share/xbps.d $TARGETDIR/usr/share/
  1139. cp /var/db/xbps/keys/*.plist $TARGETDIR/var/db/xbps/keys
  1140. if [ -n "$MIRROR_DONE" ]; then
  1141. mkdir -p $TARGETDIR/etc
  1142. cp -a /etc/xbps.d $TARGETDIR/etc
  1143. fi
  1144. mkdir -p $TARGETDIR/boot/grub
  1145. _arch=$(xbps-uhelper arch)
  1146. stdbuf -oL env XBPS_ARCH=${_arch} \
  1147. xbps-install -r $TARGETDIR -SyU ${_syspkg} ${_grub} 2>&1 | \
  1148. DIALOG --title "Installing base system packages..." \
  1149. --programbox 24 80
  1150. if [ $? -ne 0 ]; then
  1151. DIE 1
  1152. fi
  1153. xbps-reconfigure -r $TARGETDIR -f base-files >/dev/null 2>&1
  1154. chroot $TARGETDIR xbps-reconfigure -a
  1155. }
  1156. enable_service() {
  1157. ln -sf /etc/sv/$1 $TARGETDIR/etc/runit/runsvdir/default/$1
  1158. }
  1159. menu_install() {
  1160. ROOTPASSWORD_DONE="$(get_option ROOTPASSWORD)"
  1161. BOOTLOADER_DONE="$(get_option BOOTLOADER)"
  1162. if [ -z "$ROOTPASSWORD_DONE" ]; then
  1163. DIALOG --msgbox "${BOLD}The root password has not been configured, \
  1164. please do so before starting the installation.${RESET}" ${MSGBOXSIZE}
  1165. return 1
  1166. elif [ -z "$BOOTLOADER_DONE" ]; then
  1167. DIALOG --msgbox "${BOLD}The disk to install the bootloader has not been \
  1168. configured, please do so before starting the installation.${RESET}" ${MSGBOXSIZE}
  1169. return 1
  1170. fi
  1171. # Validate filesystems after making sure bootloader is done,
  1172. # so that specific checks can be made based on the selection
  1173. validate_filesystems || return 1
  1174. if [ -z "$FILESYSTEMS_DONE" ]; then
  1175. DIALOG --msgbox "${BOLD}Required filesystems were not configured, \
  1176. please do so before starting the installation.${RESET}" ${MSGBOXSIZE}
  1177. return 1
  1178. fi
  1179. # Validate useraccount. All parameters must be set (name, password, login name, groups).
  1180. validate_useraccount
  1181. if [ -z "$USERACCOUNT_DONE" ]; then
  1182. DIALOG --yesno "${BOLD}The user account is not set up properly.${RESET}\n\n
  1183. ${BOLD}${RED}WARNING: no user will be created. You will only be able to login \
  1184. with the root user in your new system.${RESET}\n\n
  1185. ${BOLD}Do you want to continue?${RESET}" 10 60 || return
  1186. fi
  1187. DIALOG --yesno "${BOLD}The following operations will be executed:${RESET}\n\n
  1188. ${BOLD}${TARGETFS}${RESET}\n
  1189. ${BOLD}${RED}WARNING: data on partitions will be COMPLETELY DESTROYED for new \
  1190. filesystems.${RESET}\n\n
  1191. ${BOLD}Do you want to continue?${RESET}" 20 80 || return
  1192. unset TARGETFS
  1193. # Create and mount filesystems
  1194. create_filesystems
  1195. # If source not set use defaults.
  1196. if [ "$(get_option SOURCE)" = "local" -o -z "$SOURCE_DONE" ]; then
  1197. copy_rootfs
  1198. . /etc/default/live.conf
  1199. rm -f $TARGETDIR/etc/motd
  1200. rm -f $TARGETDIR/etc/issue
  1201. rm -f $TARGETDIR/usr/sbin/void-installer
  1202. # Remove modified sddm.conf to let sddm use the defaults.
  1203. rm -f $TARGETDIR/etc/sddm.conf
  1204. # Remove live user.
  1205. echo "Removing $USERNAME live user from targetdir ..." >$LOG
  1206. chroot $TARGETDIR userdel -r $USERNAME >$LOG 2>&1
  1207. rm -f $TARGETDIR/etc/sudoers.d/99-void-live
  1208. sed -i "s,GETTY_ARGS=\"--noclear -a $USERNAME\",GETTY_ARGS=\"--noclear\",g" $TARGETDIR/etc/sv/agetty-tty1/conf
  1209. TITLE="Check $LOG for details ..."
  1210. INFOBOX "Rebuilding initramfs for target ..." 4 60
  1211. echo "Rebuilding initramfs for target ..." >$LOG
  1212. # mount required fs
  1213. mount_filesystems
  1214. chroot $TARGETDIR dracut --no-hostonly --add-drivers "ahci" --force >>$LOG 2>&1
  1215. INFOBOX "Removing temporary packages from target ..." 4 60
  1216. echo "Removing temporary packages from target ..." >$LOG
  1217. xbps-remove -r $TARGETDIR -Ry dialog xtools-minimal xmirror >>$LOG 2>&1
  1218. rmdir $TARGETDIR/mnt/target
  1219. else
  1220. # mount required fs
  1221. mount_filesystems
  1222. # network install, use packages.
  1223. install_packages
  1224. fi
  1225. INFOBOX "Applying installer settings..." 4 60
  1226. # copy target fstab.
  1227. install -Dm644 $TARGET_FSTAB $TARGETDIR/etc/fstab
  1228. # Mount /tmp as tmpfs.
  1229. echo "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0" >> $TARGETDIR/etc/fstab
  1230. # set up keymap, locale, timezone, hostname, root passwd and user account.
  1231. set_keymap
  1232. set_locale
  1233. set_timezone
  1234. set_hostname
  1235. set_rootpassword
  1236. set_useraccount
  1237. # Copy /etc/skel files for root.
  1238. cp $TARGETDIR/etc/skel/.[bix]* $TARGETDIR/root
  1239. NETWORK_DONE="$(get_option NETWORK)"
  1240. # network settings for target
  1241. if [ -n "$NETWORK_DONE" ]; then
  1242. local net="$(get_option NETWORK)"
  1243. set -- ${net}
  1244. local _dev="$1" _type="$2" _ip="$3" _gw="$4" _dns1="$5" _dns2="$6"
  1245. if [ -z "$_type" ]; then
  1246. # network type empty??!!!
  1247. :
  1248. elif [ "$_type" = "dhcp" ]; then
  1249. if $(echo $_dev|egrep -q "^wl.*" 2>/dev/null); then
  1250. cp /etc/wpa_supplicant/wpa_supplicant.conf $TARGETDIR/etc/wpa_supplicant
  1251. ln -sf /etc/sv/wpa_supplicant $TARGETDIR/etc/runit/runsvdir/default/wpa_supplicant
  1252. fi
  1253. enable_service dhcpcd
  1254. elif [ -n "$_dev" -a "$_type" = "static" ]; then
  1255. # static IP through dhcpcd.
  1256. mv $TARGETDIR/etc/dhcpcd.conf $TARGETDIR/etc/dhcpcd.conf.orig
  1257. echo "# Static IP configuration set by the void-installer for $_dev." \
  1258. >$TARGETDIR/etc/dhcpcd.conf
  1259. echo "interface $_dev" >>$TARGETDIR/etc/dhcpcd.conf
  1260. echo "static ip_address=$_ip" >>$TARGETDIR/etc/dhcpcd.conf
  1261. echo "static routers=$_gw" >>$TARGETDIR/etc/dhcpcd.conf
  1262. echo "static domain_name_servers=$_dns1 $_dns2" >>$TARGETDIR/etc/dhcpcd.conf
  1263. enable_service dhcpcd
  1264. fi
  1265. fi
  1266. if [ -d $TARGETDIR/etc/sudoers.d ]; then
  1267. USERLOGIN="$(get_option USERLOGIN)"
  1268. if [ -z "$(echo $(get_option USERGROUPS) | grep -w wheel)" -a -n "$USERLOGIN" ]; then
  1269. # enable sudo for primary user USERLOGIN who is not member of wheel
  1270. echo "# Enable sudo for login '$USERLOGIN'" > "$TARGETDIR/etc/sudoers.d/$USERLOGIN"
  1271. echo "$USERLOGIN ALL=(ALL:ALL) ALL" >> "$TARGETDIR/etc/sudoers.d/$USERLOGIN"
  1272. else
  1273. # enable the sudoers entry for members of group wheel
  1274. echo "%wheel ALL=(ALL:ALL) ALL" > "$TARGETDIR/etc/sudoers.d/wheel"
  1275. fi
  1276. unset USERLOGIN
  1277. fi
  1278. # clean up polkit rule - it's only useful in live systems
  1279. rm -f $TARGETDIR/etc/polkit-1/rules.d/void-live.rules
  1280. # enable text console for grub if chosen
  1281. if [ "$(get_option TEXTCONSOLE)" = "1" ]; then
  1282. sed -i $TARGETDIR/etc/default/grub \
  1283. -e 's|#\(GRUB_TERMINAL_INPUT\).*|\1=console|' \
  1284. -e 's|#\(GRUB_TERMINAL_OUTPUT\).*|\1=console|'
  1285. fi
  1286. # install bootloader.
  1287. set_bootloader
  1288. sync && sync && sync
  1289. # unmount all filesystems.
  1290. umount_filesystems
  1291. # installed successfully.
  1292. DIALOG --yesno "${BOLD}Void Linux has been installed successfully!${RESET}\n
  1293. Do you want to reboot the system?" ${YESNOSIZE}
  1294. if [ $? -eq 0 ]; then
  1295. shutdown -r now
  1296. else
  1297. return
  1298. fi
  1299. }
  1300. menu_source() {
  1301. local src=
  1302. DIALOG --title " Select installation source " \
  1303. --menu "$MENULABEL" 8 70 0 \
  1304. "Local" "Packages from ISO image" \
  1305. "Network" "Base system only, downloaded from official repository"
  1306. case "$(cat $ANSWER)" in
  1307. "Local") src="local";;
  1308. "Network") src="net";
  1309. if [ -z "$NETWORK_DONE" ]; then
  1310. if test_network; then
  1311. menu_network
  1312. fi
  1313. fi;;
  1314. *) return 1;;
  1315. esac
  1316. SOURCE_DONE=1
  1317. set_option SOURCE $src
  1318. }
  1319. menu_mirror() {
  1320. xmirror 2>$LOG && MIRROR_DONE=1
  1321. }
  1322. menu() {
  1323. local AFTER_HOSTNAME
  1324. if [ -z "$DEFITEM" ]; then
  1325. DEFITEM="Keyboard"
  1326. fi
  1327. if xbps-uhelper arch | grep -qe '-musl$'; then
  1328. AFTER_HOSTNAME="Timezone"
  1329. DIALOG --default-item $DEFITEM \
  1330. --extra-button --extra-label "Settings" \
  1331. --title " Void Linux installation menu " \
  1332. --menu "$MENULABEL" 10 70 0 \
  1333. "Keyboard" "Set system keyboard" \
  1334. "Network" "Set up the network" \
  1335. "Source" "Set source installation" \
  1336. "Mirror" "Select XBPS mirror" \
  1337. "Hostname" "Set system hostname" \
  1338. "Timezone" "Set system time zone" \
  1339. "RootPassword" "Set system root password" \
  1340. "UserAccount" "Set primary user name and password" \
  1341. "BootLoader" "Set disk to install bootloader" \
  1342. "Partition" "Partition disk(s)" \
  1343. "Filesystems" "Configure filesystems and mount points" \
  1344. "Install" "Start installation with saved settings" \
  1345. "Exit" "Exit installation"
  1346. else
  1347. AFTER_HOSTNAME="Locale"
  1348. DIALOG --default-item $DEFITEM \
  1349. --extra-button --extra-label "Settings" \
  1350. --title " Void Linux installation menu " \
  1351. --menu "$MENULABEL" 10 70 0 \
  1352. "Keyboard" "Set system keyboard" \
  1353. "Network" "Set up the network" \
  1354. "Source" "Set source installation" \
  1355. "Mirror" "Select XBPS mirror" \
  1356. "Hostname" "Set system hostname" \
  1357. "Locale" "Set system locale" \
  1358. "Timezone" "Set system time zone" \
  1359. "RootPassword" "Set system root password" \
  1360. "UserAccount" "Set primary user name and password" \
  1361. "BootLoader" "Set disk to install bootloader" \
  1362. "Partition" "Partition disk(s)" \
  1363. "Filesystems" "Configure filesystems and mount points" \
  1364. "Install" "Start installation with saved settings" \
  1365. "Exit" "Exit installation"
  1366. fi
  1367. if [ $? -eq 3 ]; then
  1368. # Show settings
  1369. cp $CONF_FILE /tmp/conf_hidden.$$;
  1370. sed -i "s/^ROOTPASSWORD.*/ROOTPASSWORD <-hidden->/" /tmp/conf_hidden.$$
  1371. sed -i "s/^USERPASSWORD.*/USERPASSWORD <-hidden->/" /tmp/conf_hidden.$$
  1372. DIALOG --title "Saved settings for installation" --textbox /tmp/conf_hidden.$$ 14 60
  1373. rm /tmp/conf_hidden.$$
  1374. return
  1375. fi
  1376. case $(cat $ANSWER) in
  1377. "Keyboard") menu_keymap && [ -n "$KEYBOARD_DONE" ] && DEFITEM="Network";;
  1378. "Network") menu_network && [ -n "$NETWORK_DONE" ] && DEFITEM="Source";;
  1379. "Source") menu_source && [ -n "$SOURCE_DONE" ] && DEFITEM="Mirror";;
  1380. "Mirror") menu_mirror && [ -n "$MIRROR_DONE" ] && DEFITEM="Hostname";;
  1381. "Hostname") menu_hostname && [ -n "$HOSTNAME_DONE" ] && DEFITEM="$AFTER_HOSTNAME";;
  1382. "Locale") menu_locale && [ -n "$LOCALE_DONE" ] && DEFITEM="Timezone";;
  1383. "Timezone") menu_timezone && [ -n "$TIMEZONE_DONE" ] && DEFITEM="RootPassword";;
  1384. "RootPassword") menu_rootpassword && [ -n "$ROOTPASSWORD_DONE" ] && DEFITEM="UserAccount";;
  1385. "UserAccount") menu_useraccount && [ -n "$USERLOGIN_DONE" ] && [ -n "$USERPASSWORD_DONE" ] \
  1386. && DEFITEM="BootLoader";;
  1387. "BootLoader") menu_bootloader && [ -n "$BOOTLOADER_DONE" ] && DEFITEM="Partition";;
  1388. "Partition") menu_partitions && [ -n "$PARTITIONS_DONE" ] && DEFITEM="Filesystems";;
  1389. "Filesystems") menu_filesystems && [ -n "$FILESYSTEMS_DONE" ] && DEFITEM="Install";;
  1390. "Install") menu_install;;
  1391. "Exit") DIE;;
  1392. *) DIALOG --yesno "Abort Installation?" ${YESNOSIZE} && DIE
  1393. esac
  1394. }
  1395. if ! command -v dialog >/dev/null; then
  1396. echo "ERROR: missing dialog command, exiting..."
  1397. exit 1
  1398. fi
  1399. if [ "$(id -u)" != "0" ]; then
  1400. echo "void-installer must run as root" 1>&2
  1401. exit 1
  1402. fi
  1403. #
  1404. # main()
  1405. #
  1406. DIALOG --title "${BOLD}${RED} Enter the void ... ${RESET}" --msgbox "\n
  1407. Welcome to the Void Linux installation. A simple and minimal \
  1408. Linux distribution made from scratch and built from the source package tree \
  1409. available for XBPS, a new alternative binary package system.\n\n
  1410. The installation should be pretty straightforward. If you are in trouble \
  1411. please join us at ${BOLD}#voidlinux${RESET} on ${BOLD}irc.libera.chat${RESET}.\n\n
  1412. ${BOLD}https://www.voidlinux.org${RESET}\n\n" 16 80
  1413. while true; do
  1414. menu
  1415. done
  1416. exit 0
  1417. # vim: set ts=4 sw=4 et: