# Some ideas and code reworked from other resources
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
-VER="2.0.1" # version
+VER="2.0.6" # version
DIST="ArchLabs" # distributor
MNT="/mnt" # mountpoint
ROOT_PART="" # root partition
BOOT_PART="" # boot partition
-BOOT_DEVICE="" # device used for BIOS grub install
+BOOT_DEV="" # device used for BIOS grub install
BOOTLDR="" # bootloader selected
EXMNT="" # holder for additional partitions while mounting
EXMNTS="" # when an extra partition is mounted append it's info
LOGIN_WM="" # default login session
LOGIN_TYPE="" # login manager can be lightdm or xinit
INSTALL_WMS="" # space separated list of chosen wm/de
-KERNEL="linux" # can be linux, linux-lts, linux-zen, or linux-hardened
+KERNEL="" # can be linux, linux-lts, linux-zen, or linux-hardened
MYSHELL="" # login shell for root and the primary user
LOGINRC="" # login shell rc file
PACKAGES="" # list of all packages to install including WM_PKGS
(( SEL < 11 )) && (( SEL++ ))
tput civis
SEL=$(dialog --cr-wrap --stdout --backtitle "$BT" \
- --title " $_PrepTitle " --default-item $SEL \
+ --title " Prepare " --default-item $SEL \
--cancel-label 'Exit' --menu "$_PrepBody" 0 0 0 \
- "1" "$_PrepShowDev" \
- "2" "$_PrepParts" \
+ "1" "$_PrepShow" \
+ "2" "$_PrepPart" \
"3" "$_PrepLUKS" \
"4" "$_PrepLVM" \
- "5" "$_PrepMount" \
+ "5" "$_PrepMnt" \
"6" "$_PrepUser" \
- "7" "$_PrepConfig" \
+ "7" "$_PrepConf" \
"8" "$_PrepWM" \
"9" "$_PrepPkg" \
- "10" "$_PrepShow" \
- "11" "$_PrepInstall")
+ "10" "$_PrepChk" \
+ "11" "$_Install")
- [[ $WARN != true && $SEL =~ (2|5) ]] && { WARN=true; msgbox "$_PrepTitle" "$_WarnMount"; }
+ [[ $WARN != true && $SEL =~ (2|5) ]] && { WARN=true; msgbox "Prepare" "$_WarnMount"; }
case $SEL in
- 1) device_tree ;;
+ 1) dev_tree ;;
2) part_menu || (( SEL-- )) ;;
3) luks_menu || (( SEL-- )) ;;
4) lvm_menu || (( SEL-- )) ;;
5) mount_menu || (( SEL-- )) ;;
- 6) prechecks 0 && { mkuser || (( SEL-- )); } ;;
- 7) prechecks 1 && { cfg_menu || (( SEL-- )); } ;;
+ 6) prechecks 0 && { select_mkuser || (( SEL-- )); } ;;
+ 7) prechecks 1 && { select_config || (( SEL-- )); } ;;
8) prechecks 2 && { select_sessions || (( SEL-- )); } ;;
9) prechecks 2 && { select_packages || (( SEL-- )); } ;;
10) prechecks 2 && show_cfg ;;
- 11) prechecks 2 && install ;;
- *) yesno "$_CloseInst" "$_CloseInstBody" && die
+ 11) prechecks 2 && install_main ;;
+ *) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die
esac
}
###############################################################################
-# dialog menus
+# selection menus
show_cfg()
{
pkgs="${pkgs# }"
pkgs="${pkgs% }"
pkgs="${pkgs// / }"
- msgbox "$_PrepTitle" "
+ msgbox "Show Configuration" "
---------- PARTITION CONFIGURATION ------------
Root: ${ROOT_PART:-none}
- Boot: ${BOOT_PART:-${BOOT_DEVICE:-none}}
+ Boot: ${BOOT_PART:-${BOOT_DEV:-none}}
Swap: ${SWAP_PART:-none}
Size: ${SWAP_SIZE:-none}
"
}
-cfg_menu()
+select_login()
+{
+ LOGIN_TYPE="$(menubox "Login Management" "\nSelect which login management to use." \
+ "xinit" "Console login without a display manager" \
+ "lightdm" "Lightweight display manager with a gtk greeter")"
+
+ if [[ $LOGIN_TYPE == "" ]]; then
+ return 1
+ elif [[ $LOGIN_TYPE == 'lightdm' ]]; then
+ WM_PKGS+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
+ EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
+ AUTOLOGIN=false
+ else
+ if [[ $WM_NUM -eq 1 ]]; then
+ LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
+ else
+ LOGIN_WM="$(menubox "Login Management" "$_WMLoginBody" $LOGIN_CHOICES)" || return 1
+ LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}"
+ fi
+
+ local msg="\nDo you want autologin enabled for $NEWUSER?\n\nPicking yes will create the following files:\n\n - /home/$NEWUSER/$LOGINRC (run startx when logging in on tty1)\n - /etc/systemd/system/getty@tty1.service.d/autologin.conf (login $NEWUSER without password)\n\nTo disable autologin remove these files.\n"
+
+ yesno "Autologin" "$msg" && AUTOLOGIN=true || AUTOLOGIN=false
+
+ PACKAGES="${PACKAGES// lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice/}"
+ WM_PKGS="${WM_PKGS// lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice/}"
+ WM_PKGS+=" xorg-xinit"
+ EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
+ fi
+}
+
+select_config()
{
tput civis
- MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"
+ MYSHELL="$(menubox "Shell" "\nChoose a shell for the new user and root." \
+ '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"
+
case $MYSHELL in
"/bin/bash") LOGINRC=".bash_profile" ;;
"/usr/bin/mksh") LOGINRC=".profile" ;;
"/usr/bin/zsh") LOGINRC=".zprofile" ;;
*) return 1 ;;
esac
+
tput cnorm
- HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"
+ HOSTNAME="$(getinput "Hostname" "$_HostNameBody" "${DIST,,}")"
[[ $HOSTNAME ]] || return 1
tput civis
- LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_ConfLocale " --menu "$_LocaleBody" 0 0 $SHL $LOCALES)"
+ LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " Locale " --menu "$_LocaleBody" 0 0 $SHL $LOCALES)"
[[ $LOCALE ]] || return 1
select_timezone || return 1
- KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" \
+ KERNEL="$(menubox "Kernel" "\nSelect a kernel to use for the install." \
'linux' 'Vanilla Linux kernel and modules, with a few patches applied.' \
'linux-lts' 'Long-term support (LTS) Linux kernel and modules.' \
'linux-zen' 'A collaborative effort of kernel hackers to provide the best Linux kernel for everyday systems' \
return 0
}
-mkuser()
+select_mkuser()
{
- local values="" user="" pass="" pass2="" rpass="" rpass2="" err=0
+ local v="" u="" p="" p2="" rp="" rp2="" err=0
+ local l=$((${#_RootBody} + 1))
while true; do
tput cnorm
- values="$(dialog --stdout --no-cancel --separator ';:~:;' \
- --ok-label "Submit" --backtitle "$BT" --title " $_UserTitle " \
+ v="$(dialog --stdout --no-cancel --separator ';:~:;' \
+ --ok-label "Submit" --backtitle "$BT" --title " User Creation " \
--insecure --mixedform "$_UserBody" 0 0 0 \
- "$_Username" 1 1 "$user" 1 $((${#_Username} + 2)) $COLUMNS 0 0 \
- "$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \
- "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1 \
- "$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) $COLUMNS 0 2 \
- "$_Password" 8 1 "" 8 $((${#_Password} + 2)) $COLUMNS 0 1 \
- "$_Password2" 9 1 "" 9 $((${#_Password2} + 2)) $COLUMNS 0 1)"
+ "Username:" 1 1 "$u" 1 11 $COLUMNS 0 0 \
+ "Password:" 2 1 "" 2 11 $COLUMNS 0 1 \
+ "Password2:" 3 1 "" 3 12 $COLUMNS 0 1 \
+ "$_RootBody" 6 1 "" 6 $l $COLUMNS 0 2 \
+ "Password:" 8 1 "" 8 11 $COLUMNS 0 1 \
+ "Password2:" 9 1 "" 9 12 $COLUMNS 0 1)"
err=$?
(( err == 0 )) || break
- user="$(awk -F';:~:;' '{print $1}' <<< "$values")"
- pass="$(awk -F';:~:;' '{print $2}' <<< "$values")"
- pass2="$(awk -F';:~:;' '{print $3}' <<< "$values")"
- rpass="$(awk -F';:~:;' '{print $5}' <<< "$values")"
- rpass2="$(awk -F';:~:;' '{print $6}' <<< "$values")"
+ u="$(awk -F';:~:;' '{print $1}' <<< "$v")"
+ p="$(awk -F';:~:;' '{print $2}' <<< "$v")"
+ p2="$(awk -F';:~:;' '{print $3}' <<< "$v")"
+ rp="$(awk -F';:~:;' '{print $5}' <<< "$v")"
+ rp2="$(awk -F';:~:;' '{print $6}' <<< "$v")"
# root passwords empty, so use the user passwords
- [[ $rpass == "" && $rpass2 == "" ]] && { rpass="$pass"; rpass2="$pass2"; }
+ [[ $rp == "" && $rp2 == "" ]] && { rp="$p"; rp2="$p2"; }
# make sure a username was entered and that the passwords match
- if [[ ${#user} -eq 0 || $user =~ \ |\' || $user =~ [^a-z0-9] ]]; then
- msgbox "$_UserErrTitle" "$_UserErrBody"; user=""
- elif [[ $pass == "" ]]; then
- msgbox "$_ErrTitle" "$_UserPassEmpty\n$_TryAgain"
- elif [[ "$pass" != "$pass2" ]]; then
- msgbox "$_ErrTitle" "$_UserPassErr\n$_TryAgain"
- elif [[ "$rpass" != "$rpass2" ]]; then
- msgbox "$_ErrTitle" "$_RootPassErr\n$_TryAgain"
+ if [[ ${#u} -eq 0 || $u =~ \ |\' || $u =~ [^a-z0-9] ]]; then
+ msgbox "Invalid Username" "\nIncorrect user name.\n\nPlease try again.\n"; u=""
+ elif [[ $p == "" ]]; then
+ msgbox "Empty Password" "\nThe user password cannot be left empty.\n\nPlease try again.\n"
+ elif [[ "$p" != "$p2" ]]; then
+ msgbox "Password Mismatch" "\nThe user passwords do not match.\n\nPlease try again.\n"
+ elif [[ "$rp" != "$rp2" ]]; then
+ msgbox "Password Mismatch" "\nThe root passwords do not match.\n\nPlease try again.\n"
else
- NEWUSER="$user"
- USER_PASS="$pass"
- ROOT_PASS="$rpass"
+ NEWUSER="$u"
+ USER_PASS="$p"
+ ROOT_PASS="$rp"
break
fi
done
{
tput civis
KEYMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
- --title " $_PrepLayout " --menu "$_XMapBody" 0 0 $SHL \
+ --title " Keyboard Layout " --menu "$_XMapBody" 0 0 $SHL \
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \
'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \
if [[ $CMAPS == *"$KEYMAP"* ]]; then
CMAP="$KEYMAP"
else
- CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_CMapTitle " --menu "$_CMapBody" 0 0 $SHL $CMAPS)"
+ CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " Console Keymap " --menu "$_CMapBody" 0 0 $SHL $CMAPS)"
[[ $CMAP ]] || return 1
fi
while true; do
tput civis
- ZONE="$(menubox "$_TimeZTitle" "$_TimeZBody" \
+ ZONE="$(menubox "Timezone" "$_TimeZBody" \
'America' '-' 'Australia' '-' 'Asia' '-' 'Atlantic' '-' 'Africa' '-' \
'Europe' '-' 'Indian' '-' 'Pacific' '-' 'Arctic' '-' 'Antarctica' '-')"
[[ $ZONE ]] || { err=1; break; }
SUBZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
- --title " $_TimeZTitle " --menu "$_TimeSubZBody" 0 0 $SHL ${subz[$ZONE]})"
+ --title " Timezone " --menu "$_TimeSubZBody" 0 0 $SHL ${subz[$ZONE]})"
[[ $SUBZONE ]] || { err=1; break; }
- yesno "$_TimeZTitle" "$_TimeZQ $ZONE/$SUBZONE\n" && break
+ yesno "Timezone" "\nConfirm time zone: $ZONE/$SUBZONE\n" && break
done
return $err
tput civis
INSTALL_WMS="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
- --title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 0 \
+ --title " Sessions " --checklist "$_WMChoiceBody\n" 0 0 0 \
"i3-gaps" "A fork of i3wm with more features including gaps" off \
"openbox" "A lightweight, powerful, and highly configurable stacking wm" off \
"bspwm" "A tiling wm that represents windows as the leaves of a binary tree" off \
return 0
}
-select_login()
-{
- LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" \
- "xinit" "Console login without a display manager" \
- "lightdm" "Lightweight display manager with a gtk greeter")"
-
-
- if [[ $LOGIN_TYPE == "" ]]; then
- return 1
- elif [[ $LOGIN_TYPE == 'lightdm' ]]; then
- WM_PKGS+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
- EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
- AUTOLOGIN=false
- else
- if [[ $WM_NUM -eq 1 ]]; then
- LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
- else
- LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" $LOGIN_CHOICES)" || return 1
- LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}"
- fi
-
- local msg="\nPicking yes will create the following files:\n - /home/$NEWUSER/$LOGINRC (run 'startx' when logging in on tty1)\n - /etc/systemd/system/getty@tty1.service.d/autologin.conf (login $NEWUSER without password)\n\nTo disable autologin remove these files."
- yesno "$_WMLogin" "$_AutoLoginBody\n$msg\n" && AUTOLOGIN=true || AUTOLOGIN=false
- PACKAGES="${PACKAGES// lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice/}"
- WM_PKGS="${WM_PKGS// lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice/}"
- WM_PKGS+=" xorg-xinit"
- EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
- fi
-}
-
-select_mirrorcmd()
-{
- local c
- local key="5f29642060ab983b31fdf4c2935d8c56"
-
- if hash reflector >/dev/null 2>&1; then
- MIRROR_CMD="reflector --score 100 -l 50 -f 5 --sort rate --verbose"
- yesno "$_MirrorTitle" "$_MirrorSetup" && return 0
-
- c="$(json 'country_name' "$(json 'ip' "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_name")"
- MIRROR_CMD="reflector --country $c --fastest 5 --sort rate --verbose"
-
- tput cnorm
- MIRROR_CMD="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
- --title " $_MirrorTitle " --inputbox "$_MirrorCmd\n
- --score n Limit the list to the n servers with the highest score.
- --latest n Limit the list to the n most recently synchronized servers.
- --fastest n Return the n fastest mirrors that meet the other criteria.
- --sort {age,rate,country,score,delay}
-
- 'age': Last server synchronization;
- 'rate': Download rate;
- 'country': Server location;
- 'score': MirrorStatus score;
- 'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
- elif hash rankmirrors >/dev/null 2>&1; then
- infobox "$_MirrorTitle" "\nQuerying mirrors near your location\n"
- c="$(json 'country_code' "$(json 'ip' "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_code")"
- local w="https://www.archlinux.org/mirrorlist"
- if [[ $c ]]; then
- if [[ $c =~ (CA|US) ]]; then
- MIRROR_CMD="curl -s '$w/?country=US&country=CA&use_mirror_status=on'"
- else
- MIRROR_CMD="curl -s '$w/?country=${c}&use_mirror_status=on'"
- fi
- else
- MIRROR_CMD="curl -s '$w/?country=US&country=CA&country=NZ&country=GB&country=AU&use_mirror_status=on'"
- fi
- fi
-
- return 0
-}
-
-edit_configs()
-{
- tput civis
- local choice i=0
-
- while true; do
- choice=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
- --title " $_EditTitle " --menu "$_EditBody" 0 0 0 \
- "finished" "exit the installer and reboot" \
- "keyboard" "${EDIT_FILES[keyboard]}" \
- "console" "${EDIT_FILES[console]}" \
- "locale" "${EDIT_FILES[locale]}" \
- "hostname" "${EDIT_FILES[hostname]}" \
- "sudoers" "${EDIT_FILES[sudoers]}" \
- "mkinitcpio" "${EDIT_FILES[mkinitcpio]}" \
- "fstab" "${EDIT_FILES[fstab]}" \
- "crypttab" "${EDIT_FILES[crypttab]}" \
- "bootloader" "${EDIT_FILES[bootloader]}" \
- "pacman" "${EDIT_FILES[pacman]}" \
- "login" "${EDIT_FILES[login]}")
-
- if [[ $choice == "" || $choice == "finished" ]]; then
- [[ $DEBUG == true && -r $DBG ]] && vim $DBG
- # when die() is passed 127 it will call: systemctl -i reboot
- die 127
- else
- local exists=""
- for f in $(printf "%s" "${EDIT_FILES[$choice]}"); do
- [[ -e ${MNT}$f ]] && exists+=" ${MNT}$f"
- done
- if [[ $exists ]]; then
- vim -O $exists
- else
- msgbox "$_ErrTitle" "$_NoFileErr"
- fi
- fi
- done
-}
-
-###############################################################################
-# package menus
-
select_packages()
{
local cur=0 b="" e="" f="" t="" m="" ml="" p="" v="" fn="" to="" s="" x=""
tput civis
cur=$(dialog --cr-wrap --stdout --backtitle "$BT" \
- --title " $_Packages " --default-item $cur \
+ --title " Packages " --default-item $cur \
--menu "$_PackageMenu" 0 0 0 \
1 "Web Browsers" \
2 "Text Editors" \
return 0
}
+select_mirrorcmd()
+{
+ local c
+ local key="5f29642060ab983b31fdf4c2935d8c56"
+
+ if hash reflector >/dev/null 2>&1; then
+ MIRROR_CMD="reflector --score 100 -l 50 -f 5 --sort rate --verbose"
+ yesno "Mirrorlist" "$_MirrorSetup" && return 0
+
+ c="$(json 'country_name' "$(json 'ip' "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_name")"
+ MIRROR_CMD="reflector --country $c --fastest 5 --sort rate --verbose"
+
+ tput cnorm
+ MIRROR_CMD="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
+ --title " Mirrorlist " --inputbox "$_MirrorCmd\n
+ --score n Limit the list to the n servers with the highest score.
+ --latest n Limit the list to the n most recently synchronized servers.
+ --fastest n Return the n fastest mirrors that meet the other criteria.
+ --sort {age,rate,country,score,delay}
+
+ 'age': Last server synchronization;
+ 'rate': Download rate;
+ 'country': Server location;
+ 'score': MirrorStatus score;
+ 'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
+ elif hash rankmirrors >/dev/null 2>&1; then
+ infobox "Mirrorlist" "\nQuerying mirrors near your location\n"
+ c="$(json 'country_code' "$(json 'ip' "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_code")"
+ local w="https://www.archlinux.org/mirrorlist"
+ if [[ $c ]]; then
+ if [[ $c =~ (CA|US) ]]; then
+ MIRROR_CMD="curl -s '$w/?country=US&country=CA&use_mirror_status=on'"
+ else
+ MIRROR_CMD="curl -s '$w/?country=${c}&use_mirror_status=on'"
+ fi
+ else
+ MIRROR_CMD="curl -s '$w/?country=US&country=CA&country=NZ&country=GB&country=AU&use_mirror_status=on'"
+ fi
+ fi
+
+ return 0
+}
+
+###############################################################################
+# package menus
+
pkg_browsers()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"firefox" "A popular open-source graphical web browser from Mozilla" $(ofn 'firefox') \
"chromium" "an open-source graphical web browser based on the Blink rendering engine" $(ofn 'chromium') \
"opera" "A Fast and secure, free of charge web browser from Opera Software" $(ofn 'opera') \
pkg_editors()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"neovim" "A fork of Vim aiming to improve user experience, plugins, and GUIs." $(ofn 'neovim') \
"atom" "An open-source text editor developed by GitHub that is licensed under the MIT License" $(ofn 'atom') \
"geany" "A fast and lightweight IDE" $(ofn 'geany') \
pkg_files()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"thunar" "A modern file manager for the Xfce Desktop Environment" $(ofn 'thunar') \
"pcmanfm" "A fast and lightweight file manager based in Lxde" $(ofn 'pcmanfm') \
"nautilus" "The default file manager for Gnome" $(ofn 'nautilus') \
pkg_terms()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"termite" "A minimal VTE-based terminal emulator" $(ofn 'termite') \
"rxvt-unicode" "A unicode enabled rxvt-clone terminal emulator" $(ofn 'rxvt-unicode') \
"xterm" "The standard terminal emulator for the X window system" $(ofn 'xterm') \
pkg_media()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"vlc" "A free and open source cross-platform multimedia player" $(ofn 'vlc') \
"mpv" "A media player based on mplayer" $(ofn 'mpv') \
"mpd" "A flexible, powerful, server-side application for playing music" $(ofn 'mpd') \
pkg_mail()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"thunderbird" "Standalone mail and news reader from mozilla" $(ofn 'thunderbird') \
"geary" "A lightweight email client for the GNOME desktop" $(ofn 'geary') \
"evolution" "Manage your email, contacts and schedule" $(ofn 'evolution') \
pkg_prof()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"libreoffice-fresh" "Full featured office suite" $(ofn 'libreoffice-fresh') \
"abiword" "Fully-featured word processor" $(ofn 'abiword') \
"calligra" "A set of applications for productivity" $(ofn 'calligra') \
pkg_fonts()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"ttf-hack" "A hand groomed and optically balanced typeface based on Bitstream Vera Mono" $(ofn 'ttf-hack') \
"ttf-anonymous-pro" "A family fixed-width fonts designed with coding in mind" $(ofn 'ttf-anonymous-pro') \
"ttf-font-awesome" "Iconic font designed for Bootstrap" $(ofn 'ttf-font-awesome') \
pkg_viewers()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"evince" "A document viewer" $(ofn 'evince') \
"zathura" "Minimalistic document viewer" $(ofn 'zathura') \
"qpdfview" "A tabbed PDF viewer" $(ofn 'qpdfview') \
pkg_torrent()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"deluge" "A BitTorrent client written in python" $(ofn 'deluge') \
"qbittorrent" "An advanced BitTorrent client" $(ofn 'qbittorrent') \
"transmission-gtk" "Free BitTorrent client GTK+ GUI" $(ofn 'transmission-gtk') \
pkg_sys()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"gnome-disk-utility" "Disk Management Utility" $(ofn 'gnome-disk-utility') \
"gnome-system-monitor" "View current processes and monitor system state" $(ofn 'gnome-system-monitor') \
"qt5ct" "GUI for managing Qt based application themes, icons, and fonts" $(ofn 'qt5ct'))"
pkg_extra()
{
local pkgs=""
- pkgs="$(checkbox "$_Packages" "$_PackageBody" \
+ pkgs="$(checkbox "Packages" "$_PackageBody" \
"steam" "A popular game distribution platform by Valve" $(ofn 'steam') \
"gpick" "Advanced color picker using GTK+ toolkit" $(ofn 'gpick') \
"gcolor2" "A simple GTK+2 color selector" $(ofn 'gcolor2') \
if [[ $# -eq 1 ]]; then
device="$1"
else
- select_device 'root' || return 1
+ umount_dir $MNT
+ select_device || return 1
device="$DEVICE"
fi
tput civis
if [[ $DISPLAY && $TERM != 'linux' ]] && hash gparted >/dev/null 2>&1; then
- choice="$(menubox "$_PartTitle" "$_PartBody" \
- "$_PartShowTree" "Shows output from the lsblk command" \
- "$_PartAuto" "Full device automatic partitioning" \
+ choice="$(menubox "Edit Partitions" "$_PartBody" \
+ "view partition table" "Shows output from the lsblk command" \
+ "auto partition" "Full device automatic partitioning" \
"gparted" "GUI front end to parted" \
"cfdisk" "Curses front end to fdisk" \
"parted" "GNU partition editor" \
- "$_PartWipe" "Wipe data before disposal or sale of a device" \
- "$_Done" "Return to the main menu")"
+ "secure wipe" "Wipe data before disposal or sale of a device" \
+ "done" "return to the main menu")"
else
- choice="$(menubox "$_PartTitle" "$_PartBody" \
- "$_PartShowTree" "Show output of 'lsblk $device'" \
- "$_PartAuto" "Full device automatic partitioning" \
+ choice="$(menubox "Edit Partitions" "$_PartBody" \
+ "view partition table" "Shows output from the lsblk command" \
+ "auto partition" "Full device automatic partitioning" \
"cfdisk" "Curses front end to fdisk" \
"parted" "GNU partition editor" \
- "$_PartWipe" "Wipe data before disposal or sale of the device" \
- "$_Done" "Return to the main menu")"
+ "secure wipe" "Wipe data before disposal or sale of the device" \
+ "done" "return to the main menu")"
fi
tput civis
- if [[ $choice == "$_Done" || $choice == "" ]]; then
+ if [[ $choice == "done" || $choice == "" ]]; then
return 0
- elif [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" && $choice != "$_PartShowTree" ]]; then
- clear; tput cnorm; $choice "$device"
- elif [[ $choice == "$_PartShowTree" ]]; then
- msgbox "$_PartTitle" "\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE,MOUNTPOINT "$device")\n\n"
- elif [[ $choice == "$_PartWipe" ]]; then
- yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody" && wipe -Ifrev $device
- else
+ elif [[ $choice == "view partition table" ]]; then
+ msgbox "Partition Table" "\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE,MOUNTPOINT "$device")\n\n"
+ elif [[ $choice == "secure wipe" ]]; then
+ yesno "Wipe Partition" "\nWARNING: ALL data on $device $_PartWipeBody" && wipe -Ifrev $device
+ elif [[ $choice == "auto partition" ]]; then
local root_size msg ret table boot_fs
root_size=$(lsblk -lno SIZE "$device" | awk 'NR == 1 {
if ($1 ~ "G") {
msg="$_PartBody2"; table="gpt"; boot_fs="fat32"
fi
- if yesno "$_PrepParts" "$_PartBody1 $device $msg ($root_size)$_PartBody3"; then
- if auto_partition "$device" "$table" "$boot_fs" "$root_size"; then
- return 0
- else
- return 1
- fi
+ if yesno "Auto Partition" "\nWARNING: ALL data on $device $msg ($root_size)$_PartBody3"; then
+ auto_partition "$device" "$table" "$boot_fs" "$root_size" && return 0 || return 1
fi
+ else
+ clear; tput cnorm; $choice "$device"
fi
part_menu "$device"
format_as()
{
- infobox "$_FSTitle" "\nRunning: ${FS_CMDS[$2]} $1\n" 1
+ infobox "Format" "\nRunning: ${FS_CMDS[$2]} $1\n" 1
${FS_CMDS[$2]} "$1" >/dev/null 2>$ERR
errshow "${FS_CMDS[$2]} $1" && FORMATTED+=" $part"
}
{
for i in $(printf "%s" "$@"); do
if (( COUNT > 0 )); then
- PARTS="$(sed "/${i//\//\\/}/d" <<< "$PARTS")"
- (( COUNT-- ))
+ PARTS="$(sed "/${i//\//\\/}/d" <<< "$PARTS")" && (( COUNT-- ))
fi
done
}
+dev_tree()
+{
+ tput civis
+ local msg
+ if [[ $IGNORE_DEV != "" ]]; then
+ msg="$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE,MOUNTPOINT |
+ awk "!/$IGNORE_DEV/"' && /disk|part|lvm|crypt|NAME/')"
+ else
+ msg="$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE,MOUNTPOINT |
+ awk '/disk|part|lvm|crypt|NAME/')"
+ fi
+ msgbox "Device Tree" "\n\n$msg\n\n"
+}
+
enable_swap()
{
if [[ $1 == "$MNT/swapfile" && $SWAP_SIZE ]]; then
return 0
}
-device_tree()
-{
- tput civis
- local msg
- if [[ $IGNORE_DEV != "" ]]; then
- msg="$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE,MOUNTPOINT |
- awk "!/$IGNORE_DEV/"' && /disk|part|lvm|crypt|NAME/')"
- else
- msg="$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE,MOUNTPOINT |
- awk '/disk|part|lvm|crypt|NAME/')"
- fi
- msgbox "$_PrepShowDev" "\n\n$msg\n\n"
-}
-
select_device()
{
- local dev msg
- [[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || umount_dir $MNT
-
if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
elif (( DEV_COUNT > 1 )); then
tput civis
- DEVICE="$(menubox "$_DevSelTitle " "${msg}$_DevSelBody" $SYS_DEVS)"
+ if [[ $1 ]]; then
+ DEVICE="$(menubox "Boot Device" "\nSelect the device to use for bootloader install." $SYS_DEVS)"
+ else
+ DEVICE="$(menubox "Select Device" "$_DevSelBody" $SYS_DEVS)"
+ fi
[[ $DEVICE ]] || return 1
- elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then
- msgbox "$_ErrTitle" "\nNo available devices to use.\n$_Exit"; die 1
+ elif [[ $DEV_COUNT -lt 1 && ! $1 ]]; then
+ msgbox "$_ErrTitle" "\nNo available devices.\n\nExiting..\n"; die 1
fi
- [[ $1 == 'boot' ]] && BOOT_DEVICE="$DEVICE"
+ [[ $1 ]] && BOOT_DEV="$DEVICE"
return 0
}
confirm_mount()
{
- local part="$1" mount="$2"
- [[ $mount == "$MNT" ]] && local m="/ (root)" || local m="${mount#$MNT}"
-
- if [[ $(mount) == *"$mount"* ]]; then
- infobox "$_MntTitle" "$_MntSucc\nPartition: $part\nMountpoint: $m\n" 1
- decr_pcount $part
+ if [[ $(mount) == *"$1"* ]]; then
+ infobox "Mount Success" "\nPartition $1 mounted at $2\n" 1
+ decr_pcount $1
else
- infobox "$_MntTitle" "$_MntFail\n$msg\n" 1
+ infobox "Mount Fail" "\nPartition $1 failed to mount at $2\n" 1
return 1
fi
return 0
local device="$1" table="$2" boot_fs="$3" size="$4"
local dev_info="$(parted -s $device print)"
- infobox "$_PrepParts" "\nRemoving partitions on $device and setting table to $table\n" 2
+ infobox "Auto Partition" "\nRemoving partitions on $device and setting table to $table\n" 2
# in case the device was previously used for swap
swapoff -a
parted -s $device mklabel $table >/dev/null 2>&1
fi
- infobox "$_PrepParts" "\nCreating a 512M $fs boot partition.\n" 2
+ infobox "Auto Partition" "\nCreating a 512M $fs boot partition.\n" 2
if [[ $SYS == "BIOS" ]]; then
parted -s $device mkpart primary $fs 1MiB 513MiB >/dev/null 2>&1
else
fi
sleep 0.5
- BOOT_DEVICE="$device"
+ BOOT_DEV="$device"
AUTO_BOOT_PART=$(lsblk -lno NAME,TYPE $device | awk 'NR == 2 {print "/dev/"$1}')
if [[ $SYS == "BIOS" ]]; then
mkfs.vfat -F32 $AUTO_BOOT_PART >/dev/null 2>&1
fi
- infobox "$_PrepParts" "\nCreating a $size ext4 root partition.\n" 0
+ infobox "Auto Partition" "\nCreating a $size ext4 root partition.\n" 0
parted -s $device mkpart primary ext4 513MiB 100% >/dev/null 2>&1
sleep 0.5
AUTO_ROOT_PART="$(lsblk -lno NAME,TYPE $device | awk 'NR == 3 {print "/dev/"$1}')"
mkfs.ext4 -q $AUTO_ROOT_PART >/dev/null 2>&1
tput civis; sleep 0.5
- msgbox "$_PrepParts" "\nAuto partitioning complete.\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE $device)\n"
+ msgbox "Auto Partition" "\nProcess complete.\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE $device)\n"
}
mount_partition()
fs="$(lsblk -lno FSTYPE $part)"
mkdir -p "$mountp"
- if [[ $fs && ${FS_OPTS[$fs]} && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then
+ if [[ $fs && ${FS_OPTS[$fs]} && $part != "$BOOT_PART" ]] && select_mntopts "$part" "$fs"; then
mount -o $MNT_OPTS "$part" "$mountp" 2>$ERR
else
mount "$part" "$mountp" 2>$ERR
fi
+
confirm_mount $part "$mountp" || return 1
check_cryptlvm "$part"
esac
# if there aren't enough partitions show the relevant error message
- [[ $err ]] && { msgbox "$_ErrTitle" "$err"; return 1; }
+ [[ $err ]] && { msgbox "Not Enough Partitions" "$err"; return 1; }
return 0
}
setup_boot_device()
{
- infobox "$_PrepMount" "\nSetting device flags for: $BOOT_PART\n" 1
- [[ $BOOT_PART = /dev/nvme* ]] && BOOT_DEVICE="${BOOT_PART%p[1-9]}" || BOOT_DEVICE="${BOOT_PART%[1-9]}"
+ infobox "Boot Device" "\nSetting device flags for: $BOOT_PART\n" 1
+ [[ $BOOT_PART = /dev/nvme* ]] && BOOT_DEV="${BOOT_PART%p[1-9]}" || BOOT_DEV="${BOOT_PART%[1-9]}"
BOOT_PART_NUM="${BOOT_PART: -1}"
if [[ $SYS == 'UEFI' ]]; then
- parted -s $BOOT_DEVICE set $BOOT_PART_NUM esp on >/dev/null 2>&1
+ parted -s $BOOT_DEV set $BOOT_PART_NUM esp on >/dev/null 2>&1
else
- parted -s $BOOT_DEVICE set $BOOT_PART_NUM boot on >/dev/null 2>&1
+ parted -s $BOOT_DEV set $BOOT_PART_NUM boot on >/dev/null 2>&1
fi
return 0
}
select_swap()
{
tput civis
- SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" \
- "$_SelSwpNone" "Don't allocate any swap space" \
- "$_SelSwpFile" "Allocate $SYS_MEM of swap at /swapfile" \
+ SWAP_PART="$(menubox "Swap Setup" "\nSelect whether to use a swap partition, swapfile, or none." \
+ "none" "Don't allocate any swap space" \
+ "swapfile" "Allocate $SYS_MEM of swap at /swapfile" \
$PARTS)"
- if [[ $SWAP_PART == "" || $SWAP_PART == "$_SelSwpNone" ]]; then
+ if [[ $SWAP_PART == "" || $SWAP_PART == "none" ]]; then
SWAP_PART=""; return 0
- elif [[ $SWAP_PART == "$_SelSwpFile" ]]; then
+ elif [[ $SWAP_PART == "swapfile" ]]; then
tput cnorm
local i=0
while ! [[ ${SWAP_SIZE:0:1} =~ [1-9] && ${SWAP_SIZE: -1} =~ (M|G) ]]; do
- (( i > 0 )) && msgbox "$_SelSwpSetup Error" "\n$_SelSwpErr $SWAP_SIZE\n"
- if ! SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"; then
+ (( i > 0 )) && msgbox "Swap Setup Error" "\n$_SelSwpErr $SWAP_SIZE\n"
+ if ! SWAP_SIZE="$(getinput "Swap Setup" "$_SelSwpSize" "$SYS_MEM")"; then
SWAP_PART=""; SWAP_SIZE=""; break; return 0
fi
(( i++ ))
done
- enable_swap "$MNT/swapfile"
- SWAP_PART="/swapfile"
+ enable_swap "$MNT/$SWAP_PART"
+ SWAP_PART="/$SWAP_PART"
else
enable_swap $SWAP_PART
decr_pcount $SWAP_PART
return 0
}
-select_mountpoint()
-{
- local err=0
- tput cnorm
- while true; do
- EXMNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1" "/" nolimit)"
- err=$?
- (( err == 0 )) || break
- if [[ ${EXMNT:0:1} != "/" || ${#EXMNT} -le 1 || $EXMNT =~ \ |\' || $EXMNTS == *"$EXMNT"* ]]; then
- msgbox "$_ErrTitle" "$_ExtErrBody"
- else
- break
- fi
- done
- return $err
-}
-
-select_mount_opts()
+select_mntopts()
{
local part="$1" fs="$2" err=0
local title="${fs^} Mount Options"
if [[ $MNT_OPTS ]]; then
MNT_OPTS="$(sed 's/ /,/g; $s/,$//' <<< "$MNT_OPTS" )"
- yesno "$title" "$_MntConfBody $MNT_OPTS\n" && break
+ yesno "$title" "\nConfirm mount options: $MNT_OPTS\n" && break
else
err=1; break
fi
return $err
}
+select_mountpoint()
+{
+ local err=0
+ tput cnorm
+ while true; do
+ EXMNT="$(getinput "Extra Mount $part" "$_ExtPartBody1" "/" nolimit)"
+ err=$?
+ (( err == 0 )) || break
+ if [[ ${EXMNT:0:1} != "/" || ${#EXMNT} -le 1 || $EXMNT =~ \ |\' || $EXMNTS == *"$EXMNT"* ]]; then
+ msgbox "$_ErrTitle" "$_ExtErrBody"
+ else
+ break
+ fi
+ done
+ return $err
+}
+
select_filesystem()
{
local part="$1" fs="" cur_fs="" err=0
[[ $part == "$ROOT_PART" && $ROOT_PART == "$AUTO_ROOT_PART" && ! $LUKS && ! $LVM ]] && return 0
while true; do
- local msg="\nSelect which filesystem to use for: $part\n\nCurrent: ${cur_fs:-none}\nDefault: ext4"
tput civis
if [[ $cur_fs && ( $part != "$ROOT_PART" || $FORMATTED == *"$part"* ) ]]; then
- fs="$(menubox "$_FSTitle: $part" "$msg" \
- "$_Skip" "Do not format this partition" \
+ fs="$(menubox "Filesystem" \
+ "\nSelect which filesystem to use for: $part\n\nCurrent: ${cur_fs:-none}\nDefault: ext4" \
+ "skip" "do not format this partition" \
"ext4" "${FS_CMDS[ext4]}" \
"ext3" "${FS_CMDS[ext3]}" \
"ext2" "${FS_CMDS[ext2]}" \
"nilfs2" "${FS_CMDS[nilfs2]}" \
"reiserfs" "${FS_CMDS[reiserfs]}")"
- [[ $fs == "$_Skip" ]] && break
+ [[ $fs == "skip" ]] && break
else
- local msg="\nSelect which filesystem to use for: $part\n\nDefault: ext4"
- fs="$(menubox "$_FSTitle: $part" "$msg" \
+ fs="$(menubox "Filesystem" "\nSelect which filesystem to use for: $part\n\nDefault: ext4" \
"ext4" "${FS_CMDS[ext4]}" \
"ext3" "${FS_CMDS[ext3]}" \
"ext2" "${FS_CMDS[ext2]}" \
fi
[[ $fs ]] || { err=1; break; }
- yesno "$_FSTitle" "\nFormat $part as $fs?\n" && break
+ yesno "Filesystem" "\nFormat $part as $fs?\n" && break
done
(( err == 0 )) || return $err
- [[ $fs == "$_Skip" ]] || format_as "$part" "$fs"
+ [[ $fs == "skip" ]] || format_as "$part" "$fs"
}
select_efi_partition()
BOOT_PART="$AUTO_BOOT_PART"
return 0 # were done here
else
- BOOT_PART="$(menubox "$_PrepMount" "$_SelUefiBody" $PARTS)"
+ BOOT_PART="$(menubox "EFI Partition" "$_SelUefiBody" $PARTS)"
fi
[[ $BOOT_PART ]] || return 1
if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then
- local msg="$_FormUefiBody $BOOT_PART $_FormBootBody"
- if yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Skip Formatting" "no"; then
+ local msg="\nIMPORTANT: The EFI partition $BOOT_PART $_FormBootBody"
+ if yesno "Format EFI Partition" "$msg" "Format $BOOT_PART" "Skip Formatting" "no"; then
format_as "$BOOT_PART" "vfat"
sleep 1
fi
BOOT_PART="$AUTO_BOOT_PART"
return 0 # were done here
elif [[ $LUKS && ! $LVM ]]; then
- BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosLuksBody" $PARTS)"
+ BOOT_PART="$(menubox "Boot Partition" "$_SelBiosLuksBody" $PARTS)"
[[ $BOOT_PART ]] || return 1
else
- BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosBody" "$_Skip" "-" $PARTS)"
- [[ $BOOT_PART == "" || $BOOT_PART == "$_Skip" ]] && { BOOT_PART=""; return 0; }
+ BOOT_PART="$(menubox "Boot Partition" "$_SelBiosBody" "skip" "don't use a separate boot" $PARTS)"
+ [[ $BOOT_PART == "" || $BOOT_PART == "skip" ]] && { BOOT_PART=""; return 0; }
fi
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
- local msg="$_FormBiosBody $BOOT_PART $_FormBootBody"
- if yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Skip Formatting" "no"; then
+ local msg="\nIMPORTANT: The boot partition $BOOT_PART $_FormBootBody"
+ if yesno "Format Boot Partition" "$msg" "Format $BOOT_PART" "Skip Formatting" "no"; then
format_as "$BOOT_PART" "ext4"
sleep 1
fi
if (( COUNT == 1 )); then
ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$PARTS")"
else
- ROOT_PART="$(menubox "$_PrepMount" "$_SelRootBody" $PARTS)"
+ ROOT_PART="$(menubox "Mount Root" "$_SelRootBody" $PARTS)"
[[ $ROOT_PART ]] || return 1
fi
local part
while (( COUNT > 0 )); do
tput civis
- part="$(menubox "$_PrepMount " "$_ExtPartBody" "$_Done" "Return to the main menu" $PARTS)"
- if [[ $part == "$_Done" || $part == "" ]]; then
+ part="$(menubox "Mount Boot" "$_ExtPartBody" "done" "return to the main menu" $PARTS)"
+ if [[ $part == "done" || $part == "" ]]; then
break
elif select_filesystem "$part" && select_mountpoint && mount_partition "$part" "$EXMNT"; then
EXMNTS="$EXMNTS $part: $EXMNT"
###############################################################################
# installation
-install()
+install_main()
{
clear
tput cnorm
genfstab -U $MNT >$MNT/etc/fstab 2>$ERR
errshow 1 "genfstab -U $MNT >$MNT/etc/fstab"
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
- mirrorlist_sort
- package_operations
- run_mkinitcpio
- install_bootloader
+ install_mirrorlist
+ install_packages
+ install_mkinitcpio
+ install_boot
printf "Setting hardware clock with: hwclock --systohc --utc\n"
chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa"
- create_user
- login_manager
+ install_user
+ install_login
printf "Setting ownership of /home/$NEWUSER\n"
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
sleep 1
- edit_configs
-}
-
-install_base()
-{
- if [[ -e /run/archiso/sfs/airootfs/etc/skel ]]; then
- rsync -ahv /run/archiso/sfs/airootfs/ $MNT/ 2>$ERR
- errshow 1 "rsync -ahv /run/archiso/sfs/airootfs/ $MNT/"
- else
- mirrorlist_sort
- pacstrap $MNT base $KERNEL $UCODE $(grep -hv '^#' /usr/share/archlabs/installer/packages.txt) 2>$ERR
- errshow 1 "pacstrap $MNT base $KERNEL $UCODE $(grep -hv '^#' /usr/share/archlabs/installer/packages.txt)"
- fi
- printf "Removing archiso remains\n"
+ while true; do
+ tput civis
+ choice=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
+ --title " Finalization " --menu "$_EditBody" 0 0 0 \
+ "finished" "exit the installer and reboot" \
+ "keyboard" "${EDIT_FILES[keyboard]}" \
+ "console" "${EDIT_FILES[console]}" \
+ "locale" "${EDIT_FILES[locale]}" \
+ "hostname" "${EDIT_FILES[hostname]}" \
+ "sudoers" "${EDIT_FILES[sudoers]}" \
+ "mkinitcpio" "${EDIT_FILES[mkinitcpio]}" \
+ "fstab" "${EDIT_FILES[fstab]}" \
+ "crypttab" "${EDIT_FILES[crypttab]}" \
+ "bootloader" "${EDIT_FILES[bootloader]}" \
+ "pacman" "${EDIT_FILES[pacman]}" \
+ "login" "${EDIT_FILES[login]}")
+
+ if [[ $choice == "" || $choice == "finished" ]]; then
+ [[ $DEBUG == true && -r $DBG ]] && vim $DBG
+ # when die() is passed 127 it will call: systemctl -i reboot
+ die 127
+ else
+ local exists=""
+ for f in $(printf "%s" "${EDIT_FILES[$choice]}"); do
+ [[ -e ${MNT}$f ]] && exists+=" ${MNT}$f"
+ done
+ if [[ $exists ]]; then
+ vim -O $exists
+ else
+ msgbox "File Error" "\nFile(s) do not exist.\n"
+ fi
+ fi
+ done
+}
+
+install_base()
+{
+ if [[ -e /run/archiso/sfs/airootfs/etc/skel ]]; then
+ rsync -ahv /run/archiso/sfs/airootfs/ $MNT/ 2>$ERR
+ errshow 1 "rsync -ahv /run/archiso/sfs/airootfs/ $MNT/"
+ else
+ install_mirrorlist
+ pacstrap $MNT base $KERNEL $UCODE $(grep -hv '^#' /usr/share/archlabs/installer/packages.txt) 2>$ERR
+ errshow 1 "pacstrap $MNT base $KERNEL $UCODE $(grep -hv '^#' /usr/share/archlabs/installer/packages.txt)"
+ fi
+
+ printf "Removing archiso remains\n"
rm -rf $MNT/etc/mkinitcpio-archiso.conf
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -exec rm -rf '{}' \;
sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf
if [[ -e /run/archiso/sfs/airootfs ]]; then
printf "Copying vmlinuz and ucode to /boot\n"
[[ $KERNEL == 'linux' ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
- [[ $UCODE ]] && cp -vf $RUN/${UCODE/-/_}.img $MNT/boot/${UCODE}.img
+ [[ $UCODE ]] && cp -vf $RUN/${UCODE/-/_}.img $MNT/boot/$UCODE.img
fi
printf "Copying network settings to /etc\n"
}
-create_user()
+install_user()
{
printf "Setting root password\n"
chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR
EOF
fi
- [[ $INSTALL_WMS == *dwm* ]] && suckless_install
+ [[ $INSTALL_WMS == *dwm* ]] && install_suckless
[[ $LOGIN_WM =~ (startkde|gnome-session) ]] && sed -i '/super/d' $HOME/.xprofile /root/.xprofile
return 0
}
-setup_xinit()
+install_login()
+{
+ printf "Setting up $LOGIN_TYPE\n"
+ SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
+
+ # remove welcome message
+ sed -i '/printf/d' $MNT/root/.zshrc
+
+ # remove unneeded shell files from installation
+ case $MYSHELL in
+ "/bin/bash")
+ rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* $MNT/root/.{zsh,mksh}* ;;
+ "/usr/bin/mksh")
+ rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{zsh,bash}* $MNT/root/.inputrc ;;
+ "/usr/bin/zsh")
+ rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{bash,mksh}* $MNT/root/.inputrc ;;
+ esac
+
+ install_${LOGIN_TYPE:-xinit}
+}
+
+install_xinit()
{
if [[ -e $MNT/home/$NEWUSER/.xinitrc ]] && grep -q 'exec' $MNT/home/$NEWUSER/.xinitrc; then
sed -i "/exec/ c exec ${LOGIN_WM}" $MNT/home/$NEWUSER/.xinitrc
fi
}
-setup_lightdm()
+install_lightdm()
{
rm -rf $SERVICE
rm -rf $MNT/home/$NEWUSER/.{xinitrc,profile,zprofile,bash_profile}
EOF
}
-login_manager()
-{
- printf "Setting up $LOGIN_TYPE\n"
- SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
-
- # remove welcome message
- sed -i '/printf/d' $MNT/root/.zshrc
-
- # remove unneeded shell files from installation
- case $MYSHELL in
- "/bin/bash")
- rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* $MNT/root/.{zsh,mksh}* ;;
- "/usr/bin/mksh")
- rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{zsh,bash}* $MNT/root/.inputrc ;;
- "/usr/bin/zsh")
- rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{bash,mksh}* $MNT/root/.inputrc ;;
- esac
-
- if [[ $LOGIN_TYPE == 'lightdm' ]]; then
- setup_lightdm
- else
- setup_xinit
- fi
-}
-
-run_mkinitcpio()
-{
- local add=""
- [[ $LUKS && $LUKS_PASS && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile
- [[ $LUKS ]] && add="encrypt"
- [[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; }
- sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" $MNT/etc/mkinitcpio.conf
- chrun "mkinitcpio -p $KERNEL" 2>$ERR
- errshow 1 "mkinitcpio -p $KERNEL"
-}
-
-mirrorlist_sort()
-{
- printf "Sorting the mirrorlist\n"
- if hash reflector >/dev/null 2>&1; then
- $MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist --verbose ||
- reflector --score 100 -l 50 -f 10 --sort rate --verbose --save $MNT/etc/pacman.d/mirrorlist
- else
- { eval $MIRROR_CMD || curl -s 'https://www.archlinux.org/mirrorlist/all/'; } |
- sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -v -t -n 10 - > $MNT/etc/pacman.d/mirrorlist
- fi
-}
-
-package_operations()
+install_packages()
{
local rmpkg="archlabs-installer"
local inpkg="$BASE_PKGS $PACKAGES $USER_PKGS"
return 0
}
-suckless_install()
+install_suckless()
{
# install and setup dwm
printf "Installing and setting up dwm\n"
fi
}
+install_mirrorlist()
+{
+ printf "Sorting the mirrorlist\n"
+ if hash reflector >/dev/null 2>&1; then
+ $MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist --verbose ||
+ reflector --score 100 -l 50 -f 10 --sort rate --verbose --save $MNT/etc/pacman.d/mirrorlist
+ else
+ { eval $MIRROR_CMD || curl -s 'https://www.archlinux.org/mirrorlist/all/'; } |
+ sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -v -t -n 10 - > $MNT/etc/pacman.d/mirrorlist
+ fi
+}
+
+install_mkinitcpio()
+{
+ local add=""
+ [[ $LUKS && $LUKS_PASS && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile
+ [[ $LUKS ]] && add="encrypt"
+ [[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; }
+ sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" $MNT/etc/mkinitcpio.conf
+ chrun "mkinitcpio -p $KERNEL" 2>$ERR
+ errshow 1 "mkinitcpio -p $KERNEL"
+}
+
###############################################################################
# bootloader setup
+install_boot()
+{
+ if [[ $ROOT_PART == */dev/mapper* ]]; then
+ ROOT_PART_ID="$ROOT_PART"
+ elif [[ $BOOTLDR == 'syslinux' ]]; then
+ ROOT_PART_ID="UUID=$(blkid -s UUID -o value $ROOT_PART)"
+ elif [[ $BOOTLDR == 'systemd-boot' || $BOOTLDR == 'refind-efi' ]]; then
+ ROOT_PART_ID="PARTUUID=$(blkid -s PARTUUID -o value $ROOT_PART)"
+ fi
+
+ if [[ $SYS == 'UEFI' ]]; then
+ find $MNT/boot/EFI/ -maxdepth 1 -mindepth 1 \
+ -name '[aA][rR][cC][hH][lL]abs' -type d -exec rm -rf '{}' \; >/dev/null 2>&1
+ find $MNT/boot/EFI/ -maxdepth 1 -mindepth 1 \
+ -name '[Bb][oO][oO][tT]' -type d -exec rm -rf '{}' \; >/dev/null 2>&1
+ fi
+
+ if [[ $BOOTLDR != 'grub' ]]; then
+ rm -f $MNT/etc/default/grub 2>/dev/null
+ find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
+ fi
+
+ if [[ $BOOTLDR != 'syslinux' ]]; then
+ find $MNT/boot/ -name 'syslinux*' -exec rm -rf '{}' \; >/dev/null 2>&1
+ fi
+
+ printf "Installing and setting up $BOOTLDR\n"
+ prerun_$BOOTLDR
+ chrun "${BCMDS[$BOOTLDR]}" 2>$ERR
+ errshow 1 "${BCMDS[$BOOTLDR]}"
+
+ if [[ -d $MNT/hostrun ]]; then
+ umount $MNT/hostrun/udev >/dev/null 2>&1
+ umount $MNT/hostrun/lvm >/dev/null 2>&1
+ rm -rf $MNT/hostrun >/dev/null 2>&1
+ fi
+
+ if [[ $SYS == 'UEFI' ]]; then
+ # some UEFI firmware require a generic esp/BOOT/BOOTX64.EFI
+ # see: https://wiki.archlinux.org/index.php/GRUB#UEFI
+ # also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems
+ mkdir -pv $MNT/boot/EFI/BOOT
+ if [[ $BOOTLDR == 'grub' ]]; then
+ cp -fv $MNT/boot/EFI/$DIST/grubx64.efi $MNT/boot/EFI/BOOT/BOOTX64.EFI
+ elif [[ $BOOTLDR == 'syslinux' ]]; then
+ cp -rf $MNT/boot/EFI/syslinux/* $MNT/boot/EFI/BOOT/
+ cp -f $MNT/boot/EFI/syslinux/syslinux.efi $MNT/boot/EFI/BOOT/BOOTX64.EFI
+ elif [[ $BOOTLDR == 'refind-efi' ]]; then
+ sed -i '/#extra_kernel_version_strings/ c extra_kernel_version_strings linux-hardened,linux-zen,linux-lts,linux' $MNT/boot/EFI/refind/refind.conf
+ cp -fv $MNT/boot/EFI/refind/refind_x64.efi $MNT/boot/EFI/BOOT/BOOTX64.EFI
+ fi
+ fi
+
+ return 0
+}
+
setup_boot()
{
tput civis
if [[ $SYS == 'BIOS' ]]; then
- BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" \
+ BOOTLDR="$(menubox "Bootloader" "\nSelect which bootloader to use." \
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network")"
else
- BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" \
+ BOOTLDR="$(menubox "Bootloader" "\nSelect which bootloader to use." \
"systemd-boot" "A simple UEFI boot manager which executes configured EFI images" \
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
"refind-efi" "A UEFI boot manager that aims to be platform neutral and simplify multi-boot" \
EDIT_FILES[bootloader]="/etc/default/grub"
if [[ $SYS == 'BIOS' ]]; then
- [[ $BOOT_DEVICE ]] || { select_device 'boot' || return 1; }
- BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_DEVICE"
+ [[ $BOOT_DEV ]] || { select_device 1 || return 1; }
+ BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_DEV"
else
if [[ $ROOT_PART == */dev/mapper/* && ! $LVM && ! $LUKS_PASS ]]; then
luks_pass "$_LuksOpen" 1 || return 1
else
EDIT_FILES[bootloader]="/boot/EFI/syslinux/syslinux.cfg"
BCMDS[syslinux]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars || true &&
- efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST -v"
+ efibootmgr -c -d $BOOT_DEV -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST -v"
fi
}
-setup_systemd-boot()
-{
- EDIT_FILES[bootloader]="/boot/loader/entries/$DIST.conf"
- BCMDS[systemd-boot]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars || true && bootctl --path=/boot install"
-}
-
setup_refind-efi()
{
EDIT_FILES[bootloader]="/boot/refind_linux.conf"
BCMDS[refind-efi]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars || true && refind-install"
}
-prerun_refind-efi()
+setup_systemd-boot()
{
- cat > $MNT/boot/refind_linux.conf << EOF
-"$DIST Linux" "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
- printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
- printf "initrd=/%s " "$UCODE")initrd=/initramfs-%v.img"
-"$DIST Linux Fallback" "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
- printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
- printf "initrd=/%s " "$UCODE")initrd=/initramfs-%v-fallback.img"
-EOF
- mkdir -p $MNT/etc/pacman.d/hooks
- cat > $MNT/etc/pacman.d/hooks/refind.hook << EOF
-[Trigger]
-Operation = Upgrade
-Type = Package
-Target = refind-efi
-
-[Action]
-Description = Updating rEFInd on ESP
-When = PostTransaction
-Exec = /usr/bin/refind-install
-EOF
+ EDIT_FILES[bootloader]="/boot/loader/entries/$DIST.conf"
+ BCMDS[systemd-boot]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars || true && bootctl --path=/boot install"
}
prerun_grub()
return 0
}
-prerun_systemd-boot()
-{
- mkdir -p $MNT/boot/loader/entries
- cat > $MNT/boot/loader/loader.conf << EOF
-default $DIST
-timeout 5
-editor no
-EOF
- cat > $MNT/boot/loader/entries/$DIST.conf << EOF
-title $DIST Linux
-linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
-initrd /initramfs-$KERNEL.img
-options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
-EOF
- cat > $MNT/boot/loader/entries/$DIST-fallback.conf << EOF
-title $DIST Linux Fallback
-linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
-initrd /initramfs-$KERNEL-fallback.img
-options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
-EOF
- mkdir -p $MNT/etc/pacman.d/hooks
- cat > $MNT/etc/pacman.d/hooks/systemd-boot.hook << EOF
-[Trigger]
-Type = Package
-Operation = Upgrade
-Target = systemd
-
-[Action]
-Description = Updating systemd-boot
-When = PostTransaction
-Exec = /usr/bin/bootctl update
-EOF
- systemd-machine-id-setup --root="$MNT"
- return 0
-}
-
prerun_syslinux()
{
- local cfgdir="$MNT/boot/syslinux" cfgsrcdir="/usr/lib/syslinux/bios"
+ local c="$MNT/boot/syslinux" s="/usr/lib/syslinux/bios" d=".."
if [[ $SYS == 'UEFI' ]]; then
- cfgdir="$MNT/boot/EFI/syslinux"; cfgsrcdir="/usr/lib/syslinux/efi64/"
+ c="$MNT/boot/EFI/syslinux"; s="/usr/lib/syslinux/efi64/"; d=""
fi
- mkdir -pv $cfgdir
- cp -rfv $cfgsrcdir/* $cfgdir/
- cat > $cfgdir/syslinux.cfg << EOF
+ mkdir -pv $c && cp -rfv $s/* $c/ && cp -f $RUN/syslinux/splash.png $c/
+ cat > $c/syslinux.cfg << EOF
UI vesamenu.c32
MENU TITLE $DIST Boot Menu
MENU BACKGROUND splash.png
LABEL $DIST
MENU LABEL $DIST Linux
-LINUX ../vmlinuz-$KERNEL
+LINUX $d/vmlinuz-$KERNEL
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
-INITRD $([[ $UCODE ]] && printf "%s" "../$UCODE.img,")../initramfs-$KERNEL.img
+INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL.img
LABEL ${DIST}fallback
MENU LABEL $DIST Linux Fallback
-LINUX ../vmlinuz-$KERNEL
+LINUX $d/vmlinuz-$KERNEL
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
-INITRD $([[ $UCODE ]] && printf "%s" "../$UCODE.img,")../initramfs-$KERNEL-fallback.img
-
-# examples of chainloading other bootloaders
+INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL-fallback.img
+$([[ $SYS == 'BIOS' ]] && printf "\n%s" "# examples of chainloading other bootloaders
#LABEL grub2
#MENU LABEL Grub2
#COM32 chain.c32
-#APPEND file=../grub/boot.img
+#APPEND file=$d/grub/boot.img
#LABEL windows
#MENU LABEL Windows
#COM32 chain.c32
-#APPEND hd0 3
-
+#APPEND hd0 3")
EOF
return 0
}
-install_bootloader()
+prerun_refind-efi()
{
- if [[ $ROOT_PART == */dev/mapper* ]]; then
- ROOT_PART_ID="$ROOT_PART"
- elif [[ $BOOTLDR == 'syslinux' ]]; then
- ROOT_PART_ID="UUID=$(blkid -s UUID -o value $ROOT_PART)"
- elif [[ $BOOTLDR == 'systemd-boot' || $BOOTLDR == 'refind-efi' ]]; then
- ROOT_PART_ID="PARTUUID=$(blkid -s PARTUUID -o value $ROOT_PART)"
- fi
-
- if [[ $SYS == 'UEFI' ]]; then
- find $MNT/boot/EFI/ -maxdepth 1 -mindepth 1 \
- -name '[aA][rR][cC][hH][lL]abs' -type d -exec rm -rf '{}' \; >/dev/null 2>&1
- find $MNT/boot/EFI/ -maxdepth 1 -mindepth 1 \
- -name '[Bb][oO][oO][tT]' -type d -exec rm -rf '{}' \; >/dev/null 2>&1
- fi
-
- if [[ $BOOTLDR != 'grub' ]]; then
- rm -f $MNT/etc/default/grub 2>/dev/null
- find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
- fi
-
- if [[ $BOOTLDR != 'syslinux' ]]; then
- find $MNT/boot/ -name 'syslinux*' -exec rm -rf '{}' \; >/dev/null 2>&1
- fi
-
- printf "Installing and setting up $BOOTLDR\n"
- prerun_$BOOTLDR
- chrun "${BCMDS[$BOOTLDR]}" 2>$ERR
- errshow 1 "${BCMDS[$BOOTLDR]}"
+ cat > $MNT/boot/refind_linux.conf << EOF
+"$DIST Linux" "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
+ printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
+ printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL.img"
+"$DIST Linux Fallback" "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
+ printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
+ printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL-fallback.img"
+EOF
+ mkdir -p $MNT/etc/pacman.d/hooks
+ cat > $MNT/etc/pacman.d/hooks/refind.hook << EOF
+[Trigger]
+Operation = Upgrade
+Type = Package
+Target = refind-efi
- if [[ -d $MNT/hostrun ]]; then
- umount $MNT/hostrun/udev >/dev/null 2>&1
- umount $MNT/hostrun/lvm >/dev/null 2>&1
- rm -rf $MNT/hostrun >/dev/null 2>&1
- fi
+[Action]
+Description = Updating rEFInd on ESP
+When = PostTransaction
+Exec = /usr/bin/refind-install
+EOF
+}
- if [[ $SYS == 'UEFI' ]]; then
- # some UEFI firmware require a generic esp/BOOT/BOOTX64.EFI
- # see: https://wiki.archlinux.org/index.php/GRUB#UEFI
- # also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems
- mkdir -pv $MNT/boot/EFI/BOOT
- if [[ $BOOTLDR == 'grub' ]]; then
- cp -fv $MNT/boot/EFI/$DIST/grubx64.efi $MNT/boot/EFI/BOOT/BOOTX64.EFI
- elif [[ $BOOTLDR == 'syslinux' ]]; then
- cp -rf $MNT/boot/EFI/syslinux/* $MNT/boot/EFI/BOOT/
- cp -f $MNT/boot/EFI/syslinux/syslinux.efi $MNT/boot/EFI/BOOT/BOOTX64.EFI
- elif [[ $BOOTLDR == 'refind-efi' ]]; then
- sed -i '/#extra_kernel_version_strings/ c extra_kernel_version_strings linux-hardened,linux-zen,linux-lts,linux'
- cp -fv $MNT/boot/EFI/refind/refind_x64.efi $MNT/boot/EFI/BOOT/BOOTX64.EFI
- fi
- fi
+prerun_systemd-boot()
+{
+ mkdir -p $MNT/boot/loader/entries
+ cat > $MNT/boot/loader/loader.conf << EOF
+default $DIST
+timeout 5
+editor no
+EOF
+ cat > $MNT/boot/loader/entries/$DIST.conf << EOF
+title $DIST Linux
+linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
+initrd /initramfs-$KERNEL.img
+options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
+EOF
+ cat > $MNT/boot/loader/entries/$DIST-fallback.conf << EOF
+title $DIST Linux Fallback
+linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
+initrd /initramfs-$KERNEL-fallback.img
+options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
+EOF
+ mkdir -p $MNT/etc/pacman.d/hooks
+ cat > $MNT/etc/pacman.d/hooks/systemd-boot.hook << EOF
+[Trigger]
+Type = Package
+Operation = Upgrade
+Target = systemd
+[Action]
+Description = Updating systemd-boot
+When = PostTransaction
+Exec = /usr/bin/bootctl update
+EOF
+ systemd-machine-id-setup --root="$MNT"
return 0
}
local choice
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" \
- --title " $_PrepLVM " --menu "$_LvmMenu" 0 0 0 \
- "$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
- "$_LvmDelVG" "vgremove -f" \
- "$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
- "$_Back" "Return to the main menu")"
+ --title " Logical Volume Management " --menu "$_LvmMenu" 0 0 0 \
+ "$_LvmNew" "vgcreate -f, lvcreate -L -n" \
+ "$_LvmDel" "vgremove -f" \
+ "$_LvmDelAll" "lvrmeove, vgremove, pvremove -f" \
+ "back" "return to the main menu")"
case $choice in
- "$_LvmCreateVG") lvm_create || return 1 ;;
- "$_LvmDelVG") lvm_del_vg ;;
- "$_LvMDelAll") lvm_del_all ;;
+ "$_LvmNew") lvm_create || return 1 ;;
+ "$_LvmDelVG")
+ if lvm_show_vg && yesno "$_LvmDelVG" "$_LvmDelQ"; then
+ vgremove -f "$DEL_VG" >/dev/null 2>&1
+ fi
+ lvm_menu
+ ;;
+ "$_LvMDelAll") lvm_del_all ;;
esac
return 0
VOLUMES="$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)"
if [[ $VOLUMES && $VOLUME_GROUP && $PHYSICAL_VOLUMES ]]; then
- infobox "$_PrepLVM" "$_LvmDetBody" 1
+ infobox "Logical Volume Management" "$_LvmDetBody" 1
modprobe dm-mod >/dev/null 2>$ERR
errshow 'modprobe dm-mod'
vgscan >/dev/null 2>&1
done
[[ $VOL_GROUP_LIST == "" ]] && { msgbox "$_ErrTitle" "$_LvmVGErr"; return 1; }
tput civis
- DEL_VG="$(menubox "$_PrepLVM" "$_LvmSelVGBody" $VOL_GROUP_LIST)"
+ DEL_VG="$(menubox "Logical Volume Management" "$_LvmSelVGBody" $VOL_GROUP_LIST)"
[[ $DEL_VG ]]
}
get_lv_size()
{
tput cnorm
- local ttl=" $_LvmCreateVG (LV:$VOL_COUNT) "
+ local ttl=" $_LvmNew (LV:$VOL_COUNT) "
local msg="${VOLUME_GROUP}: ${GROUP_SIZE}$GROUP_SIZE_TYPE (${VGROUP_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2"
VOLUME_SIZE="$(getinput "$ttl" "$msg" "")"
[[ $VOLUME_SIZE ]] || return 1
fi
if (( ERR_SIZE == 1 )); then
- msgbox "$_ErrTitle" "$_LvmLvSizeErrBody"
+ msgbox "LVM Size Error" "$_LvmLvSizeErrBody"
get_lv_size || return 1
fi
while true; do
tput cnorm
- name="$(getinput "$_LvmCreateVG (LV:$VOL_COUNT)" "\n$msg" "$default" nolimit)"
+ name="$(getinput "$_LvmNew (LV:$VOL_COUNT)" "\n$msg" "$default" nolimit)"
[[ $name ]] || { err=1; break; }
if [[ ${name:0:1} == "/" || ${#name} -eq 0 || $name =~ \ |\' ]] || grep -q "$name" <<< "$(lsblk)"; then
msgbox "$_ErrTitle" "$_LvmLvNameErrBody"
while true; do
tput cnorm
- group="$(getinput "$_LvmCreateVG" "$_LvmNameVgBody" "VolGroup" nolimit)"
+ group="$(getinput "$_LvmNew" "$_LvmNameVgBody" "VolGroup" nolimit)"
[[ $group ]] || { err=1; break; }
if [[ ${group:0:1} == "/" || ${#group} -eq 0 || $group =~ \ |\' ]] || grep -q "$group" <<< "$(lsblk)"; then
msgbox "$_ErrTitle" "$_LvmNameVgErr"
lvm_volume_name "$_LvmLvNameBody1" && get_lv_size || { err=1; break; }
lvcreate -L "$VOLUME_SIZE" "$VOLUME_GROUP" -n "$VOLUME_NAME" >/dev/null 2>$ERR
errshow "lvcreate -L $VOLUME_SIZE $VOLUME_GROUP -n $VOLUME_NAME" || { err=1; break; }
- msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "\n$_Done Logical Volume (LV) $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2.\n"
+ msgbox "$_LvmNew (LV:$VOL_COUNT)" "\nDone, logical volume (LV) $VOLUME_NAME ($VOLUME_SIZE) has been created.\n"
(( VOL_COUNT-- ))
done
return $err
}
-lvm_volumes()
-{
- VOL_COUNT=$(dialog --cr-wrap --no-cancel --stdout \
- --backtitle "$BT" --title " $_LvmCreateVG " \
- --radiolist "$_LvmLvNumBody1 $VOLUME_GROUP\n$_LvmLvNumBody2" 0 0 0 \
- "1" "-" off "2" "-" off "3" "-" off "4" "-" off "5" "-" off \
- "6" "-" off "7" "-" off "8" "-" off "9" "-" off)
-
- [[ $VOL_COUNT ]]
-}
-
lvm_partitions()
{
find_partitions 'part|crypt' || return 1
tput civis
LVM_PARTS=($(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
- --title " $_LvmCreateVG " --checklist "$_LvmPvSelBody" 0 0 0 $PARTS))
+ --title " $_LvmNew " --checklist "$_LvmPvSelBody" 0 0 0 $PARTS))
(( ${#LVM_PARTS[@]} >= 1 ))
}
lvm_group_name || return 1
local msg="$_LvmPvConfBody1 $VOLUME_GROUP\n\n$_LvmPvConfBody2"
- while ! yesno "$_LvmCreateVG" "$msg ${LVM_PARTS[*]}\n"; do
+ while ! yesno "$_LvmNew" "$msg ${LVM_PARTS[*]}\n"; do
lvm_partitions || { break; return 1; }
lvm_group_name || { break; return 1; }
done
else
VGROUP_MB=$GROUP_SIZE
fi
-
- local msg="$_LvmPvDoneBody1 $VOLUME_GROUP ($GROUP_SIZE $GROUP_SIZE_TYPE)"
- msgbox "$_LvmCreateVG" "$msg $_LvmPvDoneBody2\n"
+ msgbox "$_LvmNew" "\nVolume group: $VOLUME_GROUP ($GROUP_SIZE $GROUP_SIZE_TYPE) has been created\n"
}
lvm_create()
umount_dir $MNT
lvm_partitions || return 1
lvm_mkgroup || return 1
- lvm_volumes || return 1
+ VOL_COUNT=$(menubox "$_LvmNew" "$_LvmLvNumBody1 $VOLUME_GROUP\n$_LvmLvNumBody2" 0 0 0 \
+ "1" "-" "2" "-" "3" "-" "4" "-" "5" "-" "6" "-" "7" "-" "8" "-" "9" "-")
+
+ [[ $VOL_COUNT ]] || return 1
+
lvm_extra_lvs || return 1
lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VGROUP_MB}MB)" || return 1
lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" >/dev/null 2>$ERR
errshow "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME" || return 1
LVM='logical volume'; tput civis; sleep 0.5
- local msg="\n$_Done $_LvmPvDoneBody1 $VOLUME_GROUP-$VOLUME_NAME (${VOLUME_SIZE:-${VGROUP_MB}MB}) $_LvmPvDoneBody2.\n"
- msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE "${LVM_PARTS[@]}")\n"
-}
-
-lvm_del_vg()
-{
- if lvm_show_vg && yesno "$_LvmDelVG" "$_LvmDelQ"; then
- vgremove -f "$DEL_VG" >/dev/null 2>&1
- fi
+ local msg="\nDone, volume: $VOLUME_GROUP-$VOLUME_NAME (${VOLUME_SIZE:-${VGROUP_MB}MB}) has been created.\n"
+ msgbox "$_LvmNew (LV:$VOL_COUNT)" "$msg\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE "${LVM_PARTS[@]}")\n"
}
lvm_del_all()
VOLUME_GROUP="$(vgs -o vg_name --noheading 2>/dev/null)"
VOLUMES="$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)"
- if yesno "$_LvMDelAll" "$_LvmDelQ"; then
+ if yesno "$_LvmDelAll" "$_LvmDelQ"; then
for i in $VOLUMES; do
lvremove -f "/dev/mapper/$i" >/dev/null 2>&1
done
{
tput civis
local choice
- choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepLUKS " \
+ choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " LUKS Encryption " \
--menu "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 0 \
"$_LuksEncrypt" "cryptsetup -q luksFormat" \
"$_LuksOpen" "cryptsetup open --type luks" \
"$_LuksEncryptAdv" "cryptsetup -q -s -c luksFormat" \
- "$_Back" "Return to the main menu")"
+ "back" "Return to the main menu")"
case $choice in
"$_LuksEncrypt") luks_basic || return 1 ;;
luks_pass()
{
- local title="$1" onlypass="$2" values="" pass="" pass2="" err=0
+ local t="$1" op="$2" v="" p="" p2="" err=0
while true; do
tput cnorm
- if [[ $onlypass ]]; then
- values="$(dialog --stdout --no-cancel --separator ';:~:;' \
+ if [[ $op ]]; then
+ v="$(dialog --stdout --no-cancel --separator ';:~:;' \
--ok-label "Submit" --backtitle "$BT" --title " $title " --insecure --mixedform \
"\nEnter the password to decrypt $ROOT_PART.\n\nThis is needed to create a keyfile." 0 0 0 \
- "$_Password" 1 1 "" 1 $((${#_Password} + 2)) $COLUMNS 0 1 \
- "$_Password2" 2 1 "" 2 $((${#_Password2} + 2)) $COLUMNS 0 1)"
+ "Password:" 1 1 "" 1 11 $COLUMNS 0 1 \
+ "Password2:" 2 1 "" 2 12 $COLUMNS 0 1)"
else
- values="$(dialog --stdout --no-cancel --separator ';:~:;' \
+ v="$(dialog --stdout --no-cancel --separator ';:~:;' \
--ok-label "Submit" --backtitle "$BT" --title " $title " \
--insecure --mixedform "$_LuksOpenBody" 0 0 0 \
- "$_Name" 1 1 "${LUKS_NAME:-cryptroot}" 1 $((${#_Name} + 2)) $COLUMNS 0 0 \
- "$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \
- "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1)"
+ "Name:" 1 1 "${LUKS_NAME:-cryptroot}" 1 7 $COLUMNS 0 0 \
+ "Password:" 2 1 "" 2 11 $COLUMNS 0 1 \
+ "Password2:" 3 1 "" 3 12 $COLUMNS 0 1)"
fi
(( err == 0 )) || break
if [[ $onlypass ]]; then
- pass="$(awk -F';:~:;' '{print $1}' <<< "$values")"
- pass2="$(awk -F';:~:;' '{print $2}' <<< "$values")"
+ p="$(awk -F';:~:;' '{print $1}' <<< "$v")"
+ p2="$(awk -F';:~:;' '{print $2}' <<< "$v")"
else
- name="$(awk -F';:~:;' '{print $1}' <<< "$values")"
- pass="$(awk -F';:~:;' '{print $2}' <<< "$values")"
- pass2="$(awk -F';:~:;' '{print $3}' <<< "$values")"
+ n="$(awk -F';:~:;' '{print $1}' <<< "$v")"
+ p="$(awk -F';:~:;' '{print $2}' <<< "$v")"
+ p2="$(awk -F';:~:;' '{print $3}' <<< "$v")"
fi
- if [[ ! $onlypass && $name == "" ]]; then
- infobox "$_ErrTitle" "\nEncrypted device name cannot be empty.\n\n$_TryAgain"
- elif [[ $pass == "" || "$pass" != "$pass2" ]]; then
- [[ $onlypass ]] || LUKS_NAME="$name"
- infobox "$_ErrTitle" "$_PassErr\n$_TryAgain"
+ if [[ ! $op && $n == "" ]]; then
+ infobox "Name Empty" "\nEncrypted device name cannot be empty.\n\nPlease try again.\n"
+ elif [[ $p == "" || "$p" != "$p2" ]]; then
+ [[ $op ]] || LUKS_NAME="$n"
+ infobox "Password Mismatch" "\nThe passwords entered do not match.\n\nPlease try again.\n"
else
- [[ $onlypass ]] || LUKS_NAME="$name"
- LUKS_PASS="$pass"
+ [[ $op ]] || LUKS_NAME="$n"
+ LUKS_PASS="$p"
break
fi
done
if luks_setup; then
tput cnorm
local cipher
- cipher="$(getinput "$_PrepLUKS" "$_LuksCipherKey" "-s 512 -c aes-xts-plain64" nolimit)"
+ cipher="$(getinput "LUKS Encryption" "$_LuksCipherKey" "-s 512 -c aes-xts-plain64" nolimit)"
[[ $cipher ]] || return 1
infobox "$_LuksEncryptAdv" "$_LuksCreateWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
cryptsetup -q $cipher luksFormat $LUKS_PART <<< "$LUKS_PASS" 2>$ERR
die()
{
(( $# >= 1 )) && exitcode=$1 || exitcode=0
-
trap - INT
tput cnorm
awk '/disk/ {print "/dev/" $1 " " $2}')"
fi
- [[ $SYS_DEVS ]] || { infobox "$_ErrTitle" "\nNo available devices...$_Exit\n"; die 1; }
+ [[ $SYS_DEVS ]] || { infobox "$_ErrTitle" "\nNo available devices...\n\nExiting..\n"; die 1; }
DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
}
system_checks()
{
if [[ $(whoami) != "root" ]]; then
- infobox "$_ErrTitle" "$_NotRoot\n$_Exit"
+ infobox "Not Root" "\nThis installer must be run as root or using sudo.\n\nExiting..\n"
die 1
elif ! grep -qw 'lm' /proc/cpuinfo; then
- infobox "$_ErrTitle" "$_Not64Bit\n$_Exit"
+ infobox "Not x86_64" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n"
die 1
fi
+
grep -q 'BCM4352' <<< "$(lspci -vnn -d 14e4:)" && load_bcm
- net_connect || { infobox "$_ErrTitle" "$_NoNetwork\n$_Exit"; die 1; }
+
+ if ! net_connect; then
+ infobox "Not Connected" "\nThis installer requires an active internet connection.\n\nExiting..\n"
+ die 1
+ fi
}
prechecks()
{
if [[ $1 -ge 0 ]] && ! [[ $(lsblk -lno MOUNTPOINT) =~ $MNT ]]; then
- infobox "$_ErrTitle" "$_ErrNoMount"; SEL=4; return 1
+ infobox "Not Mounted" "\nPartition(s) must be mounted first.\n"; SEL=4; return 1
elif [[ $1 -ge 1 && ($NEWUSER == "" || $USER_PASS == "") ]]; then
- infobox "$_ErrTitle" "\nYou need to create a user first.\n"; SEL=5; return 1
+ infobox "No User" "\nA user must be created first.\n"; SEL=5; return 1
elif [[ $1 -ge 2 && $CONFIG_DONE != true ]]; then
- infobox "$_ErrTitle" "$_ErrNoConfig"; SEL=6; return 1
+ infobox "Not Configured" "\nSystem configuration must be done first.\n"; SEL=6; return 1
fi
return 0