Add menu function to simplify things
This commit is contained in:
parent
b122c92e2e
commit
fdd77684a0
@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
# shellcheck disable=2154,2034
|
# shellcheck disable=2154,2034,2153
|
||||||
|
|
||||||
# globals {
|
# globals {
|
||||||
|
|
||||||
# immutable values
|
# immutable values
|
||||||
readonly VER="1.7.15" # Installer version
|
readonly VER="1.7.17" # Installer version
|
||||||
readonly DIST="ArchLabs" # Linux distributor
|
readonly DIST="ArchLabs" # Linux distributor
|
||||||
readonly MNT="/mnt/install" # Install mountpoint
|
readonly MNT="/mnt/install" # Install mountpoint
|
||||||
readonly ERR="/tmp/errlog" # Built-in error log
|
readonly ERR="/tmp/errlog" # Built-in error log
|
||||||
@ -53,8 +53,8 @@ declare -g MKINIT_HOOKS="shutdown"
|
|||||||
select_language() {
|
select_language() {
|
||||||
tput civis
|
tput civis
|
||||||
local lang
|
local lang
|
||||||
lang=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " Select Language " --menu \
|
local title="\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n"
|
||||||
"\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n" 0 0 0 \
|
lang=$(menubox "Select Language" "$title" 0 0 0 \
|
||||||
"1" "English (en_**)" "2" "Español (es_ES)" \
|
"1" "English (en_**)" "2" "Español (es_ES)" \
|
||||||
"3" "Português [Brasil] (pt_BR)" "4" "Português (pt_PT)" \
|
"3" "Português [Brasil] (pt_BR)" "4" "Português (pt_PT)" \
|
||||||
"5" "Français (fr_FR)" "6" "Russkiy (ru_RU)" \
|
"5" "Français (fr_FR)" "6" "Russkiy (ru_RU)" \
|
||||||
@ -62,7 +62,6 @@ select_language() {
|
|||||||
"9" "Magyar (hu_HU)" "10" "Chinese (zh_CN)")
|
"9" "Magyar (hu_HU)" "10" "Chinese (zh_CN)")
|
||||||
|
|
||||||
local srcdir="/usr/share/archlabs/installer/lang"
|
local srcdir="/usr/share/archlabs/installer/lang"
|
||||||
|
|
||||||
src $srcdir/english.trans
|
src $srcdir/english.trans
|
||||||
FONT="ter-i16n"
|
FONT="ter-i16n"
|
||||||
|
|
||||||
@ -81,7 +80,6 @@ select_language() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen
|
sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen
|
||||||
|
|
||||||
if [[ $LOC != "en_US.UTF-8" ]]; then
|
if [[ $LOC != "en_US.UTF-8" ]]; then
|
||||||
sed -i "s/#${LOC}/${LOC}/" /etc/locale.gen
|
sed -i "s/#${LOC}/${LOC}/" /etc/locale.gen
|
||||||
locale-gen >/dev/null 2>&1
|
locale-gen >/dev/null 2>&1
|
||||||
@ -159,8 +157,7 @@ user="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
|||||||
|
|
||||||
select_keymap() {
|
select_keymap() {
|
||||||
tput civis
|
tput civis
|
||||||
if ! KEYMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! KEYMAP="$(menubox "$_PrepLayout" "$_XMapBody" 20 70 12 \
|
||||||
--title " $_PrepLayout " --menu "$_XMapBody" 20 70 12 \
|
|
||||||
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
|
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
|
||||||
'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \
|
'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \
|
||||||
'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \
|
'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \
|
||||||
@ -185,11 +182,10 @@ select_keymap() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# when a matching console map is not available open a selection dialog
|
# when a matching console map is not available open a selection dialog
|
||||||
# shellcheck disable=SC2153
|
|
||||||
if [[ $CMAPS == *"$KEYMAP"* ]]; then
|
if [[ $CMAPS == *"$KEYMAP"* ]]; then
|
||||||
CMAP="$KEYMAP"
|
CMAP="$KEYMAP"
|
||||||
else
|
else
|
||||||
if ! CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_CMapTitle " --menu "$_CMapBody" 20 70 12 $CMAPS)"; then
|
if ! CMAP="$(menubox "$_CMapTitle" "$_CMapBody" 20 70 12 $CMAPS)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -211,15 +207,13 @@ select_timezone() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
if ! ZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! ZONE="$(menubox "$_TimeZTitle" "$_TimeZBody" 20 70 10 \
|
||||||
--title " $_TimeZTitle " --menu "$_TimeZBody" 20 70 10 \
|
|
||||||
'America' '-' 'Australia' '-' 'Asia' '-' 'Atlantic' '-' 'Africa' '-' \
|
'America' '-' 'Australia' '-' 'Asia' '-' 'Atlantic' '-' 'Africa' '-' \
|
||||||
'Europe' '-' 'Indian' '-' 'Pacific' '-' 'Arctic' '-' 'Antarctica' '-')"; then
|
'Europe' '-' 'Indian' '-' 'Pacific' '-' 'Arctic' '-' 'Antarctica' '-')"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! SUBZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! SUBZONE="$(menubox "$_TimeZTitle" "$_TimeSubZBody" 20 70 12 ${SUBZONES[$ZONE]})"; then
|
||||||
--title " $_TimeZTitle " --menu "$_TimeSubZBody" 20 70 12 ${SUBZONES[$ZONE]})"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -272,8 +266,7 @@ select_wm_or_de() {
|
|||||||
if [[ $WM_NUM -eq 1 ]]; then
|
if [[ $WM_NUM -eq 1 ]]; then
|
||||||
LOGIN_WM="$INSTALL_WMS"
|
LOGIN_WM="$INSTALL_WMS"
|
||||||
else
|
else
|
||||||
if ! LOGIN_WM="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
|
if ! LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"; then
|
||||||
--title " $_WMLogin " --menu "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -298,8 +291,7 @@ select_wm_or_de() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
select_login_method() {
|
select_login_method() {
|
||||||
if ! LOGIN_TYPE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" 0 0 0 \
|
||||||
--title " $_WMLogin " --menu "$_LoginTypeBody" 0 0 0 \
|
|
||||||
"xinit" "Console login without a display manager" \
|
"xinit" "Console login without a display manager" \
|
||||||
"lightdm" "Lightweight display manager with a gtk greeter")"; then
|
"lightdm" "Lightweight display manager with a gtk greeter")"; then
|
||||||
return 1
|
return 1
|
||||||
@ -505,24 +497,21 @@ configure_system_settings() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
# shellcheck disable=SC2153
|
if ! LOCALE="$(menubox "$_ConfLocale" "$_LocaleBody" 25 70 20 $LOCALES)"; then
|
||||||
if ! LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
|
||||||
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
select_timezone || return 1
|
select_timezone || return 1
|
||||||
user_creation || return 1
|
user_creation || return 1
|
||||||
|
|
||||||
if ! MYSHELL="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
tput civis
|
||||||
--title " $_ShellTitle " --menu "$_ShellBody" 0 0 0 '/bin/zsh' '-' '/bin/bash' '-')"; then
|
if ! MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" 0 0 0 '/bin/zsh' '-' '/bin/bash' '-')"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
if [[ $HAS_NETWORK == true ]]; then
|
if [[ $HAS_NETWORK == true ]]; then
|
||||||
if ! KERNEL="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then
|
||||||
--title " $_KernelTitle " --menu "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -606,8 +595,8 @@ main() {
|
|||||||
# if trying to install the system, make sure the partitions are mounted
|
# if trying to install the system, make sure the partitions are mounted
|
||||||
# and that the needed config variables and user variables have been set up
|
# and that the needed config variables and user variables have been set up
|
||||||
if [[ $SELECTED ]]; then
|
if [[ $SELECTED ]]; then
|
||||||
if [[ $SELECTED -eq 8 ]]; then
|
if [[ $SELECTED -eq 8 || $SELECTED -eq 6 ]]; then
|
||||||
icheck || return 1
|
{ [[ $SELECTED -eq 8 ]] && icheck 1 || icheck; } || return 1
|
||||||
elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then
|
elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then
|
||||||
msgbox "$_PrepTitle" "$_WarnMount" && WARN=true
|
msgbox "$_PrepTitle" "$_WarnMount" && WARN=true
|
||||||
fi
|
fi
|
||||||
|
@ -194,7 +194,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# automatic startx for login shells
|
# automatic startx for login shells
|
||||||
[[ $MYSHELL == '/bin/bash' ]] && local loginrc=".bash_profile" || local loginrc=".zprofile"
|
[[ $MYSHELL == '/bin/bash' ]] && local loginrc=".profile" || local loginrc=".zprofile"
|
||||||
EDIT_FILES[11]+="/home/$NEWUSER/$loginrc"
|
EDIT_FILES[11]+="/home/$NEWUSER/$loginrc"
|
||||||
|
|
||||||
cat >> $MNT/home/$NEWUSER/$loginrc << EOF
|
cat >> $MNT/home/$NEWUSER/$loginrc << EOF
|
||||||
@ -202,7 +202,7 @@ EOF
|
|||||||
# sourced by $(basename $MYSHELL) when used as a login shell
|
# sourced by $(basename $MYSHELL) when used as a login shell
|
||||||
|
|
||||||
# automatically run startx when logging in on tty1
|
# automatically run startx when logging in on tty1
|
||||||
if [ -n "\$DISPLAY" ] && [ \$XDG_VTNR -eq 1 ]; then
|
if [ -z "\$DISPLAY" ] && [ \$XDG_VTNR -eq 1 ]; then
|
||||||
exec startx -- vt1 >/dev/null 2>&1
|
exec startx -- vt1 >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
|
@ -19,7 +19,7 @@ declare -g LUKS_NAME="cryptroot"
|
|||||||
luks_open() {
|
luks_open() {
|
||||||
LUKS_PART=""
|
LUKS_PART=""
|
||||||
modprobe -a dm-mod dm_crypt
|
modprobe -a dm-mod dm_crypt
|
||||||
unmount_install_partitions
|
umount_dir $MNT
|
||||||
find_partitions 'part|crypt|lvm' || return 1
|
find_partitions 'part|crypt|lvm' || return 1
|
||||||
tput civis
|
tput civis
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ luks_open() {
|
|||||||
infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1
|
infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1
|
||||||
else
|
else
|
||||||
tput civis
|
tput civis
|
||||||
if ! LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 0 $PARTS)"; then
|
if ! LUKS_PART="$(menubox "$_LuksOpen" "$_LuksMenuBody" 0 0 0 $PARTS)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -90,7 +90,7 @@ luks_pass() {
|
|||||||
luks_setup() {
|
luks_setup() {
|
||||||
LUKS_PART=""
|
LUKS_PART=""
|
||||||
modprobe -a dm-mod dm_crypt
|
modprobe -a dm-mod dm_crypt
|
||||||
unmount_install_partitions
|
umount_dir $MNT
|
||||||
|
|
||||||
if [[ ! $ROOT_PART || $LVM ]]; then
|
if [[ ! $ROOT_PART || $LVM ]]; then
|
||||||
find_partitions 'part|lvm' || return 1
|
find_partitions 'part|lvm' || return 1
|
||||||
@ -101,7 +101,7 @@ luks_setup() {
|
|||||||
infobox "$_LuksEncrypt" "${_OnlyOne}: $LUKS_PART\n" 1
|
infobox "$_LuksEncrypt" "${_OnlyOne}: $LUKS_PART\n" 1
|
||||||
else
|
else
|
||||||
tput civis
|
tput civis
|
||||||
if ! LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LuksEncrypt " --menu "$_LuksEncryptBody" 0 0 0 $PARTS)"; then
|
if ! LUKS_PART="$(menubox "$_LuksEncrypt" "$_LuksEncryptBody" 0 0 0 $PARTS)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -161,8 +161,7 @@ luks_show() {
|
|||||||
luks_menu() {
|
luks_menu() {
|
||||||
tput civis
|
tput civis
|
||||||
local choice
|
local choice
|
||||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepLUKS " \
|
choice="$(menubox "$_PrepLUKS" "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 0 \
|
||||||
--menu "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 0 \
|
|
||||||
"$_LuksEncrypt" "cryptsetup -q luksFormat" \
|
"$_LuksEncrypt" "cryptsetup -q luksFormat" \
|
||||||
"$_LuksOpen" "cryptsetup open --type luks" \
|
"$_LuksOpen" "cryptsetup open --type luks" \
|
||||||
"$_LuksEncryptAdv" "cryptsetup -q -s -c luksFormat" \
|
"$_LuksEncryptAdv" "cryptsetup -q -s -c luksFormat" \
|
||||||
|
@ -43,7 +43,7 @@ lvm_show_vg() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
if ! DEL_VG="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepLVM " --menu "$_LvmSelVGBody" 18 70 10 $VOL_GROUP_LIST)"; then
|
if ! DEL_VG="$(menubox "$_PrepLVM" "$_LvmSelVGBody" 18 70 10 $VOL_GROUP_LIST)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@ -208,7 +208,7 @@ lvm_create() {
|
|||||||
VOLUME_GROUP=""
|
VOLUME_GROUP=""
|
||||||
GROUP_PARTS=""
|
GROUP_PARTS=""
|
||||||
VOL_GROUP_MB=0
|
VOL_GROUP_MB=0
|
||||||
unmount_install_partitions
|
umount_dir $MNT
|
||||||
|
|
||||||
if [[ $LUKS && $LUKS_NAME ]]; then
|
if [[ $LUKS && $LUKS_NAME ]]; then
|
||||||
GROUP_PARTS="/dev/mapper/$LUKS_NAME"
|
GROUP_PARTS="/dev/mapper/$LUKS_NAME"
|
||||||
@ -264,8 +264,7 @@ lvm_menu() {
|
|||||||
tput civis
|
tput civis
|
||||||
|
|
||||||
local choice
|
local choice
|
||||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
choice="$(menubox "$_PrepLVM" "$_LvmMenu" 0 0 0 \
|
||||||
--title " $_PrepLVM " --menu "$_LvmMenu" 0 0 0 \
|
|
||||||
"$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
|
"$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
|
||||||
"$_LvmDelVG" "vgremove -f" \
|
"$_LvmDelVG" "vgremove -f" \
|
||||||
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
|
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
|
||||||
|
@ -17,7 +17,7 @@ readonly CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.m
|
|||||||
mount_install_partitions() {
|
mount_install_partitions() {
|
||||||
# prepare partition list PARTS for dialog
|
# prepare partition list PARTS for dialog
|
||||||
lvm_detect
|
lvm_detect
|
||||||
unmount_install_partitions
|
umount_dir $MNT
|
||||||
find_partitions 'part|lvm|crypt' || return 1
|
find_partitions 'part|lvm|crypt' || return 1
|
||||||
|
|
||||||
# remove boot partition from dialog list if we auto partitioned one
|
# remove boot partition from dialog list if we auto partitioned one
|
||||||
@ -43,8 +43,8 @@ mount_install_partitions() {
|
|||||||
select_swap() {
|
select_swap() {
|
||||||
# Ask user to select partition or create swapfile
|
# Ask user to select partition or create swapfile
|
||||||
tput civis
|
tput civis
|
||||||
if ! SWAP_PART="$(dialog --backtitle "$BT" --cr-wrap --stdout --title " $_SelSwpSetup " \
|
if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" 0 0 0 \
|
||||||
--menu "$_SelSwpBody" 0 0 0 "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)" || [[ $SWAP_PART == "$_SelSwpNone" ]]; then
|
"$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)" || [[ $SWAP_PART == "$_SelSwpNone" ]]; then
|
||||||
SWAP_PART=""; return 0
|
SWAP_PART=""; return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -88,8 +88,7 @@ select_mountpoint() {
|
|||||||
select_boot_setup() {
|
select_boot_setup() {
|
||||||
# choose bootloader and mountpoint (if needed)
|
# choose bootloader and mountpoint (if needed)
|
||||||
tput civis
|
tput civis
|
||||||
if ! BOOTLDR="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" 0 0 0 ${BOOTLDRS[$SYS]})"; then
|
||||||
--title " $_PrepMount " --menu "$_MntBootBody" 0 0 0 ${BOOTLDRS[$SYS]})"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -103,8 +102,7 @@ select_boot_setup() {
|
|||||||
elif [[ $BOOTLDR == 'syslinux' ]]; then
|
elif [[ $BOOTLDR == 'syslinux' ]]; then
|
||||||
if [[ $SYS == 'BIOS' ]]; then
|
if [[ $SYS == 'BIOS' ]]; then
|
||||||
FILES[9]="/boot/syslinux/syslinux.cfg"
|
FILES[9]="/boot/syslinux/syslinux.cfg"
|
||||||
if ! BCMDS[$BOOTLDR]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! BCMDS[$BOOTLDR]="$(menubox "$_InstSysTitle" "$_InstSysBody" 0 0 0 \
|
||||||
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
|
|
||||||
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
|
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
|
||||||
"syslinux-install_update -i" "Install to root partition (/)")"; then
|
"syslinux-install_update -i" "Install to root partition (/)")"; then
|
||||||
return 1
|
return 1
|
||||||
@ -157,14 +155,13 @@ select_mount_opts() {
|
|||||||
|
|
||||||
select_filesystem() {
|
select_filesystem() {
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local cur_fs str
|
local fs cur_fs str title
|
||||||
cur_fs="$(lsblk -lno FSTYPE $part)"
|
cur_fs="$(lsblk -lno FSTYPE $part)"
|
||||||
str="$([[ $cur_fs && $part != "$ROOT_PART" ]] && printf "\nExisting Filesystem: %s" "$cur_fs")"
|
str="$([[ $cur_fs && $part != "$ROOT_PART" ]] && printf "\nExisting Filesystem: %s" "$cur_fs")"
|
||||||
tput civis
|
tput civis
|
||||||
|
|
||||||
local fs
|
title="\nSelect which filesystem you want to use for $part\n\nPartition Name: "
|
||||||
fs="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part " \
|
fs="$(menubox "$_FSTitle: $part" "${title}${part}${str}$_FSBody" 0 0 0 \
|
||||||
--menu "\nSelect which filesystem you want to use for $part\n\nPartition Name: ${part}${str}$_FSBody" 0 0 0 \
|
|
||||||
$([[ $cur_fs && $part != "$ROOT_PART" ]] && printf "%s" "$_Skip -") \
|
$([[ $cur_fs && $part != "$ROOT_PART" ]] && printf "%s" "$_Skip -") \
|
||||||
"ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \
|
"ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \
|
||||||
"ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \
|
"ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \
|
||||||
@ -187,8 +184,7 @@ select_efi_partition() {
|
|||||||
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
||||||
infobox "$_PrepMount" "$_OnlyOne for EFI: $BOOT_PART\n" 1
|
infobox "$_PrepMount" "$_OnlyOne for EFI: $BOOT_PART\n" 1
|
||||||
else
|
else
|
||||||
if ! BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! BOOT_PART="$(menubox "$_PrepMount" "$_SelUefiBody" 0 0 0 $PARTS)"; then
|
||||||
--title " $_PrepMount " --menu "$_SelUefiBody" 0 0 0 $PARTS)"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -205,14 +201,12 @@ select_efi_partition() {
|
|||||||
|
|
||||||
select_boot_partition() {
|
select_boot_partition() {
|
||||||
tput civis
|
tput civis
|
||||||
if ! BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepMount " \
|
if ! BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)" || [[ $BOOT_PART == "$_Skip" ]]; then
|
||||||
--menu "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)" || [[ $BOOT_PART == "$_Skip" ]]; then
|
|
||||||
BOOT_PART=""
|
BOOT_PART=""
|
||||||
else
|
else
|
||||||
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
|
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
|
||||||
local msg="$_FormBiosBody $BOOT_PART $_FormUefiBody2"
|
local msg="$_FormBiosBody $BOOT_PART $_FormUefiBody2"
|
||||||
yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Skip Formatting" "no" &&
|
yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Skip Formatting" "no" && format "$BOOT_PART" "ext4"
|
||||||
format "$BOOT_PART" "ext4"
|
|
||||||
else
|
else
|
||||||
format "$BOOT_PART" "ext4"
|
format "$BOOT_PART" "ext4"
|
||||||
fi
|
fi
|
||||||
@ -236,8 +230,7 @@ select_root_partition() {
|
|||||||
infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1
|
infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1
|
||||||
elif [[ ! $ROOT_PART || $LVM ]]; then
|
elif [[ ! $ROOT_PART || $LVM ]]; then
|
||||||
tput civis
|
tput civis
|
||||||
if ! ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! ROOT_PART="$(menubox "$_PrepMount" "$_SelRootBody" 0 0 0 $PARTS)"; then
|
||||||
--title " $_PrepMount " --menu "$_SelRootBody" 0 0 0 $PARTS)"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -254,8 +247,7 @@ select_extra_partitions() {
|
|||||||
while (( COUNT > 0 )); do
|
while (( COUNT > 0 )); do
|
||||||
tput civis
|
tput civis
|
||||||
local part
|
local part
|
||||||
if ! part="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepMount " \
|
if ! part="$(menubox "$_PrepMount " "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)" || [[ $part == "$_Done" ]]; then
|
||||||
--menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)" || [[ $part == "$_Done" ]]; then
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -41,8 +41,7 @@ partition() {
|
|||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
local choice
|
local choice
|
||||||
if ! choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
|
if ! choice="$(menubox "$_PartTitle" "$_PartBody" 0 0 0 "$_PartShowTree" "-" "$_PartAuto" "-" \
|
||||||
--menu "$_PartBody" 0 0 0 "$_PartShowTree" "-" "$_PartAuto" "-" \
|
|
||||||
$({ [[ $DISPLAY ]] && hash gparted >/dev/null 2>&1; } && printf "gparted -") \
|
$({ [[ $DISPLAY ]] && hash gparted >/dev/null 2>&1; } && printf "gparted -") \
|
||||||
"cfdisk" "-" "parted" "-" "$_PartWipe" "-")"; then
|
"cfdisk" "-" "parted" "-" "$_PartWipe" "-")"; then
|
||||||
return 1
|
return 1
|
||||||
@ -103,7 +102,7 @@ device_tree() {
|
|||||||
select_device() {
|
select_device() {
|
||||||
local dev
|
local dev
|
||||||
local msg
|
local msg
|
||||||
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || unmount_install_partitions
|
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || umount_dir $MNT
|
||||||
|
|
||||||
if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then
|
if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then
|
||||||
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
|
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
|
||||||
@ -111,8 +110,7 @@ select_device() {
|
|||||||
infobox "$_DevSelTitle" "$msg $DEVICE\n" 1
|
infobox "$_DevSelTitle" "$msg $DEVICE\n" 1
|
||||||
elif (( DEV_COUNT > 1 )); then
|
elif (( DEV_COUNT > 1 )); then
|
||||||
tput civis
|
tput civis
|
||||||
if ! DEVICE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_DevSelTitle " \
|
if ! DEVICE="$(menubox "$_DevSelTitle " "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"; then
|
||||||
--menu "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then
|
elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then
|
||||||
|
@ -34,7 +34,7 @@ die() {
|
|||||||
tput cnorm
|
tput cnorm
|
||||||
if [[ -d $MNT ]] && cd; then
|
if [[ -d $MNT ]] && cd; then
|
||||||
fuser -km $MNT
|
fuser -km $MNT
|
||||||
unmount_install_partitions
|
umount_dir $MNT
|
||||||
|
|
||||||
if [[ $exitcode -eq 127 ]]; then
|
if [[ $exitcode -eq 127 ]]; then
|
||||||
fuser -km /run/archiso/bootmnt
|
fuser -km /run/archiso/bootmnt
|
||||||
@ -55,6 +55,19 @@ msgbox() {
|
|||||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --msgbox "$2\n" 0 0
|
dialog --cr-wrap --backtitle "$BT" --title " $1 " --msgbox "$2\n" 0 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menubox() {
|
||||||
|
local title="$1"
|
||||||
|
local body="$2"
|
||||||
|
local h=$3
|
||||||
|
local w=$4
|
||||||
|
local n=$5
|
||||||
|
shift 5
|
||||||
|
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --menu "$body" $h $w $n "$@")"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
printf "%s\n" "$response"
|
||||||
|
}
|
||||||
|
|
||||||
oneshot() {
|
oneshot() {
|
||||||
[[ -e /tmp/.ai_$1 || ! $(type $1) ]] && return 0
|
[[ -e /tmp/.ai_$1 || ! $(type $1) ]] && return 0
|
||||||
$1 || return 1
|
$1 || return 1
|
||||||
@ -64,8 +77,7 @@ oneshot() {
|
|||||||
|
|
||||||
getinput() {
|
getinput() {
|
||||||
local answer
|
local answer
|
||||||
if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel \
|
if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then
|
||||||
--backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
printf "%s" "$answer"
|
printf "%s" "$answer"
|
||||||
@ -188,7 +200,9 @@ echeck() {
|
|||||||
|
|
||||||
icheck() {
|
icheck() {
|
||||||
[[ $(lsblk -o MOUNTPOINT) =~ $MNT ]] || { msgbox "$_ErrTitle" "$_ErrNoMount"; export SELECTED=4; return 1; }
|
[[ $(lsblk -o MOUNTPOINT) =~ $MNT ]] || { msgbox "$_ErrTitle" "$_ErrNoMount"; export SELECTED=4; return 1; }
|
||||||
[[ $CONFIG_DONE == true ]] || { msgbox "$_ErrTitle" "$_ErrNoConfig"; export SELECTED=5; return 1; }
|
if [[ $# -eq 1 ]]; then
|
||||||
|
[[ $CONFIG_DONE == true ]] || { msgbox "$_ErrTitle" "$_ErrNoConfig"; export SELECTED=5; return 1; }
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,8 +235,8 @@ debug() {
|
|||||||
export DEBUG=true
|
export DEBUG=true
|
||||||
}
|
}
|
||||||
|
|
||||||
unmount_install_partitions() {
|
umount_dir() {
|
||||||
swapoff -a
|
swapoff -a
|
||||||
[[ -d $MNT ]] && umount -R $MNT >/dev/null 2>&1
|
[[ -d $1 ]] && umount -R $1 >/dev/null 2>&1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user