diff --git a/lang/english.trans b/lang/english.trans index 788872e..924a67d 100644 --- a/lang/english.trans +++ b/lang/english.trans @@ -23,8 +23,8 @@ _Not64Bit="\nThis installer only supports x86_64 capable machines.\n" _NoNetwork="\nThis installer needs to be run with an active internet connection in order to update and install packages.\n" # Preparation Menu -_PrepTitle="Prepare System for Install" -_PrepBody="\nThis is the menu in which you will prepare your system for the install.\n\nTo begin the install you must first have:\n\n - A root (/) partition mounted (UEFI systems also require a seperate boot partition).\n - A new user must be created and the passwords set.\n - The System settings must be configured.\n\nAlready created your partition(s)? Move on to mounting." +_PrepTitle="Prep for Install" +_PrepBody="\nThis is the menu in which you will prepare your system for the install.\n\nTo begin the install you must first have:\n\n - A root (/) partition mounted (UEFI systems also require a seperate boot partition).\n - A user created and the passwords set.\n - The system settings configured." _PrepLayout="Select keyboard layout" _PrepShowDev="Show device tree (optional)" _PrepParts="Edit partitions (optional)" @@ -39,60 +39,56 @@ _PrepShow="Check configuration choices (optional)" _PrepInstall="Start the installation" # Select Config Files -_EditTitle="Edit System Configuration" +_EditTitle="Finalization" _EditBody="\nBefore exiting you can select configuration files from below to review/change.\n\nIf you need to make additional changes with the drives still mounted, use Ctrl-z to pause the installer and return to the terminal, when finished type 'fg' and Enter or Ctrl-z again to resume the installer." # Close Installer -_CloseInst="Close Installer" -_CloseInstBody="\nUnmount partitions (if any) and close the installer?\n" - -# error message -_ErrChoice="\nUnmount the partitions and shutdown or keep them mounted and continue?\n" -_ErrChoiceConsole="\nUnmount the partitions and exit to view the error log or keep them mounted and continue?\n" +_CloseInst="Exit" +_CloseInstBody="\nUnmount partitions (if any) and exit the installer?\n" # timezone -_TimeZTitle="Set Timezone" +_TimeZTitle="Timezone" _TimeZQ="\nConfirm time zone:" -_TimeSubZBody="\nSelect the nearest city to your location from the list below." +_TimeSubZBody="\nSelect the nearest city to you or one with the same time zone.\n\nTIP: Pressing the first letter of the city name repeatedly will navigate between entries beggining with that letter." _TimeZBody="\nThe time zone is used to set the system clock.\n\nSelect your country or continent from the list below" # bootloader _MntBootBody="\nSelect which bootloader to use." -_InstSysTitle="Install Syslinux" -_InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)?" +_InstSysTitle="Syslinux" +_InstSysBody="\nInstall syslinux to the master boot record (MBR) or to the root (/) partition?" # mirrors -_MirrorTitle="Setup Mirrorlist" -_MirrorSetup="\nSort the mirrorlist automatically?\n\nThis takes longer but gets the fastest mirrors.\n" +_MirrorTitle="Mirrorlist Sorting" +_MirrorSetup="\nSort the mirrorlist automatically?\n\nTakes longer but gets fastest mirrors.\n" _MirrorCmd="\nThe command below will be used to sort the mirrorlist, edit if needed.\n" # window managers and packages -_WMChoice="Select WMs or DEs" -_WMChoiceBody="\nUse [Space] to toggle the selection of your desired window manager(s) or desktop environment(s).\n\nDepending on your choice additional packages may be installed to improve the experience." +_WMChoice="Sessions" +_WMChoiceBody="\nUse [Space] to toggle available sessions.\n\nFor all sessions a basic package set will be installed for basic compatibilty across sessions. In addition to this extra packages specific to each sessions will also be installed to provide basic functionality most people expect from an environment." -_Packages="Install Packages" -_PackageMenu="\nSelect a package category to choose packages from, when finished select '$_Done' to finalize choices and continue." -_PackageBody="\nUse [Space] to toggle the selection of packages(s) and press [Enter] to accept the selection.\n\nNOTE: Some packages may already be installed by your desktop environment (if any). Extra packages may also be installed for the chosen packages eg. install qutebrowser and qt5ct (the Qt5 theme tool) will also be installed." +_Packages="Additional Packages" +_PackageMenu="\nSelect a category to choose packages from, once finished select '$_Done' to return to the main menu." +_PackageBody="\nUse [Space] to toggle packages(s) and press [Enter] to accept the selection.\n\nNOTE: Some packages may already be installed by your desktop environment (if any). Extra packages may also be installed for the selected packages eg. Selecting qutebrowser will also install qt5ct (the Qt5 theme tool) and qt5-styleplugins (for Gtk themes in Qt applications)." # login setup -_WMLogin="Setup Login Managment" +_WMLogin="Login Managment" _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" -_CMapBody="\nSelect virtual console keymap, virtual console is the shell before reaching a graphical environment (Xorg).\n\nIts keymap is seperate from the one used by Xorg.\n\nDefault: us" -_XMapBody="\nSelect the system wide keymap, this is the keyboard layout used once a graphical environment (Xorg) is running.\n\nIf a matching virtual console keymap exists it will be used, otherwise you will be asked to pick one.\n\nDefault: us" +_CMapTitle="Console Keymap" +_CMapBody="\nSelect console keymap, the console is the tty shell you reach before starting a graphical environment (usually Xorg).\n\nIts keymap is seperate from the one used by the graphical environments, though many do use the same such as 'us' English.\n\nDefault: us" +_XMapBody="\nPick your system keymap from the list below\n\nThis keymap layout is used once a graphical environment is running (usually Xorg).\n\nIf a matching console keymap exists it will be used, otherwise you will be asked to select one for that as well.\n\nDefault: us" _LocaleBody="\nLocale determines the system language and currency formats.\n\nThe format for locale names is languagecode_COUNTRYCODE\n\neg. en_US is: english United States\n en_GB is: english Great Britain" # Configure -_ConfHost="System Hostname" -_ConfLocale="System Language and Locale" +_ConfHost="Hostname" +_ConfLocale="Language and Locale" _HostNameBody="\nEnter a hostname for the new system.\n\nA hostname is used to identify systems on the network.\n\nIt's restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain hyphens (-) BUT NOT at the beggining or end." # Create new user and set password -_UserTitle="Create New User" +_UserTitle="User Creation" _Username="Username:" _Password="Password:" _Password2="Password2:" @@ -105,36 +101,36 @@ _MntFail="\nMount Failed!\n" _MntSucc="\nMount Succeeded!\n" _MntConfBody="\nConfirm mount options:" _WarnMount="\nIMPORTANT: Please choose carefully during mounting and formatting.\n\nDuring mounting, partitions can be mounted without formatting by selecting '$_Skip'.\nThis can be useful for data partitions or previously formatted partitions.\n\nThe one exception to this is the root (/) partition, it must be formatted before unpacking to ensure the system stability.\n" -_MntBody="\nUse [Space] to de/select the desired mount options.\n\nIf the device is an SSD the 'discard' option provides active TRIM support and will be automatically selected.\n\nChoosing none will result in an automatic mount with system applied options." +_MntBody="\nUse [Space] to toggle mount options from below, press [Enter] when done to confirm selection.\n\nNot selecting any and confirming will run an automatic mount." # Select Device -_DevSelTitle="Select Device" +_DevSelTitle="Device Selection" _DevSelBody="\nSelect a device to use from the list below.\n\nDevices (/dev) are the available drives on the system. /sda, /sdb ..." # Extra Partitions _ExtPartBody="\nYou can now select additional partitions you want mounted, once choosen you will be asked to enter a mountpoint.\n\nSelect '$_Done' to finish the mounting step and return to the main menu." -_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a slash (/).\nSome examples include:" +_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a slash (/).\nExamples include: /usr, /home, /var, etc.\n" # kernel -_KernelTitle="Choose Kernel" +_KernelTitle="Linux Kernel" _KernelBody="\nSelect which kernel to use for the install." # shell -_ShellTitle="Choose Login Shell" +_ShellTitle="Login Shell" _ShellBody="\nChoose a shell for the new user and root." # Partitioning Menu -_PartTitle="Partitioning Tool" -_PartWipe="Secure Wipe Device" +_PartTitle="Partitioning" +_PartWipe="Secure Wipe" _PartAuto="Automatic Partitioning" -_PartShowTree="Show Partition Tree" -_PartBody="\nWhole device auto partitioning is available for beginners.\n\nUEFI systems require a vfat/fat32 partition between 100-512M in size to be mounted at /boot or /boot/efi, BIOS systems using LUKS will also require this but formatted as ext3 or ext4 instead." +_PartShowTree="Show Partition Table" +_PartBody="\nFull device auto partitioning is available for beginners.\n\nUEFI systems require a vfat/fat32 partition between 100-512M in size to be mounted at /boot or /boot/efi, BIOS systems using LUKS will also require this but formatted as ext3 or ext4 instead." # Auto partition _PartBody1="\nWARNING:\n\nALL data on" _PartBody2="will be destroyed and the following partitions will be created\n\n- A 512M vfat/fat32 boot partition with boot flags enabled.\n- An ext4 partition using all remaining space" _PartBody3="\n\nDo you want to continue?\n" -_PartWipeBody="will be destroyed using 'wipe -Ifre'.\n\nThis process can take a long time depending on the size of the drive.\n\nDo you want to continue?\n" +_PartWipeBody="will be destroyed using 'wipe -Ifre'.\n\nThis is ONLY intended for use on devices before sale or disposal to reliably destroy your data beyond recovery by filling it with random data multiple times. This is NOT for devices you intend to continue using.\nThe wiping process can take a long time depending on the size and speed of the drive.\n\nDo you still want to continue?\n" # bootloader _InstSysTitle="Install Syslinux" @@ -142,7 +138,6 @@ _InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)? # File System _FSTitle="Choose Filesystem" -_FSBody="\nDefault Filesystem: ext4\n\nNOTE: Not all filesystems are usable for root (/) or boot (/boot) partitions." _SelRootBody="\nSelect root (/) partition.\n\nThis is the partition where $DIST will be installed." _SelBiosBody="\nDo you want to use a separate boot partition? (required for LUKS)\n\nThis partition is where the bootloader will be installed.\n" diff --git a/src/archlabs-installer b/src/archlabs-installer index df7aa00..3245635 100755 --- a/src/archlabs-installer +++ b/src/archlabs-installer @@ -8,7 +8,7 @@ # Some ideas and code has been taken from other installers # AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due -VER="1.8.35" # version +VER="1.8.36" # version DIST="ArchLabs" # distributor MNT="/mnt" # install mountpoint @@ -30,6 +30,7 @@ LOGIN_TYPE="" # login manager can be lightdm or xinit INSTALL_WMS="" # space separated list of chosen wm/de KERNEL="" # kernel can be linux or linux-lts PACKAGES="" # list of all packages to install including WM_PACKAGES +USER_PKGS="" # packages selected by the user during install WM_PACKAGES="" # full list of packages added during wm/de choice MYSHELL="" # login shell for root and the primary user UCODE="" # cpu manufacturer microcode filename (if any) @@ -214,20 +215,15 @@ declare -A FS_OPTS=( main() { - if [[ $CURRENT_MENU != "main" && $SAVED ]]; then - CURRENT_MENU="main" - SELECTED=$((SAVED + 1)) - unset SAVED - elif [[ $CURRENT_MENU != "main" ]]; then - SELECTED=1 - CURRENT_MENU="main" - elif (( SELECTED < 11 )); then - ((SELECTED++)) + if [[ $MENU != 'main' ]]; then + MENU='main' + [[ $SAVED ]] && { SEL=$SAVED; unset SAVED; } || SEL=0 fi + (( SEL < 11 )) && (( SEL++ )) tput civis - SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ - --title " $_PrepTitle " --default-item $SELECTED \ + SEL=$(dialog --cr-wrap --stdout --backtitle "$BT" \ + --title " $_PrepTitle " --default-item $SEL \ --cancel-label 'Exit' --menu "$_PrepBody" 0 0 0 \ "1" "$_PrepShowDev" \ "2" "$_PrepParts" \ @@ -241,21 +237,21 @@ main() "10" "$_PrepShow" \ "11" "$_PrepInstall") - if [[ $WARN != true && $SELECTED =~ (2|5) ]]; then + if [[ $WARN != true && $SEL =~ (2|5) ]]; then WARN=true msgbox "$_PrepTitle" "$_WarnMount" fi - case $SELECTED in + case $SEL 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) prechecks 0 && { mkuser || SELECTED=$((SELECTED - 1)); } ;; - 7) prechecks 1 && { cfg_menu || SELECTED=$((SELECTED - 1)); } ;; - 8) prechecks 2 && { select_sessions || SELECTED=$((SELECTED - 1)); } ;; - 9) prechecks 2 && { select_packages || SELECTED=$((SELECTED - 1)); } ;; + 2) partition || SEL=$((SEL - 1)) ;; + 3) luks_menu || SEL=$((SEL - 1)) ;; + 4) lvm_menu || SEL=$((SEL - 1)) ;; + 5) mnt_menu || SEL=$((SEL - 1)) ;; + 6) prechecks 0 && { mkuser || SEL=$((SEL - 1)); } ;; + 7) prechecks 1 && { cfg_menu || SEL=$((SEL - 1)); } ;; + 8) prechecks 2 && { select_sessions || SEL=$((SEL - 1)); } ;; + 9) prechecks 2 && { select_packages || SEL=$((SEL - 1)); } ;; 10) prechecks 2 && show_cfg ;; 11) prechecks 2 && install ;; *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die @@ -269,7 +265,7 @@ show_cfg() { local cmd="${BCMDS[$BOOTLDR]}" local mnt="${BMNTS[$SYS-$BOOTLDR]}" - local pkgs="${PACKAGES# } $BASE_PKGS" + local pkgs="${USER_PKGS# } ${PACKAGES# } $BASE_PKGS" [[ $PACKAGES =~ (openbox|bspwm|i3-gaps) || $INSTALL_WMS == *dwm* ]] && pkgs="${pkgs# } $WM_BASE_PKGS" [[ $INSTALL_WMS == *dwm* ]] && pkgs="${pkgs# } dwm st dmenu" pkgs="${pkgs# }" @@ -330,26 +326,20 @@ cfg_menu() if ! MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"; then return 1 fi - tput cnorm if ! HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"; then return 1 fi - tput civis if ! LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" \ --title " $_ConfLocale " --menu "$_LocaleBody" 0 0 $((LINES - 20)) $LOCALES)"; then return 1 fi - select_timezone || return 1 - if ! KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" 'linux' '-' 'linux-lts' '-')"; then return 1 fi - select_mirrorcmd || return 1 - CONFIG_DONE=true return 0 } @@ -404,7 +394,7 @@ mkuser() select_keymap() { tput civis - if ! KEYMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \ + KEYMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \ --title " $_PrepLayout " --menu "$_XMapBody" 0 0 $((LINES - 20)) \ 'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \ 'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \ @@ -425,18 +415,17 @@ select_keymap() 'ke' 'Swahili' 'bw' 'Tswana' 'ph' 'Filipino' 'my' 'Malay' 'tm' 'Turkmen' \ 'id' 'Indonesian' 'bt' 'Dzongkha' 'lv' 'Latvian' 'md' 'Moldavian' 'mao' 'Maori' \ 'by' 'Belarusian' 'az' 'Azerbaijani' 'mk' 'Macedonian' 'kh' 'Khmer' 'epo' 'Esperanto' \ - 'me' 'Montenegrin')"; then - return 1 - fi + 'me' 'Montenegrin')" + + [[ $KEYMAP ]] || return 1 - # when a matching console map is not available open a selection dialog if [[ $CMAPS == *"$KEYMAP"* ]]; then CMAP="$KEYMAP" else - if ! CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \ - --title " $_CMapTitle " --menu "$_CMapBody" 0 0 $((LINES - 17)) $CMAPS)"; then - return 1 - fi + CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \ + --title " $_CMapTitle " --menu "$_CMapBody" 0 0 $((LINES - 17)) $CMAPS)" + + [[ $CMAP ]] || return 1 fi if [[ $DISPLAY && $TERM != 'linux' ]]; then @@ -444,6 +433,7 @@ select_keymap() else loadkeys $CMAP >/dev/null 2>&1 fi + return 0 } @@ -476,19 +466,19 @@ select_sessions() LOGIN_CHOICES="" tput civis - if ! INSTALL_WMS="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ + INSTALL_WMS="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ --title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 0 \ "i3-gaps" "A fork of i3wm with more features including gaps" off \ - "dwm" "A fork of dwm, with more layouts and features" 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 \ + "dwm" "A fork of dwm, with more layouts and features" off \ + "fluxbox" "A lightweight and highly-configurable window manager" off \ "gnome" "A desktop environment that aims to be simple and easy to use" off \ "cinnamon" "A desktop environment combining traditional desktop with modern effects" off \ "plasma" "A kde software project currently comprising a full desktop environment" off \ - "xfce4" "A lightweight and modular desktop environment based on gtk+2/3" off \ - "fluxbox" "A lightweight and highly-configurable window manager" off)"; then - return 1 - fi + "xfce4" "A lightweight and modular desktop environment based on gtk+2/3" off)" + + [[ $INSTALL_WMS ]] || return 1 WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS") WM_PACKAGES="${INSTALL_WMS/dwm/}" # remove dwm from package list @@ -514,18 +504,21 @@ select_sessions() AUTOLOGIN=false fi - PACKAGES+=" ${WM_PACKAGES# }" + # add unique wm packages to main package list + for i in $WM_PACKAGES; do + [[ $PACKAGES == *$i* ]] || PACKAGES+=" ${WM_PACKAGES# }" + done } select_login() { - if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" \ + LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" \ "xinit" "Console login without a display manager" \ - "lightdm" "Lightweight display manager with a gtk greeter")"; then - return 1 - fi + "lightdm" "Lightweight display manager with a gtk greeter")" - if [[ $LOGIN_TYPE == 'lightdm' ]]; then + if [[ $LOGIN_TYPE ]]; then + return 1 + elif [[ $LOGIN_TYPE == 'lightdm' ]]; then WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice" EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf" else @@ -536,59 +529,6 @@ select_login() fi } -select_packages() -{ - if [[ $CURRENT_MENU != "packages" ]]; then - SAVED=$SELECTED - SELECTED=1 - CURRENT_MENU="packages" - elif (( SELECTED < 13 )); then - ((SELECTED++)) # increment the highlighted menu item - fi - - tput civis - SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_Packages " \ - --default-item $SELECTED --menu "$_PackageMenu" 0 0 0 \ - 1 "Web Browsers" \ - 2 "Text Editors" \ - 3 "File Management" \ - 4 "Terminal Emulators" \ - 5 "Music & Video Players" \ - 6 "Chat & Mail Clients" \ - 7 "Office & Professional" \ - 8 "Image & PDF Viewers" \ - 9 "Additional Fonts" \ - 10 "Torrent Clients" \ - 11 "System Management" \ - 12 "Miscellaneous" \ - 13 "$_Done") - - if [[ $SELECTED -lt 13 ]]; then - case $SELECTED in - 1) PACKAGES+=" $(select_browsers)" ;; - 2) PACKAGES+=" $(select_editors)" ;; - 3) PACKAGES+=" $(select_files)" ;; - 4) PACKAGES+=" $(select_terms)" ;; - 5) PACKAGES+=" $(select_media)" ;; - 6) PACKAGES+=" $(select_mail)" ;; - 7) PACKAGES+=" $(select_prof)" ;; - 8) PACKAGES+=" $(select_viewers)" ;; - 9) PACKAGES+=" $(select_fonts)" ;; - 10) PACKAGES+=" $(select_torrent)" ;; - 11) PACKAGES+=" $(select_sys)" ;; - 12) PACKAGES+=" $(select_extra)" ;; - esac - select_packages - fi - - for pkg in $PACKAGES; do - [[ ${PKG_EXT[$pkg]} && $PACKAGES != *"${PKG_EXT[$pkg]}"* ]] && PACKAGES+=" ${PKG_EXT[$pkg]}" - done - [[ $MYSHELL == *mksh ]] && PACKAGES+=" mksh" - PACKAGES="${PACKAGES# }" - return 0 -} - select_mirrorcmd() { local c @@ -634,12 +574,10 @@ select_mirrorcmd() edit_configs() { - [[ $DEBUG == true ]] && str="View log & reboot" || str="Exit & reboot" - tput civis local choice choice=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ - --title " $_EditTitle " --menu "$_EditBody" 0 0 0 "$str" "-" \ + --title " $_EditTitle " --menu "$_EditBody" 0 0 0 \ "keyboard" "${EDIT_FILES[keyboard]}" \ "console" "${EDIT_FILES[console]}" \ "locale" "${EDIT_FILES[locale]}" \ @@ -650,9 +588,10 @@ edit_configs() "crypttab" "${EDIT_FILES[crypttab]}" \ "bootloader" "${EDIT_FILES[bootloader]}" \ "pacman" "${EDIT_FILES[pacman]}" \ - "login" "${EDIT_FILES[login]}") + "login" "${EDIT_FILES[login]}" \ + "Finished" "Unmount partitions, exit the installer, and reboot") - if [[ ! $choice || $choice == "$str" ]]; then + if [[ $choice == "" || $choice == "Finished" ]]; then [[ $DEBUG == true && -r $DBG ]] && vim $DBG # when die() is passed 127 it will call: systemctl -i reboot die 127 @@ -673,15 +612,71 @@ edit_configs() ############################################################################### # package menus +select_packages() +{ + local cur=0 + while true; do + (( cur < 13 )) && (( cur++ )) + + tput civis + cur=$(dialog --cr-wrap --stdout --backtitle "$BT" \ + --title " $_Packages " --default-item $cur --menu "$_PackageMenu" 0 0 0 \ + 1 "Web Browsers" \ + 2 "Text Editors" \ + 3 "File Managers" \ + 4 "Terminal Emulators" \ + 5 "Music & Video Players" \ + 6 "Chat & Mail Clients" \ + 7 "Office & Professional" \ + 8 "Image & PDF Viewers" \ + 9 "Additional Fonts" \ + 10 "Torrent Clients" \ + 11 "System Management" \ + 12 "Miscellaneous" \ + 13 "Return to main menu") + + [[ $cur && $cur -lt 13 ]] || break + + case $SEL in + 1) BROWSE_PKGS="$(select_browsers)" ;; + 2) EDIT_PKGS="$(select_editors)" ;; + 3) FM_PKGS="$(select_files)" ;; + 4) TERM_PKGS="$(select_terms)" ;; + 5) MEDIA_PKGS="$(select_media)" ;; + 6) MAIL_PKGS="$(select_mail)" ;; + 7) PROF_PKGS="$(select_prof)" ;; + 8) VIEW_PKGS="$(select_viewers)" ;; + 9) FNT_PKGS="$(select_fonts)" ;; + 10) TOR_PKGS="$(select_torrent)" ;; + 11) SYS_PKGS="$(select_sys)" ;; + 12) EX_PKGS=" $(select_extra)" ;; + esac + USER_PKGS="$BROWSE_PKGS $EDIT_PKGS $FM_PKGS $TERM_PKGS $MEDIA_PKGS $MAIL_PKGS " + USER_PKGS+="$PROF_PKGS $VIEW_PKGS $FNT_PKGS $TOR_PKGS $SYS_PKGS $EX_PKGS" + done + + USER_PKGS="$BROWSE_PKGS $EDIT_PKGS $FM_PKGS $TERM_PKGS $MEDIA_PKGS $MAIL_PKGS " + USER_PKGS+="$PROF_PKGS $VIEW_PKGS $FNT_PKGS $TOR_PKGS $SYS_PKGS $EX_PKGS" + + for i in $USER_PKGS; do + [[ ${PKG_EXT[$i]} && $USER_PKGS != *${PKG_EXT[$i]}* ]] && USER_PKGS+=" ${PKG_EXT[$i]}" + done + + USER_PKGS="${USER_PKGS// / }" + USER_PKGS="${USER_PKGS# }" + return 0 +} + select_browsers() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "firefox" "A popular open-source graphical web browser from Mozilla" off \ - "chromium" "an open-source graphical web browser based on the Blink rendering engine" off \ - "opera" "Fast and secure, free of charge web browser from Opera Software" off \ - "epiphany" "A GNOME web browser based on the WebKit rendering engine" off \ - "qutebrowser" "A keyboard-focused vim-like web browser based on Python and PyQt5" off)" + "firefox" "A popular open-source graphical web browser from Mozilla" $(offon 'firefox') \ + "chromium" "an open-source graphical web browser based on the Blink rendering engine" $(offon 'chromium') \ + "opera" "A Fast and secure, free of charge web browser from Opera Software" $(offon 'opera') \ + "epiphany" "A GNOME web browser based on the WebKit rendering engine" $(offon 'epiphany') \ + "surf" "A simple web browser based on WebKit2/GTK+" $(offon 'surf') \ + "qutebrowser" "A keyboard-focused vim-like web browser based on Python and PyQt5" $(offon 'qutebrowser'))" printf "%s" "$pkgs" } @@ -689,11 +684,11 @@ select_editors() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "neovim" "A fork of Vim aiming to improve user experience, plugins, and GUIs." off \ - "atom" "An open-source text editor developed by GitHub that is licensed under the MIT License" off \ - "geany" "A fast and lightweight IDE" off \ - "emacs" "An extensible, customizable, self-documenting real-time display editor" off \ - "mousepad" "A simple text editor" off)" + "neovim" "A fork of Vim aiming to improve user experience, plugins, and GUIs." $(offon 'neovim') \ + "atom" "An open-source text editor developed by GitHub that is licensed under the MIT License" $(offon 'atom') \ + "geany" "A fast and lightweight IDE" $(offon 'geany') \ + "emacs" "An extensible, customizable, self-documenting real-time display editor" $(offon 'emacs') \ + "mousepad" "A simple text editor" $(offon 'mousepad'))" printf "%s" "$pkgs" } @@ -701,12 +696,12 @@ select_files() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "thunar" "A modern file manager for the Xfce Desktop Environment" off \ - "pcmanfm" "A fast and lightweight file manager based in Lxde" off \ - "nautilus" "The default file manager for Gnome" off \ - "gparted" "A GUI frontend for creating and manipulating partition tables" off \ - "file-roller" "Create and modify archives" off \ - "xarchiver" "A GTK+ frontend to various command line archivers" off)" + "thunar" "A modern file manager for the Xfce Desktop Environment" $(offon 'thunar') \ + "pcmanfm" "A fast and lightweight file manager based in Lxde" $(offon 'pcmanfm') \ + "nautilus" "The default file manager for Gnome" $(offon 'nautilus') \ + "gparted" "A GUI frontend for creating and manipulating partition tables" $(offon 'gparted') \ + "file-roller" "Create and modify archives" $(offon 'file-roller') \ + "xarchiver" "A GTK+ frontend to various command line archivers" $(offon 'xarchiver'))" printf "%s" "$pkgs" } @@ -714,15 +709,15 @@ select_terms() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "termite" "A minimal VTE-based terminal emulator" off \ - "rxvt-unicode" "A unicode enabled rxvt-clone terminal emulator" off \ - "xterm" "The standard terminal emulator for the X window system" off \ - "alacritty" "A cross-platform, GPU-accelerated terminal emulator" off \ - "terminator" "Terminal emulator that supports tabs and grids" off \ - "sakura" "A terminal emulator based on GTK and VTE" off \ - "tilix" "A tiling terminal emulator for Linux using GTK+ 3" off \ - "tilda" "A Gtk based drop down terminal for Linux and Unix" off \ - "xfce4-terminal" "A terminal emulator based in the Xfce Desktop Environment" off)" + "termite" "A minimal VTE-based terminal emulator" $(offon 'termite') \ + "rxvt-unicode" "A unicode enabled rxvt-clone terminal emulator" $(offon 'rxvt-unicode') \ + "xterm" "The standard terminal emulator for the X window system" $(offon 'xterm') \ + "alacritty" "A cross-platform, GPU-accelerated terminal emulator" $(offon 'alacritty') \ + "terminator" "Terminal emulator that supports tabs and grids" $(offon 'terminator') \ + "sakura" "A terminal emulator based on GTK and VTE" $(offon 'sakura') \ + "tilix" "A tiling terminal emulator for Linux using GTK+ 3" $(offon 'tilix') \ + "tilda" "A Gtk based drop down terminal for Linux and Unix" $(offon 'tilda') \ + "xfce4-terminal" "A terminal emulator based in the Xfce Desktop Environment" $(offon 'xfce-terminal'))" printf "%s" "$pkgs" } @@ -730,17 +725,17 @@ select_media() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "vlc" "A free and open source cross-platform multimedia player" off \ - "mpv" "A media player based on mplayer" off \ - "mpd" "A flexible, powerful, server-side application for playing music" off \ - "ncmpcpp" "An mpd client and almost exact clone of ncmpc with some new features" off \ - "cmus" "A small, fast and powerful console music player for Unix-like operating systems" off \ - "audacious" "A free and advanced audio player based on GTK+" off \ - "nicotine+" "A graphical client for Soulseek" off \ - "lollypop" "A new music playing application" off \ - "rhythmbox" "Music playback and management application" off \ - "deadbeef" "A GTK+ audio player for GNU/Linux" off \ - "clementine" "A modern music player and library organizer" off)" + "vlc" "A free and open source cross-platform multimedia player" $(offon 'vlc') \ + "mpv" "A media player based on mplayer" $(offon 'mpv') \ + "mpd" "A flexible, powerful, server-side application for playing music" $(offon 'mpd') \ + "ncmpcpp" "An mpd client and almost exact clone of ncmpc with some new features" $(offon 'ncmpcpp') \ + "cmus" "A small, fast and powerful console music player for Unix-like operating systems" $(offon 'cmus') \ + "audacious" "A free and advanced audio player based on GTK+" $(offon 'audacious') \ + "nicotine+" "A graphical client for Soulseek" $(offon 'nicotine+') \ + "lollypop" "A new music playing application" $(offon 'lollypop') \ + "rhythmbox" "Music playback and management application" $(offon 'rhythmbox') \ + "deadbeef" "A GTK+ audio player for GNU/Linux" $(offon 'deadbeef') \ + "clementine" "A modern music player and library organizer" $(offon 'clementine'))" printf "%s" "$pkgs" } @@ -748,14 +743,14 @@ select_mail() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "thunderbird" "Standalone mail and news reader from mozilla" off \ - "geary" "A lightweight email client for the GNOME desktop" off \ - "evolution" "Manage your email, contacts and schedule" off \ - "mutt" "Small but very powerful text-based mail client" off \ - "hexchat" "A popular and easy to use graphical IRC client" off \ - "pidgin" "Multi-protocol instant messaging client" off \ - "weechat" "Fast, light and extensible IRC client" off \ - "irssi" "Modular text mode IRC client" off)" + "thunderbird" "Standalone mail and news reader from mozilla" $(offon 'thunderbird') \ + "geary" "A lightweight email client for the GNOME desktop" $(offon 'geary') \ + "evolution" "Manage your email, contacts and schedule" $(offon 'evolution') \ + "mutt" "Small but very powerful text-based mail client" $(offon 'mutt') \ + "hexchat" "A popular and easy to use graphical IRC client" $(offon 'hexchat') \ + "pidgin" "Multi-protocol instant messaging client" $(offon 'pidgin') \ + "weechat" "Fast, light and extensible IRC client" $(offon 'weechat') \ + "irssi" "Modular text mode IRC client" $(offon 'irssi'))" printf "%s" "$pkgs" } @@ -763,18 +758,18 @@ select_prof() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "libreoffice-fresh" "Full featured office suite" off \ - "abiword" "Fully-featured word processor" off \ - "calligra" "A set of applications for productivity" off \ - "gimp" "GNU Image Manipulation Program" off \ - "inkscape" "Professional vector graphics editor" off \ - "krita" "Edit and paint images" off \ - "obs-studio" "Free opensource streaming/recording software" off \ - "kdenlive" "A non-linear video editor for Linux using the MLT video framework" off \ - "openshot" "An open-source, non-linear video editor for Linux based on MLT framework" off \ - "audacity" "A program that lets you manipulate digital audio waveforms" off \ - "guvcview" "Capture video from camera devices" off \ - "simplescreenrecorder" "A feature-rich screen recorder" off)" + "libreoffice-fresh" "Full featured office suite" $(offon 'libreoffice-fresh') \ + "abiword" "Fully-featured word processor" $(offon 'abiword') \ + "calligra" "A set of applications for productivity" $(offon 'calligra') \ + "gimp" "GNU Image Manipulation Program" $(offon 'gimp') \ + "inkscape" "Professional vector graphics editor" $(offon 'inkscape') \ + "krita" "Edit and paint images" $(offon 'krita') \ + "obs-studio" "Free opensource streaming/recording software" $(offon 'obs-studio') \ + "kdenlive" "A non-linear video editor for Linux using the MLT video framework" $(offon 'kdenlive') \ + "openshot" "An open-source, non-linear video editor for Linux" $(offon 'openshot') \ + "audacity" "A program that lets you manipulate digital audio waveforms" $(offon 'audacity') \ + "guvcview" "Capture video from camera devices" $(offon 'guvcview') \ + "simplescreenrecorder" "A feature-rich screen recorder" $(offon 'simplescreenrecorder'))" printf "%s" "$pkgs" } @@ -782,12 +777,12 @@ select_fonts() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "ttf-hack" "A hand groomed and optically balanced typeface based on Bitstream Vera Mono" off \ - "ttf-anonymous-pro" "A family of four fixed-width fonts designed especially with coding in mind" off \ - "ttf-font-awesome" "Iconic font designed for Bootstrap" off \ - "ttf-fira-code" "Monospaced font with programming ligatures" off \ - "noto-fonts" "Google Noto fonts" off \ - "noto-fonts-cjk" "Google Noto CJK fonts (Chinese, Japanese, Korean)" off)" + "ttf-hack" "A hand groomed and optically balanced typeface based on Bitstream Vera Mono" $(offon 'ttf-hack') \ + "ttf-anonymous-pro" "A family fixed-width fonts designed with coding in mind" $(offon 'ttf-anonymous-pro') \ + "ttf-font-awesome" "Iconic font designed for Bootstrap" $(offon 'ttf-font-awesome') \ + "ttf-fira-code" "Monospaced font with programming ligatures" $(offon 'ttf-fira-code') \ + "noto-fonts" "Google Noto fonts" $(offon 'noto-fonts') \ + "noto-fonts-cjk" "Google Noto CJK fonts (Chinese, Japanese, Korean)" $(offon 'noto-fonts-cjk'))" printf "%s" "$pkgs" } @@ -795,11 +790,11 @@ select_viewers() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "evince" "A document viewer" off \ - "zathura" "Minimalistic document viewer" off \ - "qpdfview" "A tabbed PDF viewer" off \ - "mupdf" "Lightweight PDF and XPS viewer" off \ - "gpicview" "Lightweight image viewer" off)" + "evince" "A document viewer" $(offon 'evince') \ + "zathura" "Minimalistic document viewer" $(offon 'zathura') \ + "qpdfview" "A tabbed PDF viewer" $(offon 'qpdfview') \ + "mupdf" "Lightweight PDF and XPS viewer" $(offon 'mupdf') \ + "gpicview" "Lightweight image viewer" $(offon 'gpicview'))" printf "%s" "$pkgs" } @@ -807,11 +802,11 @@ select_torrent() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "deluge" "A BitTorrent client written in python" off \ - "qbittorrent" "An advanced BitTorrent client" off \ - "transmission-gtk" "Free BitTorrent client GTK+ GUI" off \ - "transmission-qt" "Free BitTorrent client Qt GUI" off \ - "transmission-cli" "Free BitTorrent client CLI" off)" + "deluge" "A BitTorrent client written in python" $(offon 'deluge') \ + "qbittorrent" "An advanced BitTorrent client" $(offon 'qbittorrent') \ + "transmission-gtk" "Free BitTorrent client GTK+ GUI" $(offon 'transmission-gtk') \ + "transmission-qt" "Free BitTorrent client Qt GUI" $(offon 'transmission-qt') \ + "transmission-cli" "Free BitTorrent client CLI" $(offon 'transmission-cli'))" printf "%s" "$pkgs" } @@ -819,9 +814,9 @@ select_sys() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "gnome-disk-utility" "Disk Management Utility" off \ - "gnome-system-monitor" "View current processes and monitor system state" off \ - "qt5ct" "GUI for managing Qt based application themes, icons, and fonts" off)" + "gnome-disk-utility" "Disk Management Utility" $(offon 'gnome-disk-utility') \ + "gnome-system-monitor" "View current processes and monitor system state" $(offon 'gnome-system-monitor') \ + "qt5ct" "GUI for managing Qt based application themes, icons, and fonts" $(offon 'qt5ct'))" printf "%s" "$pkgs" } @@ -829,15 +824,20 @@ select_extra() { local pkgs="" pkgs="$(checkbox "$_Packages" "$_PackageBody" \ - "steam" "A popular game distribution platform by Valve" off \ - "gpick" "Advanced color picker using GTK+ toolkit" off \ - "gcolor2" "A simple GTK+2 color selector" off \ - "plank" "An elegant, simple, and clean dock" off \ - "docky" "Full fledged dock for opening applications and managing windows" off \ - "cairo-dock" "Light eye-candy fully themable animated dock" off)" + "steam" "A popular game distribution platform by Valve" $(offon 'steam') \ + "gpick" "Advanced color picker using GTK+ toolkit" $(offon 'gpick') \ + "gcolor2" "A simple GTK+2 color selector" $(offon 'gcolor2') \ + "plank" "An elegant, simple, and clean dock" $(offon 'plank') \ + "docky" "Full fledged dock for opening applications and managing windows" $(offon 'docky') \ + "cairo-dock" "Light eye-candy fully themable animated dock" $(offon 'cairo-dock'))" printf "%s" "$pkgs" } +offon() +{ + [[ $USER_PKGS == *$1* ]] && printf "on" || printf "off" +} + ############################################################################### # partition menus @@ -861,26 +861,24 @@ partition() tput civis local choice if [[ $DISPLAY ]] && hash gparted >/dev/null 2>&1; then - if ! choice="$(menubox "$_PartTitle" "$_PartBody" \ - "$_PartShowTree" "-" \ - "$_PartAuto" "-" \ - "gparted -" \ - "cfdisk" "-" \ - "parted" "-" \ - "$_PartWipe" "-" \ - "$_Done" "-")"; then - return 1 - fi + choice="$(menubox "$_PartTitle" "$_PartBody" \ + "$_PartShowTree" "Shows output from the lsblk command" \ + "$_PartAuto" "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")" + else - if ! choice="$(menubox "$_PartTitle" "$_PartBody" \ - "$_PartShowTree" "-" \ - "$_PartAuto" "-" \ - "cfdisk" "-" \ - "parted" "-" \ - "$_PartWipe" "-" \ - "$_Done" "-")"; then - return 1 - fi + choice="$(menubox "$_PartTitle" "$_PartBody" \ + "$_PartShowTree" "Show output of 'lsblk $device'" \ + "$_PartAuto" "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")" + fi tput civis @@ -923,8 +921,6 @@ partition() decr_count() { # remove a partition from the dialog list and decrement the number partitions left - (( $# == 1 )) || return 1 - local p="$1" PARTS="$(sed "s~${p} [0-9]*[G-M]~~; s~${p} [0-9]*\.[0-9]*[G-M]~~" <<< "$PARTS")" (( COUNT > 0 )) && (( COUNT-- )) @@ -962,13 +958,9 @@ device_tree() select_device() { - local dev - local msg - if [[ $1 == 'boot' ]]; then - msg="$_DevSelTitle for bootloader\n" - else - umount_dir $MNT - fi + local dev msg + + [[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || umount_dir $MNT if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then # auto select without mention (it's annoying) @@ -988,11 +980,9 @@ select_device() confirm_mount() { - local part="$1" - local mount="$2" + 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_count "$part" @@ -1006,12 +996,10 @@ confirm_mount() check_cryptlvm() { - local dev="" - local part="$1" - local devs + local dev devs part="$1" devs="$(lsblk -lno NAME,FSTYPE,TYPE)" - # Identify if $part is "crypt" (LUKS on LVM, or LUKS alone) + # Identify if $part is LUKS+LVM, LVM+LUKS, LVM alone, or LUKS alone if [[ $(lsblk -lno TYPE "$part") =~ 'crypt' ]]; then LUKS='encrypted' LUKS_NAME="${part#/dev/mapper/}" @@ -1162,21 +1150,13 @@ find_partitions() 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 = /dev/nvme* ]] && BOOT_DEVICE="${BOOT_PART%p[1-9]}" || BOOT_DEVICE="${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 else parted -s $BOOT_DEVICE set $BOOT_PART_NUM boot on >/dev/null 2>&1 fi - return 0 } @@ -1188,15 +1168,13 @@ mnt_menu() # prepare partition list PARTS for dialog lvm_detect umount_dir $MNT - find_partitions 'part|lvm|crypt' || { SELECTED=2; return 1; } + find_partitions 'part|lvm|crypt' || { SEL=2; return 1; } select_root_partition || return 1 - if [[ $SYS == "UEFI" ]]; then select_efi_partition || { BOOT_PART=""; return 1; } elif (( COUNT > 0 )); then select_boot_partition || { BOOT_PART=""; return 1; } fi - setup_boot || return 1 select_swap || return 1 select_extra_partitions || return 1 @@ -1205,24 +1183,21 @@ mnt_menu() select_swap() { - # Ask user to select partition or create swapfile tput civis - if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)" || [[ $SWAP_PART == "$_SelSwpNone" ]] - then - SWAP_PART="" - return 0 - fi + SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" \ + "$_SelSwpNone" "Don't allocate any swap space" \ + "$_SelSwpFile" "Allocate $SYS_MEM of swap at /swapfile" \ + $PARTS)" - if [[ $SWAP_PART == "$_SelSwpFile" ]]; then + if [[ $SWAP_PART == "" || $SWAP_PART == "$_SelSwpNone" ]]; then + SWAP_PART=""; return 0 + elif [[ $SWAP_PART == "$_SelSwpFile" ]]; 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 - SWAP_PART="" - SWAP_SIZE="" - break - return 0 + SWAP_PART=""; SWAP_SIZE=""; break; return 0 fi ((i++)) done @@ -1239,9 +1214,7 @@ select_swap() select_mountpoint() { tput cnorm - EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/" nolimit)" || return 1 - - # bad mountpoint + EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1" "/" nolimit)" || return 1 if [[ ${EXTRA_MNT:0:1} != "/" || ${#EXTRA_MNT} -le 1 || $EXTRA_MNT =~ \ |\' || $EXTRA_MNTS == *"$EXTRA_MNT"* ]]; then msgbox "$_ErrTitle" "$_ExtErrBody" select_mountpoint || return 1 @@ -1271,7 +1244,7 @@ select_filesystem() local fs cur_fs cur_fs="$(lsblk -lno FSTYPE "$part" 2>/dev/null)" local msg="\nSelect which filesystem to use for: $part\n\nCurrent: ${cur_fs:-None}\nDefault: ext4" - + [[ $part == $ROOT_PART && $ROOT_PART == $AUTO_ROOT_PART && $LUKS == "" && $LVM == "" ]] && return 0 tput civis if [[ $cur_fs && $part != "$ROOT_PART" ]]; then fs="$(menubox "$_FSTitle: $part" "$msg" \ @@ -1300,13 +1273,11 @@ select_filesystem() "reiserfs" "${FS_CMDS[reiserfs]}")" fi [[ $fs ]] || return 1 - if yesno "$_FSTitle" "\nFormat $part as $fs?\n" "Format" "Go Back"; then format "$part" "$fs" || return 1 else select_filesystem "$part" || return 1 fi - return 0 } @@ -1316,12 +1287,15 @@ select_efi_partition() if (( COUNT == 1 )); then BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")" infobox "$_PrepMount" "$_OnlyOne for EFI: $BOOT_PART\n" 1 - elif ! BOOT_PART="$(menubox "$_PrepMount" "$_SelUefiBody" $PARTS)"; then - return 1 elif [[ $BOOT_PART == "$AUTO_BOOT_PART" ]]; then + BOOT_PART="$AUTO_BOOT_PART" return 0 # were done here + else + BOOT_PART="$(menubox "$_PrepMount" "$_SelUefiBody" $PARTS)" fi + [[ $BOOT_PART ]] || return 1 + if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then local msg="$_FormUefiBody $BOOT_PART $_FormUefiBody2" if yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Do Not Format" "no"; then @@ -1339,10 +1313,12 @@ select_efi_partition() select_boot_partition() { tput civis - if ! BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosBody" "$_Skip" "-" $PARTS)" || [[ $BOOT_PART == "$_Skip" ]]; then - BOOT_PART="" - elif [[ $AUTO_BOOT_PART == "$BOOT_PART" ]]; then + if [[ $AUTO_BOOT_PART == "$BOOT_PART" ]]; then + BOOT_PART="$AUTO_BOOT_PART" return 0 # were done here + else + BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosBody" "$_Skip" "-" $PARTS)" + [[ $BOOT_PART == "" || $BOOT_PART == "$_Skip" ]] && { BOOT_PART=""; return 0; } fi if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then @@ -1378,17 +1354,16 @@ select_extra_partitions() while (( COUNT > 0 )); do tput civis local part - if ! part="$(menubox "$_PrepMount " "$_ExtPartBody" "$_Done" "-" $PARTS)" || [[ $part == "$_Done" ]]; then + part="$(menubox "$_PrepMount " "$_ExtPartBody" "$_Done" "Return to the last menu" $PARTS)" + + if [[ $part == "$_Done" || $part == "" ]]; then break elif ! select_filesystem "$part"; then - break - return 1 + break; return 1 elif ! select_mountpoint; then - break - return 1 + break; return 1 elif ! mount_partition "$part" "$EXTRA_MNT"; then - break - return 1 + break; return 1 fi EXTRA_MNTS="$EXTRA_MNTS $part: $EXTRA_MNT" [[ $EXTRA_MNT == '/usr' && $HOOKS != *usr* ]] && HOOKS="usr $HOOKS" @@ -1538,16 +1513,14 @@ create_user() chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR errshow 1 "Setting new users password" - if [[ $PACKAGES == *neovim* ]]; then + if [[ $USER_PKGS == *neovim* ]]; then mkdir -p $MNT/home/$NEWUSER/.config/nvim cp -fv $MNT/home/$NEWUSER/.vimrc $MNT/home/$NEWUSER/.config/nvim/init.vim cp -rfv $MNT/home/$NEWUSER/.vim/colors $MNT/home/$NEWUSER/.config/nvim/colors fi + [[ $INSTALL_WMS == *dwm* ]] && suckless_install - if [[ $INSTALL_WMS == 'plasma' || $LOGIN_WM == 'startkde' || $INSTALL_WMS == 'gnome' || $LOGIN_WM == 'gnome-session' ]] - then - sed -i '/super/d' $HOME/.xprofile /root/.xprofile - fi + [[ $LOGIN_WM =~ (startkde|gnome-session) ]] && sed -i '/super/d' $HOME/.xprofile /root/.xprofile return 0 } @@ -1666,7 +1639,7 @@ login_manager() run_mkinitcpio() { local add="" - [[ $LUKS && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile + [[ $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 @@ -1688,22 +1661,14 @@ mirrorlist_sort() package_operations() { - if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|dwm) ]]; then - local inpkg="$PACKAGES $BASE_PKGS $WM_BASE_PKGS" - else - local inpkg="$PACKAGES $BASE_PKGS" - fi - - [[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+=" archlabs-ksuperkey" - - if [[ $KERNEL == 'linux-lts' ]]; then - inpkg+=" linux-lts" - local rmpkg="archlabs-installer linux" - else - local rmpkg="archlabs-installer" - fi + local rmpkg="archlabs-installer" + local inpkg="$BASE_PKGS $PACKAGES $USER_PKGS" + [[ $MYSHELL == *mksh* ]] && inpkg+=" mksh" [[ $BOOTLDR == 'grub' ]] && inpkg+=" grub" + [[ $KERNEL == 'linux-lts' ]] && { inpkg+=" linux-lts"; rmpkg+=" linux"; } + [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|dwm) ]] && inpkg+="$WM_BASE_PKGS" + [[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+=" archlabs-ksuperkey" chrun "pacman -Syyu --noconfirm" chrun "pacman -Rns $rmpkg --noconfirm" @@ -1741,9 +1706,8 @@ suckless_install() setup_boot() { tput civis - if ! BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" ${BOOTLDRS[$SYS]})"; then - return 1 - fi + BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" ${BOOTLDRS[$SYS]})" + [[ $BOOTLDR ]] || return 1 if [[ $BOOT_PART != "" ]]; then mount_partition "$BOOT_PART" "${BMNTS[$SYS-$BOOTLDR]}" && SEP_BOOT=true || return 1 @@ -1774,12 +1738,12 @@ setup_grub() fi BCMDS[grub]="mkdir -p /run/udev /run/lvm && - mount -t tmpfs tmpfs /run && mount --bind /hostrun/udev /run/udev && mount --bind /hostrun/lvm /run/lvm && ${BCMDS[grub]} && grub-mkconfig -o /boot/grub/grub.cfg && - sleep 1 && umount -R /run" + sleep 1 && umount /run/udev /run/lvm" + return 0 } @@ -1948,7 +1912,7 @@ lvm_menu() "$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \ "$_LvmDelVG" "vgremove -f" \ "$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \ - "$_Back" "-")" + "$_Back" "Return to the main menu")" case $choice in "$_LvmCreateVG") lvm_create && return 0 ;; @@ -1979,21 +1943,13 @@ lvm_show_vg() { DEL_VG="" VOL_GROUP_LIST="" - for i in $(lvs --noheadings | awk '{print $2}' | uniq); do VOL_GROUP_LIST="$VOL_GROUP_LIST $i $(vgdisplay "$i" | awk '/VG Size/ {print $3$4}')" done - - if [[ $VOL_GROUP_LIST == "" ]]; then - msgbox "$_ErrTitle" "$_LvmVGErr" - return 1 - fi - + [[ $VOL_GROUP_LIST == "" ]] && { msgbox "$_ErrTitle" "$_LvmVGErr"; return 1; } tput civis - if ! DEL_VG="$(menubox "$_PrepLVM" "$_LvmSelVGBody" $VOL_GROUP_LIST)"; then - return 1 - fi - return 0 + DEL_VG="$(menubox "$_PrepLVM" "$_LvmSelVGBody" $VOL_GROUP_LIST)" + [[ $DEL_VG ]] } get_lv_size() @@ -2001,46 +1957,28 @@ get_lv_size() tput cnorm local ttl=" $_LvmCreateVG (LV:$VOL_COUNT) " local msg="${VOLUME_GROUP}: ${GROUP_SIZE}$GROUP_SIZE_TYPE (${VGROUP_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2" - if ! VOLUME_SIZE="$(getinput "$ttl" "$msg" "")"; then - return 1 - fi - + VOLUME_SIZE="$(getinput "$ttl" "$msg" "")" + [[ $VOLUME_SIZE ]] || return 1 ERR_SIZE=0 (( ${#VOLUME_SIZE} == 0 || ${VOLUME_SIZE:0:1} == 0 )) && ERR_SIZE=1 if (( ERR_SIZE == 0 )); then local lv="$((${#VOLUME_SIZE} - 1))" - for (( i=0; i= VGROUP_MB )); then - ERR_SIZE=1 - else - VGROUP_MB=$((VGROUP_MB - m)) - fi - ;; - [Mm]) - if (( ${VOLUME_SIZE:0:$lv} >= VGROUP_MB )); then - ERR_SIZE=1 - else - VGROUP_MB=$((VGROUP_MB - s)) - fi - ;; - *) - ERR_SIZE=1 + [Gg]) (( m >= VGROUP_MB )) && ERR_SIZE=1 || VGROUP_MB=$((VGROUP_MB - m)) ;; + [Mm]) (( ${VOLUME_SIZE:0:$lv} >= VGROUP_MB )) && ERR_SIZE=1 || VGROUP_MB=$((VGROUP_MB - s)) ;; + *) ERR_SIZE=1 esac fi fi @@ -2109,13 +2047,13 @@ lvm_extra_lvs() lvm_volume_count() { - if ! VOL_COUNT=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $_LvmCreateVG " \ + 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); then - return 1 - fi - return 0 + "6" "-" off "7" "-" off "8" "-" off "9" "-" off) + + [[ $VOL_COUNT ]] } lvm_partitions() @@ -2181,7 +2119,6 @@ lvm_create() sleep 0.5 local msg="${_Done}$_LvmPvDoneBody1 $VOLUME_GROUP-$VOLUME_NAME (${VOLUME_SIZE:-${VGROUP_MB}MB}) $_LvmPvDoneBody2." msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE "${LVM_PARTS[@]}")" - return 0 } @@ -2227,7 +2164,7 @@ luks_menu() "$_LuksEncrypt" "cryptsetup -q luksFormat" \ "$_LuksOpen" "cryptsetup open --type luks" \ "$_LuksEncryptAdv" "cryptsetup -q -s -c luksFormat" \ - "$_Back" "-")" + "$_Back" "Return to the main menu")" case $choice in "$_LuksEncrypt") luks_default && return 0 ;; @@ -2537,7 +2474,7 @@ load_bcm() chk_connect() { if [[ $CHECKED_NET == true ]]; then - infobox "Network Connect" "\nVerifying connection to https://www.archlinux.org\n" 1 + infobox "Network Connect" "\nVerifying connection\n" 1 else infobox "Network Connect" "\nChecking connection to https://www.archlinux.org\n" 1 CHECKED_NET=true @@ -2584,11 +2521,11 @@ system_checks() prechecks() { if [[ $1 -ge 0 ]] && ! [[ $(lsblk -lno MOUNTPOINT) =~ $MNT ]]; then - msgbox "$_ErrTitle" "$_ErrNoMount"; SELECTED=4; return 1 + msgbox "$_ErrTitle" "$_ErrNoMount"; SEL=4; return 1 elif [[ $1 -ge 1 && ($NEWUSER == "" || $USER_PASS == "") ]]; then - msgbox "$_ErrTitle" "\nYou need to create a user first.\n"; SELECTED=5; return 1 + msgbox "$_ErrTitle" "\nYou need to create a user first.\n"; SEL=5; return 1 elif [[ $1 -ge 2 && $CONFIG_DONE != true ]]; then - msgbox "$_ErrTitle" "$_ErrNoConfig"; SELECTED=6; return 1 + msgbox "$_ErrTitle" "$_ErrNoConfig"; SEL=6; return 1 fi return 0 }