From 2c136e1a47b0b295e86bd34e28cac8aa3e6b6894 Mon Sep 17 00:00:00 2001 From: natemaia Date: Mon, 17 Dec 2018 00:57:44 -0800 Subject: [PATCH] Fix: lvm. New: erroshow(), select wm/de seperately. Change: use dialog --no-cancel --- lang/chinese.trans | 3 +- lang/dutch.trans | 3 +- lang/english.trans | 9 ++-- lang/french.trans | 3 +- lang/hungarian.trans | 3 +- lang/italian.trans | 3 +- lang/p_brasil.trans | 3 +- lang/portuguese.trans | 3 +- lang/russian.trans | 3 +- lang/spanish.trans | 3 +- src/archlabs-installer | 61 +++++++++++++++++++------- src/lib/boot.sh | 28 ++---------- src/lib/dialogs.sh | 19 ++++++--- src/lib/luks.sh | 97 +++++++++++++++++++++--------------------- src/lib/lvm.sh | 21 +++++---- src/lib/mount.sh | 63 ++++++++------------------- src/lib/part.sh | 86 ++++++++++++++++++++++++++----------- src/lib/utils.sh | 26 ++++++++--- 18 files changed, 246 insertions(+), 191 deletions(-) diff --git a/lang/chinese.trans b/lang/chinese.trans index 6aec2e6..76989fd 100644 --- a/lang/chinese.trans +++ b/lang/chinese.trans @@ -141,7 +141,8 @@ _LuksEncryptAdv="定义密钥大小和密码" _LuksEncryptBody="选择要加密的分区." _LuksEncryptSucc="\n完成!加密分区已经打开并准备进行挂载.\n" _LuksPartErrBody="\n加密需要至少两个分区:\n\n1.根分区(/)-标准或lvm分区类型.\n\n2. 引导分区(/boot或/boot/efi) - 仅限于标准分区类型(使用BIOS时除外lvm)." -_LuksWaitBody="\n创建加密分区:" +_LuksOpenWaitBody="\n创建加密分区:" +_LuksCreateWaitBody="\n创建加密分区:" _LuksWaitBody2="\n\n设备或卷已经被使用:" _LuksCipherKey="一旦修改了指定标志,它们将自动与'cryptsetup -q luksFormat/dev/ ...'命令一起使用。\n\n注意:密钥文件不受支持; 他们可以在安装后手动添加。 不要指定任何其他标志,例如-v(--verbose)或-y(--verify-passphrase)." diff --git a/lang/dutch.trans b/lang/dutch.trans index 53dadc1..6cdb863 100644 --- a/lang/dutch.trans +++ b/lang/dutch.trans @@ -58,7 +58,8 @@ _LuksEncryptAdv="Bepaal de sleutelgrootte en Cypher" _LuksEncryptBody="\nSelecteer een partitie om te versleutelen." _LuksEncryptSucc="\nKlaar! Geopend en klaar voor LVM (aanbevolen) of rechtstreekse aankoppeling.\n" _LuksPartErrBody="\nEr zijn minimum twee partities nodig om te kunnen versleutelen:\n\n1. Root (/) - standaard-of LVM partitie-types.\n\n2. Boot (/boot of /boot/efi) - alleen standaard partitietypes (behalve LVM waar men BIOS Grub gebruikt).\n" -_LuksWaitBody="\nAanmaken van een versleutelde Root partitie:" +_LuksOpenWaitBody="\nAanmaken van een versleutelde Root partitie:" +_LuksCreateWaitBody="\nAanmaken van een versleutelde Root partitie:" _LuksWaitBody2="Gebruikt opslagmedium of volume:" _LuksCipherKey="\nZodra de opgegeven vlaggen zijn gewijzigd, zullen ze automatisch worden gebruikt met de opdracht 'cryptsetup q luksFormat/dev/...'\n\nOpmerking: Sleutelbestanden worden niet ondersteund; ze kunnen na de installatie handmatig worden toegevoegd. Geef geen extra vlaggen op, zoals -v (--verbose) of -y (--verify-passphrase).\n" diff --git a/lang/english.trans b/lang/english.trans index 94aed38..d0e7967 100644 --- a/lang/english.trans +++ b/lang/english.trans @@ -77,9 +77,9 @@ _PackageBody="\nUse [Space] to (de)select packages(s) to install from the list b # login setup _WMLogin="Select Login Managment" -_LoginTypeBody="\nSelect how you want to log in, using a display manager or xinit." -_WMLoginBody="\nSelect which window manager or desktop to use as your primary login.\n\nThis can be changed by editing your ~/.xinitrc" -_AutoLoginBody="\nDo you want autologin and auto-startx enabled for your user?" +_LoginTypeBody="\nSelect which login managment to use." +_AutoLoginBody="\nDo you want auto login+startx enabled?" +_WMLoginBody="\nSelect which to use as your primary login session.\n\nThis can be changed by editing your ~/.xinitrc" # Set keymap, hwclock, local and timezone _CMapTitle="Virtual Console Keymap" @@ -170,7 +170,8 @@ _LuksEncryptAdv="Define Key-Size and Cypher" _LuksEncryptBody="\nSelect the partition you want to encrypt." _LuksEncryptSucc="\nDone! encrypted partition opened and ready for mounting.\n" _LuksPartErrBody="\nA minimum of two partitions are required for encryption:\n\n1. Root (/) - standard or LVM.\n\n2. Boot (/boot or /boot/efi) - standard (except for LVM on BIOS systems)." -_LuksWaitBody="\nCreating/Opening encrypted partition:" +_LuksCreateWaitBody="\nCreating encrypted partition:" +_LuksOpenWaitBody="\nOpening encrypted partition:" _LuksWaitBody2="\n\nDevice or volume used:" _LuksCipherKey="Once the specified flags have been amended, they will automatically be used with the 'cryptsetup -q luksFormat /dev/...' command.\n\nNOTE: Do not specify any additional flags such as -v (--verbose) or -y (--verify-passphrase)." diff --git a/lang/french.trans b/lang/french.trans index 7ba9dda..fc746da 100644 --- a/lang/french.trans +++ b/lang/french.trans @@ -53,7 +53,8 @@ _LuksEncryptAdv="Définir le cryptage et la longueur de clé" _LuksEncryptBody="\nSélectionner une partition à crypter." _LuksEncryptSucc="\nTerminé ! Ouvert et prêt pour LVM (recommandé) ou montage direct.\n" _LuksPartErrBody="\nUn minimum de deux partitions est nécessaire pour le cryptage :\n\n1. Root (/) - partition standard ou lvm.\n\n2. Boot (/boot ou /boot/efi) - partition standard uniquement (excepté lvm utilisant BIOS Grub).\n" -_LuksWaitBody="\nCréation d'une partition Root crypté :" +_LuksCreateWaitBody="\nCréation d'une partition Root crypté :" +_LuksOpenWaitBody="\nCréation d'une partition Root crypté :" _LuksWaitBody2="Périphérique ou volume utilisé :" _LuksCipherKey="\nDès que les drapeaux spécifiés sont modifiés, ils peuvent être automatiquement utilisés avec la commande 'cryptsetup -q luksFormat /dev/...'.\n\nNOTE : Les fichiers de clé ne sont pas supportés ; Ils peuvent être ajoutés manuellement après l'installation. Ne spécifier aucuns drapeaux additionnels du genre -v (--verbose) ou -y (verify-passphrase).\n" diff --git a/lang/hungarian.trans b/lang/hungarian.trans index 9f53063..f24bb07 100644 --- a/lang/hungarian.trans +++ b/lang/hungarian.trans @@ -53,7 +53,8 @@ _LuksEncryptAdv="Határozd meg a kulcs méretét és a rejtjelezés típusát" _LuksEncryptBody="\nVálaszd ki a titkosítandó partíciót." _LuksEncryptSucc="\nKész! Kinyílt, és kész az LVM (ajánlott) vagy direkt csatolásra.\n" _LuksPartErrBody="\nMinimum kettő partícióra van szükség a titkosításhoz:\n\n1. Root (/) - normál vagy lvm partíció.\n\n2. Boot (/boot or /boot/efi) - csak normál partíció (kivéve lvm-nél ha BIOS Grub-ot használsz).\n" -_LuksWaitBody="\nTitkosított gyökér partíció létrehozása:" +_LuksOpenWaitBody="\nTitkosított gyökér partíció létrehozása:" +_LuksCreateWaitBody="\nTitkosított gyökér partíció létrehozása:" _LuksWaitBody2="Használt eszköz vagy kötet:" _LuksCipherKey="\nHa a megadott zászlókat módosítod, ezt automatikusan használva lesz a 'cryptsetup -q luksFormat /dev/...' parancssal.\n\nMegjegyzés: Kulcs fájlok nem támogatottak; ezeket manuálisan kell hozzáadni telepítés után. Ne add meg a további zászlókat, mint a -v (--verbose) vagy -y (--verify-passphrase).\n" diff --git a/lang/italian.trans b/lang/italian.trans index a81c5f2..04e0ac9 100644 --- a/lang/italian.trans +++ b/lang/italian.trans @@ -53,7 +53,8 @@ _LuksEncryptAdv="impostare lunghezza chiave e algoritmo di cifratura" _LuksEncryptBody="\nSelezionare una partizione da crittografare." _LuksEncryptSucc="\nFatto! Aerta e pronta per LVM (raccomandato) o montaggio diretto.\n" _LuksPartErrBody="\nDevono essere crittografate almeno due partizioni:\n\n1. Root (/) - ammesse partizioni standard o lvm.\n\n2. Boot (/boot or /boot/efi) - solo partizioni standard (o lvm con Grub su BIOS).\n" -_LuksWaitBody="\nCreazione partizione Root crittografata in corso:" +_LuksOpenWaitBody="\nCreazione partizione Root crittografata in corso:" +_LuksCreateWaitBody="\nCreazione partizione Root crittografata in corso:" _LuksWaitBody2="Volume o dispositivo in uso:" _LuksCipherKey="\nUna volte modificati i parametri, saranno automaticamente utilizzati per il comando 'cryptsetup -q luksFormat /dev/...' .\n\nNOTA: l'uso di key files non è supportato; potranno essere aggiunti manualmente al termine dell'installazione. Non specificare parametri addizionali come -v (--verbose) o -y (--verify-passphrase).\n" diff --git a/lang/p_brasil.trans b/lang/p_brasil.trans index a4bbc23..a6609a2 100644 --- a/lang/p_brasil.trans +++ b/lang/p_brasil.trans @@ -53,7 +53,8 @@ _LuksEncryptAdv="Defina o tamanho da chave e criptografia" _LuksEncryptBody="\nSelecione uma partição para criptografar." _LuksEncryptSucc="\nPronto! Aberto e pronto para o LVM (recomendado) ou montar diretamente.\n" _LuksPartErrBody="\nSão necessárias no mínimo duas partições para a criptografia:\n\n1. Root (/) - tipo de partição padrão ou lvm.\n\n2. Boot (/boot ou /boot/efi) - apenas o tipo de partição padrão (exceto LVM onde utiliza Grub BIOS).\n" -_LuksWaitBody="\nCriando partição Root criptografada:" +_LuksOpenWaitBody="\nCriando partição Root criptografada:" +_LuksCreateWaitBody="\nCriando partição Root criptografada:" _LuksWaitBody2="Dispositivo ou volume utilizado:" _LuksCipherKey="\nDepois de ter configurado as flags especifadas, elas serão usadas automaticamente com o comando 'cryptsetup -q luksFormat /dev/...'\n\nNOTA: Os arquivos de chave não são suportados, eles podem ser adicionados manualmente após a instalação. Não especifique quaisquer flags adicionais como -v (--verbose) ou -y (--verify-passphrase)./n" diff --git a/lang/portuguese.trans b/lang/portuguese.trans index 129be38..e034f75 100644 --- a/lang/portuguese.trans +++ b/lang/portuguese.trans @@ -53,7 +53,8 @@ _LuksEncryptAdv="Defina o Tamanho da Chave e Criptografia" _LuksEncryptBody="\nSeleccione uma partição para criptografar." _LuksEncryptSucc="\nPronto! Aberto e pronto para o LVM (recomendado) ou montar directamente.\n" _LuksPartErrBody="\nSão necessárias no mínimo duas partições para a criptografia:\n\n1. Root (/) - tipo de partição padrão ou lvm.\n\n2. Boot (/boot ou /boot/efi) - apenas o tipo de partição padrão (exceto LVM onde utiliza Grub BIOS).\n" -_LuksWaitBody="\nCriando partição Root criptografada:" +_LuksOpenWaitBody="\nCriando partição Root criptografada:" +_LuksCreateWaitBody="\nCriando partição Root criptografada:" _LuksWaitBody2="Dispositivo ou volume utilizado:" _LuksCipherKey="\nDepois de ter configurado as flags especificadas, elas serão usadas automaticamente com o comando 'cryptsetup -q luksFormat /dev/...'\n\nNOTA: Os arquivos de chave não são suportados, eles podem ser adicionados manualmente após a instalação. Não especifique quaisquer flags adicionais como -v (--verbose) ou -y (--verify-passphrase)./n" diff --git a/lang/russian.trans b/lang/russian.trans index e796aa3..6014290 100644 --- a/lang/russian.trans +++ b/lang/russian.trans @@ -53,7 +53,8 @@ _LuksEncryptAdv="Задать размер ключа и шифр" _LuksEncryptBody="\nВыберите раздел для шифрования." _LuksEncryptSucc="\nГотово! Откройте и настройте LVM (рекомендуется) или переходите к монтированию разделов.\n" _LuksPartErrBody="\nКак минимум два раздела требуется для шифрования:\n\n1. Корневой (/) - стандартный или lvm раздел.\n\n2. Загрузочный (/boot или /boot/efi) - только стандартный тип раздела (за исключением lvm, где используется BIOS Grub).\n" -_LuksWaitBody="\nСоздание зашифрованного корневого раздела:" +_LuksOpenWaitBody="\nСоздание зашифрованного корневого раздела:" +_LuksCreateWaitBody="\nСоздание зашифрованного корневого раздела:" _LuksWaitBody2="Используемые устройства или тома:" _LuksCipherKey="\nПосле того как указанные флаги будут изменены, они будут автоматически применены к команде 'cryptsetup -q luksFormat /dev/...'\n\nПРИМЕЧАНИЕ: Файлы ключей не поддерживаются; они могут быть добавлены вручную после установки. Не указывайте дополнительные флаги, такие как -v (--verbose) или -y (--verify-passphrase).\n" diff --git a/lang/spanish.trans b/lang/spanish.trans index 6738d2b..8d66359 100644 --- a/lang/spanish.trans +++ b/lang/spanish.trans @@ -53,7 +53,8 @@ _LuksEncryptAdv="Establecer cifrado y tamaño de la clave" _LuksEncryptBody="\nSeleccione una partición para encriptar." _LuksEncryptSucc="\n¡Listo! Abierto y listo para LVM (recomendado) o montaje directo.\n" _LuksPartErrBody="\nSe requiere un mínimo de dos particiones para la encriptación:\n\n1. Raíz (/) - tipos de partición estándar o LVM.\n\n2. Arranque (/boot o /boot/efi) - sólo tipos de partición estándar (excepto LVM cuando se utiliza Grub BIOS).\n" -_LuksWaitBody="\nCreando partición raíz encriptada:" +_LuksOpenWaitBody="\nCreando partición raíz encriptada:" +_LuksCreateWaitBody="\nCreando partición raíz encriptada:" _LuksWaitBody2="Dispositivo o volumen en uso:" _LuksCipherKey="\nUna vez que se hayan ajustado los flags especificados, se utilizarán de forma automática con el comando 'cryptsetup -q luksFormat /dev/...'\n\nNOTA: los archivos de claves no están soportados; se pueden añadir manualmente después de la instalación. No especifique flags adicionales tales como -v (--verbose) o -y (--verify-passphrase).\n" diff --git a/src/archlabs-installer b/src/archlabs-installer index 35226e3..698606b 100755 --- a/src/archlabs-installer +++ b/src/archlabs-installer @@ -10,7 +10,7 @@ # immutable globals -readonly VER="1.7.48" # Installer version +readonly VER="1.7.52" # Installer version readonly DIST="ArchLabs" # Linux distributor readonly MNT="/mnt" # Install mountpoint readonly ERR="/tmp/errlog" # Built-in error log @@ -25,8 +25,8 @@ main() elif [[ $CURRENT_MENU != "main" ]]; then SELECTED=1 CURRENT_MENU="main" - elif (( SELECTED < 9 )); then - ((SELECTED++)) # increment the highlighted menu item + elif (( SELECTED < 10 )); then + ((SELECTED++)) fi tput civis @@ -39,9 +39,10 @@ main() "4" "$_PrepLVM" \ "5" "$_PrepMount" \ "6" "$_PrepConfig" \ - "7" "Pick Packages" \ - "8" "Check Choices" \ - "9" "$_PrepInstall") + "7" "Select WM/DE(s)" \ + "8" "Select Packages" \ + "9" "Check Choices" \ + "10" "$_PrepInstall") if [[ $WARN != true && $SELECTED =~ (2|5) ]]; then WARN=true @@ -49,16 +50,44 @@ main() fi case $SELECTED in - 1) device_tree ;; - 2) partition || SELECTED=$((SELECTED - 1)) ;; - 3) luks_menu || SELECTED=$((SELECTED - 1)) ;; - 4) lvm_menu || SELECTED=$((SELECTED - 1)) ;; - 5) mnt_menu || SELECTED=$((SELECTED - 1)) ;; - 6) preinstall_checks && { cfg_menu || SELECTED=$((SELECTED - 1)); } ;; - 7) preinstall_checks 1 && { select_packages || SELECTED=$((SELECTED - 2)); } ;; - 8) preinstall_checks 1 && show_cfg ;; - 9) preinstall_checks 1 && install ;; - *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die + 1) + device_tree + ;; + 2) + partition || SELECTED=$((SELECTED - 1)) + ;; + 3) + luks_menu || SELECTED=$((SELECTED - 1)) + ;; + 4) + lvm_menu || SELECTED=$((SELECTED - 1)) + ;; + 5) + mnt_menu || SELECTED=$((SELECTED - 1)) + ;; + 6) + if preinstall_checks; then + cfg_menu || SELECTED=$((SELECTED - 1)) + fi + ;; + 7) + if preinstall_checks 1; then + select_wm_or_de || SELECTED=$((SELECTED - 1)) + fi + ;; + 8) + if preinstall_checks 1; then + select_packages || SELECTED=$((SELECTED - 1)) + fi + ;; + 9) + preinstall_checks 1 && show_cfg + ;; + 10) + preinstall_checks 1 && install + ;; + *) + yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die esac } diff --git a/src/lib/boot.sh b/src/lib/boot.sh index 0632dc0..1384f4f 100644 --- a/src/lib/boot.sh +++ b/src/lib/boot.sh @@ -53,8 +53,8 @@ setup_grub() fi BCMDS[grub]+=" --target=i386-pc $BOOT_DEVICE && grub-mkconfig -o /boot/grub/grub.cfg" else - if [[ $ROOT_PART =~ /dev/mapper && ! $LVM && ! $LUKS_PASS ]]; then - luks_pass "$_LuksOpen" "$ROOT_PART" || return 1 + if [[ $ROOT_PART == */dev/mapper/* && ! $LVM && ! $LUKS_PASS ]]; then + luks_pass "$_LuksOpen" "" || return 1 fi # the mount mess is needed for os-prober to work properly in the chroot @@ -78,27 +78,6 @@ setup_systemd-boot() EDIT_FILES[9]="/boot/loader/entries/$DIST.conf" } -setup_boot_device() -{ - infobox "$_PrepMount" "\nSetting device flags for: $BOOT_PART\n" 1 - - if [[ $BOOT_PART = /dev/nvme* ]]; then - BOOT_DEVICE="${BOOT_PART%p[1-9]}" - else - BOOT_DEVICE="${BOOT_PART%[1-9]}" - fi - - BOOT_PART_NUM="${BOOT_PART: -1}" - - if [[ $SYS == 'UEFI' ]]; then - parted -s $BOOT_DEVICE 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 - fi - - return 0 -} - prerun_grub() { local cfg="$MNT/etc/default/grub" @@ -210,11 +189,10 @@ install_bootloader() prerun_$BOOTLDR printf "\nInstalling and setting up $BOOTLDR in ${BMNTS[$SYS-$BOOTLDR]}\n\n" - chrun "${BCMDS[$BOOTLDR]}" #2>$ERR + chrun "${BCMDS[$BOOTLDR]}" echeck "${BCMDS[$BOOTLDR]}" if [[ -d $MNT/hostrun ]]; then - printf "\n" umount $MNT/hostrun/udev >/dev/null 2>&1 umount $MNT/hostrun/lvm >/dev/null 2>&1 rm -rf $MNT/hostrun >/dev/null 2>&1 diff --git a/src/lib/dialogs.sh b/src/lib/dialogs.sh index f9552af..7b3ef47 100644 --- a/src/lib/dialogs.sh +++ b/src/lib/dialogs.sh @@ -153,7 +153,6 @@ cfg_menu() fi select_mirrorcmd || return 1 - select_wm_or_de || return 1 CONFIG_DONE=true return 0 @@ -328,7 +327,7 @@ select_timezone() select_wm_or_de() { tput civis - if ! INSTALL_WMS="$(dialog --cr-wrap --stdout --backtitle "$BT" \ + if ! INSTALL_WMS="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \ --title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 0 \ "i3-gaps" "A fork of i3 window manager with more features including gaps" off \ "dwm" "A customized fork of dwm, with patches and modifications" off \ @@ -364,13 +363,18 @@ select_wm_or_de() LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}" fi fi - yesno "$_WMLogin" "$_AutoLoginBody\n" && AUTOLOGIN=true || AUTOLOGIN=false + + if yesno "$_WMLogin" "$_AutoLoginBody\n"; then + AUTOLOGIN=true + else + AUTOLOGIN=false + fi else AUTOLOGIN=false fi # add packages to the main package list - PACKAGES="$WM_PACKAGES" + PACKAGES+=" ${WM_PACKAGES/^ /}" } select_login() @@ -380,10 +384,13 @@ select_login() "lightdm" "Lightweight display manager with a gtk greeter")"; then return 1 fi + if [[ $LOGIN_TYPE == 'lightdm' ]]; then WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice" EDIT_FILES[11]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf" else + WM_PACKAGES="$(sed 's/ lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice//g' <<< "$WM_PACKAGES")" + PACKAGES="$(sed 's/ lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice//g' <<< "$PACKAGES")" EDIT_FILES[11]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile" fi } @@ -399,7 +406,7 @@ select_packages() fi tput civis - SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ + SELECTED=$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \ --title " $_Packages " --default-item $SELECTED \ --menu "$_PackageMenu" 0 0 0 \ "1" "Browsers" \ @@ -498,7 +505,7 @@ edit_configs() local exitstr="Exit & reboot" fi - SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ + SELECTED=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ --title " $_EditTitle " --default-item $SELECTED \ --menu "$_EditBody" 0 0 0 \ "1" "$exitstr" \ diff --git a/src/lib/luks.sh b/src/lib/luks.sh index 08f6321..7c0fe9f 100644 --- a/src/lib/luks.sh +++ b/src/lib/luks.sh @@ -26,19 +26,15 @@ luks_open() if (( COUNT == 1 )); then LUKS_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")" infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1 - else - tput civis - if ! LUKS_PART="$(menubox "$_LuksOpen" "$_LuksMenuBody" 0 0 0 $PARTS)"; then - return 1 - fi + elif ! LUKS_PART="$(menubox "$_LuksOpen" "$_LuksMenuBody" 0 0 0 $PARTS)"; then + return 1 + elif ! luks_pass "$_LuksOpen" "$LUKS_NAME"; then + return 1 fi - # get password and name for encryption - luks_pass "$_LuksOpen" "$LUKS_NAME" || return 1 - - infobox "$_LuksOpen" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0 + infobox "$_LuksOpen" "$_LuksOpenWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0 cryptsetup open --type luks $LUKS_PART "$LUKS_NAME" <<< "$LUKS_PASS" 2>$ERR - echeck "cryptsetup open --type luks $LUKS_PART $LUKS_NAME" + errshow "cryptsetup open --type luks $LUKS_PART $LUKS_NAME" LUKS=' encrypted' luks_show @@ -55,17 +51,32 @@ luks_pass() tput cnorm local values - if ! values="$(dialog --stdout --separator '~' --ok-label "Submit" --backtitle "$BT" \ - --title " $title " --insecure --mixedform "$_LuksOpenBody" 16 75 4 \ - "$_Name" 1 1 "$name" 1 $((${#_Name} + 2)) 71 0 0 \ - "$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \ - "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1)"; then - return 1 - fi + if [[ $name == "" ]]; then + if ! values="$(dialog --stdout --separator '~' --ok-label "Submit" \ + --backtitle "$BT" --title " $title " --insecure --mixedform \ + "\nEnter the password to decrypt $ROOT_PART. + \nThis is needed to create a keyfile." 16 75 3 \ + "$_Password" 1 1 "" 1 $((${#_Password} + 2)) 71 0 1 \ + "$_Password2" 2 1 "" 2 $((${#_Password2} + 2)) 71 0 1)"; then + return 1 + fi + pass="$(awk -F'~' '{print $1}' <<< "$values")" + pass2="$(awk -F'~' '{print $2}' <<< "$values")" + else + if ! values="$(dialog --stdout --separator '~' --ok-label "Submit" --backtitle "$BT" \ + --title " $title " --insecure --mixedform "$_LuksOpenBody" 16 75 4 \ + "$_Name" 1 1 "$name" 1 $((${#_Name} + 2)) 71 0 0 \ + "$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \ + "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1)"; then + return 1 + fi - name="$(awk -F'~' '{print $1}' <<< "$values")" - pass="$(awk -F'~' '{print $2}' <<< "$values")" - pass2="$(awk -F'~' '{print $3}' <<< "$values")" + name="$(awk -F'~' '{print $1}' <<< "$values")" + pass="$(awk -F'~' '{print $2}' <<< "$values")" + pass2="$(awk -F'~' '{print $3}' <<< "$values")" + + LUKS_NAME="$name" + fi if [[ $pass == "" || "$pass" != "$pass2" ]]; then msgbox "$_ErrTitle" "$_PassErr\n$_TryAgain" @@ -73,7 +84,6 @@ luks_pass() fi LUKS_PASS="$pass" - LUKS_NAME="$name" return 0 } @@ -82,40 +92,31 @@ luks_setup() LUKS_PART="" modprobe -a dm-mod dm_crypt umount_dir $MNT + find_partitions 'part|lvm' || return 1 + tput civis - if [[ ! $ROOT_PART || $LVM ]]; then - find_partitions 'part|lvm' || return 1 - [[ $BOOT_PART != "" ]] && decr_count "$BOOT_PART" - - if (( COUNT == 1 )); then - LUKS_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")" - infobox "$_LuksEncrypt" "${_OnlyOne}: $LUKS_PART\n" 1 - else - tput civis - if ! LUKS_PART="$(menubox "$_LuksEncrypt" "$_LuksEncryptBody" 0 0 0 $PARTS)"; then - return 1 - fi - fi - else - infobox "$_PrepMount" "\nUsing root partition created earlier: $ROOT_PART\n" 1 - LUKS_PART="$ROOT_PART" + if (( COUNT == 1 )); then + LUKS_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")" + infobox "$_LuksEncrypt" "${_OnlyOne}: $LUKS_PART\n" 1 + elif ! LUKS_PART="$(menubox "$_LuksEncrypt" "$_LuksEncryptBody" 0 0 0 $PARTS)"; then + return 1 + elif ! luks_pass "$_LuksEncrypt" "$LUKS_NAME"; then + return 1 fi - # get password and name for encrypted device - luks_pass "$_LuksEncrypt" "$LUKS_NAME" || return 1 return 0 } luks_default() { luks_setup || return 1 - infobox "$_LuksEncrypt" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0 + infobox "$_LuksEncrypt" "$_LuksCreateWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0 cryptsetup -q luksFormat $LUKS_PART <<< "$LUKS_PASS" 2>$ERR - echeck "cryptsetup -q luksFormat $LUKS_PART" + errshow "cryptsetup -q luksFormat $LUKS_PART" cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$LUKS_PASS" 2>$ERR - echeck "cryptsetup open $LUKS_PART $LUKS_NAME" + errshow "cryptsetup open $LUKS_PART $LUKS_NAME" LUKS=' encrypted' luks_show @@ -130,14 +131,13 @@ luks_keycmd() if ! cipher="$(getinput "$_PrepLUKS" "$_LuksCipherKey" "-s 512 -c aes-xts-plain64")"; then return 1 fi - - infobox "$_LuksEncryptAdv" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0 + infobox "$_LuksEncryptAdv" "$_LuksCreateWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0 cryptsetup -q $cipher luksFormat $LUKS_PART <<< "$LUKS_PASS" 2>$ERR - echeck "cryptsetup -q $cipher luksFormat $LUKS_PART" + errshow "cryptsetup -q $cipher luksFormat $LUKS_PART" cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$LUKS_PASS" 2>$ERR - echeck "cryptsetup open $LUKS_PART $LUKS_NAME" + errshow "cryptsetup open $LUKS_PART $LUKS_NAME" luks_show return 0 @@ -149,14 +149,15 @@ luks_show() { tput civis sleep 0.5 - msgbox "$_LuksEncrypt" "${_LuksEncryptSucc}\n$(lsblk $LUKS_PART -o NAME,MODEL,TYPE,FSTYPE,SIZE)" + msgbox "$_LuksEncrypt" "${_LuksEncryptSucc}\n$(lsblk $LUKS_PART -o NAME,MODEL,TYPE,FSTYPE,SIZE)\n" } luks_menu() { tput civis local choice - choice="$(menubox "$_PrepLUKS" "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 0 \ + choice="$(menubox "$_PrepLUKS" \ + "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 0 \ "$_LuksEncrypt" "cryptsetup -q luksFormat" \ "$_LuksOpen" "cryptsetup open --type luks" \ "$_LuksEncryptAdv" "cryptsetup -q -s -c luksFormat" \ diff --git a/src/lib/lvm.sh b/src/lib/lvm.sh index 99ecea0..c495599 100644 --- a/src/lib/lvm.sh +++ b/src/lib/lvm.sh @@ -48,7 +48,7 @@ lvm_detect() infobox "$_PrepLVM" "$_LvmDetBody" 0 modprobe dm-mod 2>$ERR - echeck 'modprobe dm-mod' + errshow 'modprobe dm-mod' vgscan >/dev/null 2>&1 vgchange -ay >/dev/null 2>&1 @@ -190,7 +190,7 @@ lvm_extra_lvs() # create it lvcreate -L "$VOLUME_SIZE" "$VOLUME_GROUP" -n "$VOLUME_NAME" 2>$ERR - echeck "lvcreate -L $VOLUME_SIZE $VOLUME_GROUP -n $VOLUME_NAME" + errshow "lvcreate -L $VOLUME_SIZE $VOLUME_GROUP -n $VOLUME_NAME" msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$_Done LV $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2." ((VOL_COUNT--)) # decrement the number of volumes chosen after each loop @@ -237,7 +237,7 @@ lvm_create_group() # create it vgcreate -f "$VOLUME_GROUP" "$GROUP_PARTS" >/dev/null 2>$ERR - echeck "vgcreate -f $VOLUME_GROUP $GROUP_PARTS" + errshow "vgcreate -f $VOLUME_GROUP $GROUP_PARTS" GROUP_SIZE=$(vgdisplay "$VOLUME_GROUP" | awk '/VG Size/ { gsub(/[^0-9.]/, "") @@ -281,17 +281,22 @@ lvm_create() # last or only logical volume lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VOL_GROUP_MB}MB)" || return 1 lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" 2>$ERR - echeck "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME" + errshow "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME" LVM=' logical volume' - show_devices + + tput civis + sleep 0.5 + local msg="${_Done}$_LvmPvDoneBody1 $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2." + msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg\n\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE $GROUP_PARTS)" + return 0 } lvm_del_vg() { - if lvm_show_vg; then - yesno "$_LvmDelVG" "$_LvmDelQ" && vgremove -f "$DEL_VG" >/dev/null 2>&1 + if lvm_show_vg && yesno "$_LvmDelVG" "$_LvmDelQ"; then + vgremove -f "$DEL_VG" >/dev/null 2>&1 fi return 0 } @@ -312,7 +317,7 @@ lvm_del_all() for i in $PHYSICAL_VOLUMES; do pvremove -f "$i" >/dev/null 2>&1 done - LVM=' logical volume' + LVM='' fi return 0 diff --git a/src/lib/mount.sh b/src/lib/mount.sh index 4023451..32cbf8f 100644 --- a/src/lib/mount.sh +++ b/src/lib/mount.sh @@ -30,10 +30,6 @@ mnt_menu() lvm_detect umount_dir $MNT find_partitions 'part|lvm|crypt' || return 1 - - # remove boot partition from dialog list if we auto partitioned one - [[ $BOOT_PART != "" ]] && decr_count "$BOOT_PART" - select_root_partition || return 1 if [[ $BOOT_PART ]]; then @@ -54,7 +50,12 @@ select_swap() { # Ask user to select partition or create swapfile tput civis - if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" 0 0 0 "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)" || [[ $SWAP_PART == "$_SelSwpNone" ]]; then + if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" 0 0 0 \ + "$_SelSwpNone" "-" \ + "$_SelSwpFile" "$SYS_MEM" \ + $PARTS)" || + [[ $SWAP_PART == "$_SelSwpNone" ]] + then SWAP_PART="" return 0 fi @@ -72,7 +73,6 @@ select_swap() fi ((i++)) done - enable_swap "$MNT/swapfile" SWAP_PART="/swapfile" else @@ -106,18 +106,16 @@ select_mount_opts() local opts="${FS_OPTS[$fs]}" # check for ssd - if [[ $LUKS && ! $LVM && $part == "$ROOT_PART" ]]; then - ssd "$LUKS_PART" && opts=$(sed 's/discard - off/discard - on/' <<< "$opts") - else - ssd "$part" && opts=$(sed 's/discard - off/discard - on/' <<< "$opts") - fi + ssd "$part" >/dev/null 2>&1 && opts=$(sed 's/discard - off/discard - on/' <<< "$opts") tput civis if ! MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " \ - --checklist "$_MntBody" 0 0 0 $opts | sed 's/ /,/g; $s/,$//')" || [[ $MNT_OPTS == "" ]]; then + --checklist "$_MntBody" 0 0 0 $opts)" || [[ $MNT_OPTS == "" ]]; then return 1 fi + MNT_OPTS="$(sed 's/ /,/g; $s/,$//' <<< "$MNT_OPTS" )" + if ! yesno "$title" "$_MntConfBody $MNT_OPTS\n"; then select_mount_opts "$part" "$fs" || return 1 fi @@ -129,20 +127,13 @@ select_filesystem() { local part="$1" local fs cur_fs - if [[ $LUKS && ! $LVM && $part == "$ROOT_PART" ]]; then - cur_fs="$(lsblk -lno FSTYPE $LUKS_PART)" - else - cur_fs="$(lsblk -lno FSTYPE $part)" - fi - - - local title="\nSelect which filesystem you want to use for $part\n\nPartition Name: " + cur_fs="$(lsblk -lno FSTYPE $part 2>/dev/null)" + local msg="\nSelect which filesystem you want to use for $part\n\nPartition Name: " tput civis - if [[ $cur_fs && $part != "$ROOT_PART" ]]; then fs="$(menubox "$_FSTitle: $part" \ - "${title}${part}\nExisting Filesystem: ${cur_fs}$_FSBody" 0 0 0 \ + "${msg}${part}\nExisting Filesystem: ${cur_fs}$_FSBody" 0 0 0 \ "$_Skip" "-" \ "ext4" "${FS_CMDS[ext4]}" \ "ext3" "${FS_CMDS[ext3]}" \ @@ -156,7 +147,7 @@ select_filesystem() "xfs" "${FS_CMDS[xfs]}")" else fs="$(menubox "$_FSTitle: $part" \ - "${title}${part}$_FSBody" 0 0 0 \ + "${msg}${part}$_FSBody" 0 0 0 \ "ext4" "${FS_CMDS[ext4]}" \ "ext3" "${FS_CMDS[ext3]}" \ "ext2" "${FS_CMDS[ext2]}" \ @@ -223,30 +214,12 @@ select_boot_partition() select_root_partition() { - # if we used LUKS and no LVM or LUKS+LVM remove the relevant partition labels from the list - if [[ $LUKS && ! $LVM ]]; then - ROOT_PART="/dev/mapper/$LUKS_NAME" - decr_count "$LUKS_PART" - elif [[ $LVM ]]; then - if [[ $LUKS ]]; then - decr_count "$LUKS_PART" - fi - for part in $(printf "%s" "$GROUP_PARTS"); do - decr_count "$part" - done - ROOT_PART="" - fi - - if [[ $COUNT -eq 1 && ! $ROOT_PART ]]; then + tput civis + if [[ $COUNT -eq 1 ]]; then ROOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")" infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1 - elif [[ ! $ROOT_PART || $LVM ]]; then - tput civis - if ! ROOT_PART="$(menubox "$_PrepMount" "$_SelRootBody" 0 0 0 $PARTS)"; then - return 1 - fi - else - infobox "$_PrepMount" "\nUsing${LUKS} root partition: $ROOT_PART\n" 1 + elif ! ROOT_PART="$(menubox "$_PrepMount" "$_SelRootBody" 0 0 0 $PARTS)"; then + return 1 fi select_filesystem "$ROOT_PART" || { ROOT_PART=""; return 1; } diff --git a/src/lib/part.sh b/src/lib/part.sh index 161a785..10655e5 100644 --- a/src/lib/part.sh +++ b/src/lib/part.sh @@ -25,9 +25,9 @@ declare -Agr FS_OPTS=([vfat]="" [ntfs]="" [ext2]="" [ext3]="" format() { - infobox "$_FSTitle" "\nFormatting: $1\n\nCommand: ${FS_CMDS[$2]}\n" 0 + infobox "$_FSTitle" "\nRunning: ${FS_CMDS[$2]} $1\n" 0 ${FS_CMDS[$2]} $1 >/dev/null 2>$ERR - echeck "${FS_CMDS[$2]} $1" + errshow "${FS_CMDS[$2]} $1" } partition() @@ -42,10 +42,25 @@ partition() tput civis local choice - if ! choice="$(menubox "$_PartTitle" "$_PartBody" 0 0 0 "$_PartShowTree" "-" "$_PartAuto" "-" \ - $({ [[ $DISPLAY ]] && hash gparted >/dev/null 2>&1; } && printf "gparted -") \ - "cfdisk" "-" "parted" "-" "$_PartWipe" "-")"; then - return 1 + if [[ $DISPLAY ]] && hash gparted >/dev/null 2>&1; then + if ! choice="$(menubox "$_PartTitle" "$_PartBody" 0 0 0 \ + "$_PartShowTree" "-" \ + "$_PartAuto" "-" \ + "gparted -" \ + "cfdisk" "-" \ + "parted" "-" \ + "$_PartWipe" "-")"; then + return 1 + fi + else + if ! choice="$(menubox "$_PartTitle" "$_PartBody" 0 0 0 \ + "$_PartShowTree" "-" \ + "$_PartAuto" "-" \ + "cfdisk" "-" \ + "parted" "-" \ + "$_PartWipe" "-")"; then + return 1 + fi fi tput civis @@ -59,7 +74,7 @@ partition() partition $device else # if auto_partition fails we need to empty the partition variables - auto_partition $device || { ROOT_PART=""; BOOT_PART=""; BOOT_DEVICE=""; return 1; } + auto_partition $device || return 1 fi } @@ -78,14 +93,14 @@ enable_swap() { if [[ $1 == "$MNT/swapfile" && $SWAP_SIZE ]]; then fallocate -l $SWAP_SIZE $1 2>$ERR - echeck "fallocate -l $SWAP_SIZE $1" + errshow "fallocate -l $SWAP_SIZE $1" chmod 600 $1 2>$ERR - echeck "chmod 600 $1" + errshow "chmod 600 $1" fi mkswap $1 >/dev/null 2>$ERR - echeck "mkswap $1" + errshow "mkswap $1" swapon $1 >/dev/null 2>$ERR - echeck "swapon $1" + errshow "swapon $1" return 0 } @@ -95,10 +110,10 @@ device_tree() local msg if [[ $IGNORE_DEV != "" ]]; then msg="$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT | - awk "!/$IGNORE_DEV/"' && /disk|part|lvm|crypt|NAME/ {print $0}')" + awk "!/$IGNORE_DEV/"' && /disk|part|lvm|crypt|NAME/')" else msg="$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT | - awk '/disk|part|lvm|crypt|NAME/ {print $0}')" + awk '/disk|part|lvm|crypt|NAME/')" fi msgbox "$_PrepShowDev" "$msg" } @@ -144,9 +159,11 @@ confirm_mount() fi if [[ $(mount) == *"$mount"* ]]; then - infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1; decr_count "$part" + infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1 + decr_count "$part" else - infobox "$_MntTitle" "$_MntFail\n$msg\n" 1; return 1 + infobox "$_MntTitle" "$_MntFail\n$msg\n" 1 + return 1 fi return 0 @@ -247,19 +264,18 @@ auto_partition() sleep 0.1 BOOT_DEVICE="$device" - BOOT_PART=$(lsblk -lno NAME,TYPE $device | awk 'NR == 2 {print "/dev/"$1}') + bp=$(lsblk -lno NAME,TYPE $device | awk 'NR == 2 {print "/dev/"$1}') if [[ $SYS == "BIOS" ]]; then - mkfs.ext4 -q $BOOT_PART >/dev/null 2>&1 + mkfs.ext4 -q $bp >/dev/null 2>&1 else - mkfs.vfat -F32 $BOOT_PART >/dev/null 2>&1 + mkfs.vfat -F32 $bp >/dev/null 2>&1 fi infobox "$_PrepParts" "\nCreating a $size ext4 root partition.\n" 0 parted -s $device mkpart primary ext4 513MiB 100% >/dev/null 2>&1 sleep 0.1 - ROOT_PART=$(lsblk -lno NAME,TYPE $device | awk 'NR == 3 {print "/dev/"$1}') - mkfs.ext4 -q $ROOT_PART >/dev/null 2>&1 + mkfs.ext4 -q $(lsblk -lno NAME,TYPE $device | awk 'NR == 3 {print "/dev/"$1}') >/dev/null 2>&1 tput civis; sleep 0.5 msgbox "$_PrepParts" "\nAuto partitioning complete.\n\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE $device)" @@ -270,15 +286,14 @@ mount_partition() local part="$1" local mountp="${MNT}$2" local fs="$(lsblk -lno FSTYPE $part)" - mkdir -p "$mountp" - if [[ ${FS_OPTS[$fs]} != "" && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then + if [[ ${FS_OPTS[$fs]} && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then mount -o $MNT_OPTS $part "$mountp" 2>$ERR - echeck "mount -o $MNT_OPTS $part $mountp" + errshow "mount -o $MNT_OPTS $part $mountp" else mount $part "$mountp" 2>$ERR - echeck "mount $part $mountp" + errshow "mount $part $mountp" fi confirm_mount $part "$mountp" || return 1 @@ -336,5 +351,26 @@ find_partitions() fi return 0 - } + +setup_boot_device() +{ + infobox "$_PrepMount" "\nSetting device flags for: $BOOT_PART\n" 1 + + if [[ $BOOT_PART = /dev/nvme* ]]; then + BOOT_DEVICE="${BOOT_PART%p[1-9]}" + else + BOOT_DEVICE="${BOOT_PART%[1-9]}" + fi + + BOOT_PART_NUM="${BOOT_PART: -1}" + + if [[ $SYS == 'UEFI' ]]; then + parted -s $BOOT_DEVICE 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 + fi + + return 0 +} + diff --git a/src/lib/utils.sh b/src/lib/utils.sh index 0e2d7b8..75062ff 100644 --- a/src/lib/utils.sh +++ b/src/lib/utils.sh @@ -203,6 +203,23 @@ preinstall_checks() return 0 } +errshow() +{ + local last_exit_code=$? + if (( last_exit_code == 0 )); then + return 0 + fi + + local err + err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")" + + if [[ $err != "" ]]; then + msgbox "$_ErrTitle" "\nERROR: $err" + else + msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n" + fi +} + echeck() { local last_exit_code=$? @@ -214,7 +231,7 @@ echeck() err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")" if [[ $err != "" ]]; then - msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the following error message:\n\n$err" + msgbox "$_ErrTitle" "\nERROR: $err" else msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n" fi @@ -258,7 +275,7 @@ menubox() local n=$5 shift 5 local response - if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --menu "$body" $h $w $n "$@")"; then + if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --menu "$body" $h $w $n "$@")"; then return 1 fi printf "%s" "$response" @@ -273,7 +290,7 @@ checkbox() local n=$5 shift 5 local response - if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$body" $h $w $n "$@")"; then + if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --checklist "$body" $h $w $n "$@")"; then return 1 fi printf "%s" "$response" @@ -282,7 +299,7 @@ checkbox() getinput() { local answer - if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then + if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then return 1 fi printf "%s" "$answer" @@ -299,7 +316,6 @@ infobox() yesno() { # usage: yesno <text> [<yes_label> <no_label> [<no>]] - # three options: one --default-no and custom labels, one just custom labels, and one basic. tput civis if [[ $# -eq 5 && $5 == "no" ]]; then dialog --cr-wrap --backtitle "$BT" --defaultno --title " $1 " \