From a636d927e68e07e8a3ddceafc62cdffb1fd87cea Mon Sep 17 00:00:00 2001 From: natemaia Date: Wed, 9 Jan 2019 17:25:36 -0800 Subject: [PATCH] Remove oneshot(), functions will be run multiple times if choosing the relevant section --- lang/english.trans | 46 +++-- src/archlabs-installer | 432 +++++++++++++++-------------------------- 2 files changed, 178 insertions(+), 300 deletions(-) diff --git a/lang/english.trans b/lang/english.trans index 11d1ec8..921dcd3 100644 --- a/lang/english.trans +++ b/lang/english.trans @@ -26,25 +26,21 @@ _NoNetwork="\nThis installer needs to be run with an active internet connection # Preparation Menu _PrepTitle="Prepare System for Install" _PrepBody="\nFollow the below steps in order.\n\nTo begin the install, a root (/) partition must first be mounted and the system settings must be configured (UEFI systems also require a boot partition to be mounted).\n\nIf you have already created a partition table and partition(s) you can begin mounting and skip over the editing step." -_PrepLayout="Select Keyboard Layout" -_PrepShowDev="Show Device Tree (optional)" -_PrepParts="Edit Partitions (optional)" -_PrepLUKS="LUKS Encryption (optional)" -_PrepLVM="Logical Volume Management (optional)" -_PrepMount="Mount and Format Partitions" -_PrepUser="Create User and Set root Password" -_PrepConfig="Configure System Settings" -_PrepWM="Select Window Manager or Desktop" -_PrepPkg="Select Additional Packages" -_PrepShow="Check Configuration Choices" -_PrepInstall="Begin $DIST Installation" - -# Configure -_ConfHost="System Hostname" -_ConfLocale="Language and Timezone" +_PrepLayout="Select keyboard layout" +_PrepShowDev="Show device tree (optional)" +_PrepParts="Edit partitions (optional)" +_PrepLUKS="LUKS encryption (optional)" +_PrepLVM="Logical volume management (optional)" +_PrepMount="Mount and format partitions" +_PrepUser="Create user and set root Password" +_PrepConfig="Configure system settings" +_PrepWM="Select window manager or desktop (optional)" +_PrepPkg="Select additional packages (optional)" +_PrepShow="Check configuration choices (optional)" +_PrepInstall="Start the installation" # Select Config Files -_EditTitle="Edit Files" +_EditTitle="Edit System Configuration" _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 @@ -59,7 +55,7 @@ _ErrChoiceConsole="\nUnmount the partitions and exit to view the error log or ke _TimeZTitle="Set Timezone" _TimeZBody="\nThe time zone is used to set the system clock.\n\nSelect your country or continent from the list below" _TimeSubZBody="\nSelect the nearest city to your location from the list below." -_TimeZQ="\nSet time zone as:" +_TimeZQ="\nConfirm time zone:" # bootloader _MntBootBody="\nSelect which bootloader to use." @@ -68,19 +64,19 @@ _InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)? # mirrors _MirrorTitle="Setup Mirrorlist" -_MirrorSetup="\nWant the mirrorlist automatically sorted?\n\nThis will take longer but gets the fastest mirrors.\n" -_MirrorCmd="\nThe command below will be used to sort the mirrorlist, edit the command if needed.\n" +_MirrorSetup="\nSort the mirrorlist automatically?\n\nThis takes longer but gets the 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 (de)select window manager(s) or desktop environment(s) to install.\n\nDepending on your choice additional packages may be installed to improve the experience." +_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." _Packages="Install Packages" _PackageMenu="\nSelect a package category to choose packages from that category.\n\nWhen finished select '$_Done' to finalize choices and continue.\n\nAdditional packages can be added by simply re-visiting the menu, however removing choices will require starting from the beginning of the configure menu." _PackageBody="\nUse [Space] to (de)select packages(s) to install from the list below.\n\nNOTE: Some packages may already be installed by your DE (if any) or added automatically depending on your choice of WM. Additionally, extra packages may be installed to improve the experience for another choice eg. when installing qutebrowser qt5ct (the Qt5 theme tool) will also be installed." # login setup -_WMLogin="Select Login Managment" +_WMLogin="Setup 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" @@ -91,7 +87,9 @@ _CMapBody="\nSelect virtual console keymap.\n\nVirtual console is the shell prom _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" _LocaleBody="\nLocale determines the date, time, currency, and language.\n\nThe format is language_COUNTRY\n\neg. en_US: english United States\n en_GB: english Great Britain" -# Set hostname +# Configure +_ConfLocale="System Language and Locale" +_ConfHost="System Hostname" _HostNameBody="\nEnter the 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 @@ -125,7 +123,7 @@ _KernelBody="\nSelect which kernel to use for the install." # shell _ShellTitle="Choose Login Shell" -_ShellBody="\nSelect which shell to use as the new user's login shell." +_ShellBody="\nChoose a shell for the new user and root." # Partitioning Menu _PartTitle="Partitioning Tool" diff --git a/src/archlabs-installer b/src/archlabs-installer index e0834da..81c951c 100755 --- a/src/archlabs-installer +++ b/src/archlabs-installer @@ -8,9 +8,9 @@ # Some ideas and code has been taken from other installers # AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due -VER="1.8.3" # Installer version -DIST="ArchLabs" # Installer distributor -MNT="/mnt" # Installer mountpoint +VER="1.8.6" # version +DIST="ArchLabs" # distributor +MNT="/mnt" # mountpoint main() { @@ -28,7 +28,7 @@ main() tput civis SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ --title " $_PrepTitle " --default-item $SELECTED \ - --cancel-label "Exit" --menu "$_PrepBody" 0 0 0 \ + --cancel-label 'Exit' --menu "$_PrepBody" 0 0 14 \ "1" "$_PrepShowDev" \ "2" "$_PrepParts" \ "3" "$_PrepLUKS" \ @@ -104,10 +104,8 @@ chrun() json() { - # get a value from http://api.ipstack.com in json format using my API key - # this includes: ip, geolocation, country name - curl -s "http://api.ipstack.com/$2" | - python3 -c "import sys, json; print(json.load(sys.stdin)['$1'])" + # get a value from http://api.ipstack.com in json format using my API key this includes: ip, geolocation, country name + curl -s "http://api.ipstack.com/$2" | python3 -c "import sys, json; print(json.load(sys.stdin)['$1'])" } src() @@ -161,8 +159,6 @@ die() fi fi - rm -fv /tmp/.ai_* - exit $exitcode } @@ -177,7 +173,7 @@ print4() { # takes an arbitrary number of input fields and prints them out in fourths on separate lines local str="$*" - if [[ ${#str} -gt $(( ${COLUMNS:-$(tput cols)} / 2 )) ]]; then + if [[ ${#str} -gt $((COLUMNS / 2)) ]]; then str="$(awk -v q="$(awk '{print int(NF / 4)}' <<< "$str")" '{ pkgs1=pkgs2=pkgs3=pkgs4="" for (i=1; i/dev/null 2>&1; then tput civis nmtui-connect - if ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | sed '1q' | grep -qw '200'; then - return 1 - fi + chk_connect || return 1 else return 1 fi fi - # if we've made it here we likely have a good connection return 0 } @@ -301,7 +288,6 @@ system_checks() # connect or confirm connection, otherwise bail net_connect || { infobox "$_ErrTitle" "$_NoNetwork\n$_Exit" 3; die 1; } - } preinstall_checks() @@ -315,16 +301,13 @@ preinstall_checks() SELECTED=5 return 1 fi - return 0 } errshow() { local last_exit_code=$? - if (( last_exit_code == 0 )); then - return 0 - fi + (( last_exit_code == 0 )) && return 0 local err err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")" @@ -339,9 +322,7 @@ errshow() echeck() { local last_exit_code=$? - if (( last_exit_code == 0 )); then - return 0 - fi + (( last_exit_code == 0 )) && return 0 local err err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")" @@ -352,9 +333,7 @@ echeck() msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n" fi - if [[ -e $DBG && $TERM == 'linux' ]]; then - more $DBG - fi + [[ -e $DBG && $TERM == 'linux' ]] && more $DBG die 1 } @@ -370,9 +349,7 @@ debug() umount_dir() { swapoff -a - if [[ -d $1 ]]; then - umount -R $1 >/dev/null 2>&1 - fi + [[ -d $1 ]] && umount -R $1 >/dev/null 2>&1 return 0 } @@ -384,11 +361,12 @@ msgbox() menubox() { - local title="$1" body="$2" h=$3 w=$4 n=$5 - shift 5 + local title="$1" + local body="$2" + shift 2 local response if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ - --title " $title " --menu "$body" $h $w $n "$@")"; then + --title " $title " --menu "$body" 0 0 0 "$@")"; then return 1 fi printf "%s" "$response" @@ -398,13 +376,10 @@ checkbox() { local title="$1" local body="$2" - local h=$3 - local w=$4 - local n=$5 - shift 5 + shift 2 local response if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ - --title " $title " --checklist "$body" $h $w $n "$@")"; then + --title " $title " --checklist "$body" 0 0 0 "$@")"; then return 1 fi printf "%s" "$response" @@ -413,10 +388,16 @@ checkbox() getinput() { local answer - if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --backtitle "$BT" \ - --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then - return 1 + if [[ $# -eq 4 && $4 == 'nolimit' ]]; then + answer="$(dialog --cr-wrap --stdout --backtitle "$BT" \ + --title " $1 " --inputbox "$2" 0 0 "$3")" + else + answer="$(dialog --cr-wrap --max-input 63 --stdout --backtitle "$BT" \ + --title " $1 " --inputbox "$2" 0 0 "$3")" fi + + local e=$? + [[ $e -ne 0 || $answer == "" ]] && return 1 printf "%s" "$answer" } @@ -449,7 +430,7 @@ yesno() select_browsers() { local pkgs="" - pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \ + 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 \ @@ -461,7 +442,7 @@ select_browsers() select_editors() { local pkgs="" - pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \ + 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 \ @@ -473,7 +454,7 @@ select_editors() select_terminals() { local pkgs="" - pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \ + 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 \ @@ -489,7 +470,7 @@ select_terminals() select_multimedia() { local pkgs="" - pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \ + 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 \ @@ -507,7 +488,7 @@ select_multimedia() select_mailchat() { local pkgs="" - pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \ + 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 \ @@ -522,7 +503,7 @@ select_mailchat() select_prof() { local pkgs="" - pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \ + 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 \ @@ -541,7 +522,7 @@ select_prof() select_managment() { local pkgs="" - pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \ + 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 \ "gparted" "A GUI frontend for creating and manipulating partition tables" off \ @@ -562,7 +543,7 @@ select_managment() select_extra() { local pkgs="" - pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \ + pkgs="$(checkbox "$_Packages" "$_PackageBody" \ "steam" "A popular game distribution platform by Valve" off \ "deluge" "A BitTorrent client written in python" off \ "transmission-gtk" "Free BitTorrent client GTK+ GUI" off \ @@ -603,7 +584,7 @@ partition() tput civis local choice if [[ $DISPLAY ]] && hash gparted >/dev/null 2>&1; then - if ! choice="$(menubox "$_PartTitle" "$_PartBody" 0 0 0 \ + if ! choice="$(menubox "$_PartTitle" "$_PartBody" \ "$_PartShowTree" "-" \ "$_PartAuto" "-" \ "gparted -" \ @@ -613,7 +594,7 @@ partition() return 1 fi else - if ! choice="$(menubox "$_PartTitle" "$_PartBody" 0 0 0 \ + if ! choice="$(menubox "$_PartTitle" "$_PartBody" \ "$_PartShowTree" "-" \ "$_PartAuto" "-" \ "cfdisk" "-" \ @@ -693,7 +674,7 @@ select_device() DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")" elif (( DEV_COUNT > 1 )); then tput civis - if ! DEVICE="$(menubox "$_DevSelTitle " "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"; then + if ! DEVICE="$(menubox "$_DevSelTitle " "${msg}$_DevSelBody" $SYS_DEVS)"; then return 1 fi elif [[ $DEV_COUNT -lt 1 && $1 != 'boot' ]]; then @@ -867,15 +848,6 @@ mount_partition() return 0 } -mount_boot_part() -{ - if ! mount_partition "$BOOT_PART" "${BMNTS[$SYS-$BOOTLDR]}"; then - return 1 - else - SEP_BOOT=true - fi -} - find_partitions() { local str="$1" @@ -965,7 +937,7 @@ select_swap() { # Ask user to select partition or create swapfile tput civis - if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" 0 0 0 \ + if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" \ "$_SelSwpNone" "-" \ "$_SelSwpFile" "$SYS_MEM" \ $PARTS)" || @@ -1001,7 +973,7 @@ select_swap() select_mountpoint() { tput cnorm - if ! EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/")"; then + if ! EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/" nolimit)"; then return 1 fi @@ -1048,7 +1020,7 @@ select_filesystem() tput civis if [[ $cur_fs && $part != "$ROOT_PART" ]]; then fs="$(menubox "$_FSTitle: $part" \ - "${msg}${part}\nExisting Filesystem: ${cur_fs}$_FSBody" 0 0 0 \ + "${msg}${part}\nExisting Filesystem: ${cur_fs}$_FSBody" \ "$_Skip" "-" \ "ext4" "${FS_CMDS[ext4]}" \ "ext3" "${FS_CMDS[ext3]}" \ @@ -1061,8 +1033,7 @@ select_filesystem() "reiserfs" "${FS_CMDS[reiserfs]}" \ "xfs" "${FS_CMDS[xfs]}")" else - fs="$(menubox "$_FSTitle: $part" \ - "${msg}${part}$_FSBody" 0 0 0 \ + fs="$(menubox "$_FSTitle: $part" "${msg}${part}$_FSBody" \ "ext4" "${FS_CMDS[ext4]}" \ "ext3" "${FS_CMDS[ext3]}" \ "ext2" "${FS_CMDS[ext2]}" \ @@ -1096,7 +1067,7 @@ 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" 0 0 0 $PARTS)"; then + elif ! BOOT_PART="$(menubox "$_PrepMount" "$_SelUefiBody" $PARTS)"; then return 1 fi @@ -1116,7 +1087,7 @@ select_efi_partition() select_boot_partition() { tput civis - if ! BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)" || [[ $BOOT_PART == "$_Skip" ]]; then + if ! BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosBody" "$_Skip" "-" $PARTS)" || [[ $BOOT_PART == "$_Skip" ]]; then BOOT_PART="" else if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then @@ -1139,7 +1110,7 @@ select_root_partition() 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="$(menubox "$_PrepMount" "$_SelRootBody" 0 0 0 $PARTS)"; then + elif ! ROOT_PART="$(menubox "$_PrepMount" "$_SelRootBody" $PARTS)"; then return 1 fi @@ -1153,7 +1124,7 @@ select_extra_partitions() while (( COUNT > 0 )); do tput civis local part - if ! part="$(menubox "$_PrepMount " "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)" || [[ $part == "$_Done" ]]; then + if ! part="$(menubox "$_PrepMount " "$_ExtPartBody" "$_Done" "-" $PARTS)" || [[ $part == "$_Done" ]]; then break elif ! select_filesystem "$part"; then break @@ -1182,7 +1153,7 @@ lvm_menu() local choice choice="$(dialog --cr-wrap --stdout --backtitle "$BT" \ - --title " $_PrepLVM " --menu "$_LvmMenu" 0 0 0 \ + --title " $_PrepLVM " --menu "$_LvmMenu" 0 0 6 \ "$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \ "$_LvmDelVG" "vgremove -f" \ "$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \ @@ -1206,7 +1177,7 @@ lvm_detect() if [[ $VOLUMES && $VOLUME_GROUP && $PHYSICAL_VOLUMES ]]; then infobox "$_PrepLVM" "$_LvmDetBody" 1 - modprobe dm-mod 2>$ERR + modprobe dm-mod >/dev/null 2>$ERR errshow 'modprobe dm-mod' vgscan >/dev/null 2>&1 vgchange -ay >/dev/null 2>&1 @@ -1228,7 +1199,7 @@ lvm_show_vg() fi tput civis - if ! DEL_VG="$(menubox "$_PrepLVM" "$_LvmSelVGBody" 18 70 10 $VOL_GROUP_LIST)"; then + if ! DEL_VG="$(menubox "$_PrepLVM" "$_LvmSelVGBody" $VOL_GROUP_LIST)"; then return 1 fi return 0 @@ -1307,7 +1278,7 @@ lvm_volume_name() tput cnorm local name - if ! name="$(getinput "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg" "$default")"; then + if ! name="$(getinput "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg" "$default" nolimit)"; then return 1 fi @@ -1325,7 +1296,7 @@ lvm_group_name() { tput cnorm local group - if ! group="$(getinput "$_LvmCreateVG" "$_LvmNameVgBody" "VolGroup")"; then + if ! group="$(getinput "$_LvmCreateVG" "$_LvmNameVgBody" "VolGroup" nolimit)"; then return 1 fi @@ -1359,9 +1330,8 @@ lvm_extra_lvs() lvm_volume_count() { - if ! VOL_COUNT=$(dialog --cr-wrap --no-cancel --stdout \ - --backtitle "$BT" --title " $_LvmCreateVG " \ - --radiolist "$_LvmLvNumBody1 $VOLUME_GROUP\n$_LvmLvNumBody2" 0 0 0 \ + if ! VOL_COUNT=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $_LvmCreateVG " \ + --radiolist "$_LvmLvNumBody1 $VOLUME_GROUP\n$_LvmLvNumBody2" 0 0 14 \ "1" "-" off "2" "-" off "3" "-" off "4" "-" off "5" "-" off \ "6" "-" off "7" "-" off "8" "-" off "9" "-" off); then return 1 @@ -1481,7 +1451,7 @@ luks_menu() tput civis local choice choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepLUKS " \ - --menu "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 0 \ + --menu "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 6 \ "$_LuksEncrypt" "cryptsetup -q luksFormat" \ "$_LuksOpen" "cryptsetup open --type luks" \ "$_LuksEncryptAdv" "cryptsetup -q -s -c luksFormat" \ @@ -1508,7 +1478,7 @@ luks_open() if (( COUNT == 1 )); then LUKS_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")" infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1 - elif ! LUKS_PART="$(menubox "$_LuksOpen" "$_LuksMenuBody" 0 0 0 $PARTS)" || ! [[ $LUKS_PART ]]; then + elif ! LUKS_PART="$(menubox "$_LuksOpen" "$_LuksMenuBody" $PARTS)" || ! [[ $LUKS_PART ]]; then return 1 fi @@ -1540,9 +1510,9 @@ luks_pass() --ok-label "Submit" --backtitle "$BT" \ --title " $title " --insecure --mixedform \ "\nEnter the password to decrypt $ROOT_PART. - \nThis is needed to create a keyfile." 14 75 3 \ - "$_Password" 1 1 "" 1 $((${#_Password} + 2)) 71 0 1 \ - "$_Password2" 2 1 "" 2 $((${#_Password2} + 2)) 71 0 1)"; then + \nThis is needed to create a keyfile." 0 0 6 \ + "$_Password" 1 1 "" 1 $((${#_Password} + 2)) $COLUMNS 0 1 \ + "$_Password2" 2 1 "" 2 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then return 1 fi pass="$(awk -F'~' '{print $1}' <<< "$values")" @@ -1550,10 +1520,10 @@ luks_pass() else if ! values="$(dialog --stdout --no-cancel --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 + --insecure --mixedform "$_LuksOpenBody" 0 0 6 \ + "$_Name" 1 1 "$name" 1 $((${#_Name} + 2)) $COLUMNS 0 0 \ + "$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \ + "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then return 1 fi @@ -1584,7 +1554,7 @@ luks_setup() 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 + elif ! LUKS_PART="$(menubox "$_LuksEncrypt" "$_LuksEncryptBody" $PARTS)"; then return 1 elif ! luks_pass "$_LuksEncrypt" "${LUKS_NAME:-cryptroot}"; then return 1 @@ -1614,7 +1584,7 @@ luks_keycmd() if luks_setup; then tput cnorm local cipher - if ! cipher="$(getinput "$_PrepLUKS" "$_LuksCipherKey" "-s 512 -c aes-xts-plain64")"; then + if ! cipher="$(getinput "$_PrepLUKS" "$_LuksCipherKey" "-s 512 -c aes-xts-plain64" nolimit)"; then return 1 fi infobox "$_LuksEncryptAdv" "$_LuksCreateWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0 @@ -1664,25 +1634,22 @@ luks_keyfile() install() { - # NOTE: function calls prefixed with 'oneshot' will only ever be run once - # this allows running install() multiple times without redoing things - clear tput cnorm # unpack the file system - oneshot install_base + install_base # generate /etc/fstab and touch it up if we used a swapfile - genfstab -U $MNT > $MNT/etc/fstab 2>$ERR - echeck "genfstab -U $MNT > $MNT/etc/fstab" + genfstab -U $MNT >$MNT/etc/fstab 2>$ERR + echeck "genfstab -U $MNT >$MNT/etc/fstab" [[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab # update the mirrorlist.. MUST be done before updating or it may be slow - oneshot mirrorlist_sort + mirrorlist_sort # MUST be before bootloader and running mkinitcpio - oneshot package_operations + package_operations # mkinitcpio and bootloader install should only be done after installing the packages # and updating the mirrorlist, otherwise the chosen kernel may not be fully set up @@ -1693,10 +1660,10 @@ install() chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa" # create the user - oneshot create_user + create_user # set up user login.. MUST be done after package operation and user creation - oneshot login_manager + login_manager # fix any messed up file permissions from editing during install chrun "chown -Rf $NEWUSER:users /home/$NEWUSER" @@ -1711,19 +1678,11 @@ install() install_base() { if [[ -e /run/archiso/sfs/airootfs/etc/skel ]]; then - printf "\n\nUnpacking base system --- Total: ~ 2.6G\n\n" - rsync -ah --info=progress2 /run/archiso/sfs/airootfs/ $MNT/ + rsync -ahv /run/archiso/sfs/airootfs/ $MNT/ 2>/dev/null else - oneshot mirrorlist_sort - local vmpkgs - if [[ $VM && $KERNEL == 'linux-lts' ]]; then - vmpkgs="virtualbox-guest-utils virtualbox-guest-dkms linux-lts-headers" - elif [[ $VM && $KERNEL == 'linux' ]]; then - vmpkgs="virtualbox-guest-utils virtualbox-guest-modules-arch" - fi + mirrorlist_sort local packages - packages="$(grep -hv '^#' /usr/share/archlabs/installer/packages.txt)" - pacstrap $MNT base $KERNEL $UCODE $packages $vmpkgs + pacstrap $MNT base $KERNEL $UCODE $(grep -hv '^#' /usr/share/archlabs/installer/packages.txt) fi printf "\n" @@ -1809,18 +1768,16 @@ create_user() { # set root password and shell if needed chrun "chpasswd <<< 'root:$ROOT_PASS'" - if [[ $MYSHELL != *zsh ]]; then chrun "usermod -s $MYSHELL root" - cp -fv $MNT/etc/skel/.mkshrc /root/.mkshrc + if [[ $MYSHELL == "/usr/bin/mksh" ]]; then + cp -fv $MNT/etc/skel/.mkshrc /root/.mkshrc + fi fi - local groups='audio,autologin,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' - - # setup the autologin group - chrun "groupadd -r autologin" - # Create the user, set password, and make sure the ownership of ~/ is correct + local groups='audio,autologin,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' + chrun "groupadd -r autologin" chrun "useradd -m -u 1000 -g users -G $groups -s $MYSHELL $NEWUSER" 2>$ERR chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" @@ -1831,9 +1788,7 @@ create_user() cp -rfv $MNT/home/$NEWUSER/.vim/colors $MNT/home/$NEWUSER/.config/nvim/colors fi - if [[ $INSTALL_WMS =~ dwm ]]; then - suckless_install - fi + [[ $INSTALL_WMS =~ dwm ]] && suckless_install if [[ $INSTALL_WMS == 'plasma' || $LOGIN_WM == 'startkde' ]]; then # plasma has their own superkey daemon that conflicts with ksuperkey @@ -1857,11 +1812,9 @@ setup_xinit() case $MYSHELL in "/bin/bash") loginrc=".bash_profile" - rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* ;; "/usr/bin/mksh") loginrc=".profile" - rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* cat >> $MNT/home/$NEWUSER/.mkshrc << EOF # colors in less (manpager) @@ -1882,12 +1835,10 @@ for f in "\$HOME/.mksh/"*?.sh; do done al-info - EOF ;; *) loginrc=".zprofile" - rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* esac if ! [[ ${EDIT_FILES[login]} =~ $loginrc ]]; then @@ -1938,6 +1889,12 @@ login_manager() # remove welcome message sed -i '/printf/d' $MNT/root/.zshrc + case $MYSHELL in + "/bin/bash") rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* ;; + "/usr/bin/mksh") rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* $MNT/home/$NEWUSER/.inputrc ;; + "/usr/bin/zsh") rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* $MNT/home/$NEWUSER/.inputrc ;; + esac + if [[ $LOGIN_TYPE == 'lightdm' ]]; then setup_lightdm else @@ -1948,22 +1905,10 @@ login_manager() run_mkinitcpio() { local add="" - # setup a keyfile for LUKS.. Only when choosing grub and system is UEFI - if [[ $LUKS && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]]; then - luks_keyfile - fi - - # new hooks needed in /etc/mkinitcpio.conf if we used LUKS and/or LVM + [[ $LUKS && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile [[ $LUKS ]] && add="encrypt" - - if [[ $LVM && $add ]]; then - add+=" lvm2" - elif [[ $LVM ]]; then - add="lvm2" - fi - + [[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; } sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" $MNT/etc/mkinitcpio.conf - chrun "mkinitcpio -p $KERNEL" 2>$ERR echeck "mkinitcpio -p $KERNEL" } @@ -1989,39 +1934,23 @@ package_operations() rmpkg+=" linux" inpkg+=" linux-lts" fi - - if [[ $INSTALL_WMS == 'plasma' ]]; then - rmpkg+=" archlabs-ksuperkey" + if [[ $INSTALL_WMS == 'plasma' || $INSTALL_WMS == 'gnome' || $INSTALL_WMS == 'cinnamon' ]]; then + chrun "pacman -Rnsc archlabs-ksuperkey xfce4 --noconfirm" fi - - # if the system is a VM then install the needed packages - if [[ $VM ]]; then - inpkg+=" virtualbox-guest-utils" - if [[ $KERNEL == 'linux-lts' ]]; then - inpkg+=" virtualbox-guest-dkms linux-lts-headers" - else - inpkg+=" virtualbox-guest-modules-arch" - fi - fi - - # when not using grub bootloader remove it's package and configurations if [[ $BOOTLDR != 'grub' ]]; then - rmpkg+=" grub" - rm -f $MNT/etc/default/grub + chrun "pacman -Rns grub --noconfirm" + rm -f $MNT/etc/default/grub 2>dev/null find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1 fi - - # do the same when not using syslinux as the bootloader if [[ $BOOTLDR != 'syslinux' ]]; then find $MNT/boot/ -name 'syslinux*' -exec rm -rf '{}' \; >/dev/null 2>&1 fi chrun "pacman -Syyu --noconfirm" - chrun "pacman -S iputils --noconfirm" 2>/dev/null - chrun "pacman -S base-devel git --needed --noconfirm" 2>/dev/null - chrun "for pkg in $(uniq <<< "$inpkg"); do pacman -S $pkg --needed --noconfirm; done" - chrun "for pkg in $(uniq <<< "$rmpkg"); do pacman -Rs $pkg --noconfirm; done" - + chrun "pacman -S iputils --noconfirm" + chrun "pacman -S base-devel git --needed --noconfirm" + chrun "pacman -S $inpkg --needed --noconfirm" + chrun "pacman -Rns $rmpkg --noconfirm" return 0 } @@ -2038,16 +1967,15 @@ suckless_install() if (( e == 0 )); then chrun "cd $p; rm -f config.h; make clean install; make clean" else - printf "\n\nFailed to clone dwm repo\n\n" + printf "\n\nFailed to clone $i repo\n\n" fi done if [[ -d /home/$NEWUSER/suckless/dwm ]]; then printf "\n\n%s" "To configure dwm edit /home/$NEWUSER/suckless/dwm/config.h" printf "\n%s\n\n" "You can then recompile it with 'sudo make clean install'" + sleep 2 fi - - sleep 2 } ############################################################################### @@ -2056,12 +1984,12 @@ suckless_install() setup_boot() { tput civis - if ! BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" 0 0 0 ${BOOTLDRS[$SYS]})"; then + if ! BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" ${BOOTLDRS[$SYS]})"; then return 1 fi if [[ $BOOT_PART != "" ]]; then - mount_boot_part || return 1 + mount_partition "$BOOT_PART" "${BMNTS[$SYS-$BOOTLDR]}" && SEP_BOOT=true || return 1 setup_boot_device fi @@ -2075,12 +2003,12 @@ setup_grub() EDIT_FILES[bootloader]="/etc/default/grub" if [[ $SYS == 'BIOS' ]]; then [[ $BOOT_DEVICE ]] || { select_device 'boot' || return 1; } - BCMDS[grub]="${BCMDS[grub]} --bootloader-id=$DIST --target=i386-pc $BOOT_DEVICE" + BCMDS[grub]="${BCMDS[grub]} --target=i386-pc $BOOT_DEVICE" else if [[ $ROOT_PART == */dev/mapper/* && ! $LVM && ! $LUKS_PASS ]]; then luks_pass "$_LuksOpen" "" || return 1 fi - BCMDS[grub]="${BCMDS[grub]} --bootloader-id=$DIST" + BCMDS[grub]="${BCMDS[grub]} --removable" fi BCMDS[grub]="mkdir -p /run/udev && @@ -2119,9 +2047,8 @@ prerun_grub() sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" $cfg fi - # needed for os-prober module to work properly in the chroot - # once the bootloader install (grub in this case) is done - # these will be umount(ed) and the mount dirs removed + # needed for grub-probe module to work properly in the chroot + # once the grub install is done these will be umounted and removed mkdir -p /run/lvm mkdir -p /run/udev mkdir -p $MNT/hostrun/lvm @@ -2164,7 +2091,7 @@ When = PostTransaction Exec = /usr/bin/bootctl update EOF # systemd-boot requires this before running bootctl - systemd-machine-id-setup --root="$MNT" >/dev/null 2>&1 + systemd-machine-id-setup --root="$MNT" return 0 } @@ -2177,7 +2104,7 @@ prerun_syslinux() UI menu.c32 PROMPT 0 -MENU TITLE $DIST Syslinux Boot Menu +MENU TITLE $DIST Boot Menu TIMEOUT 50 DEFAULT $DIST @@ -2208,65 +2135,26 @@ install_bootloader() # remove old UEFI boot entries if [[ $SYS == 'UEFI' ]]; then find ${MNT}${BMNTS[UEFI-$BOOTLDR]}/EFI/ \ - -maxdepth 1 -mindepth 1 -name '[aA][rR][cC][hH][lL]abs' \ - -type d -exec rm -rf '{}' \; >/dev/null 2>&1 + -maxdepth 1 -mindepth 1 -name '[aA][rR][cC][hH][lL]abs' -type d -exec rm -rf '{}' \; >/dev/null 2>&1 + find ${MNT}${BMNTS[UEFI-$BOOTLDR]}/EFI/ \ + -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d -exec rm -rf '{}' \; >/dev/null 2>&1 fi 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]}" - # remove mounted dirs if any if [[ -d $MNT/hostrun ]]; then + # remove mounted directories umount $MNT/hostrun/udev >/dev/null 2>&1 umount $MNT/hostrun/lvm >/dev/null 2>&1 rm -rf $MNT/hostrun >/dev/null 2>&1 fi - # copy efi stub to generic catch all - if [[ $SYS == 'UEFI' && $BOOTLDR == 'grub' ]]; then - uefi_boot_fallback - fi - return 0 } -uefi_boot_fallback() -{ - # some UEFI firmware requires a dir in the ESP with a generic bootx64.efi - # see: https://wiki.archlinux.org/index.php/GRUB#UEFI - - local esp="${MNT}${BMNTS[$SYS-$BOOTLDR]}" - - local default - default="$(find $esp/EFI/ -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d)" - - if [[ $default ]]; then - default="${default##/*}" - else - default="Boot" - fi - - printf "\n" - - if [[ -d $esp/EFI/$default ]]; then - rm -rfv $esp/EFI/$default/* - else - mkdir -pv $esp/EFI/$default - fi - - cp -fv $esp/EFI/$DIST/grubx64.efi $esp/EFI/$default/bootx64.efi - - sleep 2 - return 0 -} - -shim_secure_boot() -{ - efibootmgr -c -w -L $DIST -d $BOOT_DEVICE -p $BOOT_PART_NUM -l ${MNT}${BMNTS[$SYS-$BOOTLDR]}/shim64.efi -} - ############################################################################### # dialog menus @@ -2327,18 +2215,24 @@ show_cfg() cfg_menu() { + tput civis + 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="$(menubox "$_ConfLocale" "$_LocaleBody" 25 70 20 $LOCALES)"; then + if ! LOCALE="$(menubox "$_ConfLocale" "$_LocaleBody" $LOCALES)"; then return 1 fi select_timezone || return 1 - if ! KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then + + if ! KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" 'linux' '-' 'linux-lts' '-')"; then return 1 fi @@ -2352,8 +2246,7 @@ select_language() { tput civis local lang - lang=$(menubox "Select Language" \ - "\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n" 0 0 0 \ + lang=$(menubox "Select Language" "\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n" \ "1" "English (en_**)" \ "2" "Español (es_ES)" \ "3" "Português [Brasil] (pt_BR)" \ @@ -2367,7 +2260,6 @@ select_language() src $LNG/english.trans FONT="ter-i16n" - case $lang in 1) LOC="en_US.UTF-8" ;; 2) src $LNG/spanish.trans && LOC="es_ES.UTF-8" ;; @@ -2395,23 +2287,17 @@ select_language() user_creation() { - tput civis - if ! MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" 0 0 0 \ - '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"; then - return 1 - fi - tput cnorm local values if ! values="$(dialog --stdout --no-cancel --separator '~' \ --ok-label "Submit" --backtitle "$BT" --title " $_UserTitle " \ - --insecure --mixedform "$_UserBody" 27 75 10 \ - "$_Username" 1 1 "" 1 $((${#_Username} + 2)) 71 0 0 \ - "$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \ - "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1 \ - "$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) 71 0 2 \ - "$_Password" 8 1 "" 8 $((${#_Password} + 2)) 71 0 1 \ - "$_Password2" 9 1 "" 9 $((${#_Password2} + 2)) 71 0 1)"; then + --insecure --mixedform "$_UserBody" 0 0 14 \ + "$_Username" 1 1 "" 1 $((${#_Username} + 2)) $COLUMNS 0 0 \ + "$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \ + "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1 \ + "$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) $COLUMNS 0 2 \ + "$_Password" 8 1 "" 8 $((${#_Password} + 2)) $COLUMNS 0 1 \ + "$_Password2" 9 1 "" 9 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then return 1 fi @@ -2449,7 +2335,7 @@ user_creation() select_keymap() { tput civis - if ! KEYMAP="$(menubox "$_PrepLayout" "$_XMapBody" 20 70 12 \ + if ! KEYMAP="$(menubox "$_PrepLayout" "$_XMapBody" \ 'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \ 'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \ 'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \ @@ -2477,7 +2363,7 @@ select_keymap() if [[ $CMAPS == *"$KEYMAP"* ]]; then CMAP="$KEYMAP" else - if ! CMAP="$(menubox "$_CMapTitle" "$_CMapBody" 20 70 12 $CMAPS)"; then + if ! CMAP="$(menubox "$_CMapTitle" "$_CMapBody" $CMAPS)"; then return 1 fi fi @@ -2500,13 +2386,13 @@ select_timezone() done tput civis - if ! ZONE="$(menubox "$_TimeZTitle" "$_TimeZBody" 20 70 10 \ + if ! ZONE="$(menubox "$_TimeZTitle" "$_TimeZBody" \ 'America' '-' 'Australia' '-' 'Asia' '-' 'Atlantic' '-' 'Africa' '-' \ 'Europe' '-' 'Indian' '-' 'Pacific' '-' 'Arctic' '-' 'Antarctica' '-')"; then return 1 fi - if ! SUBZONE="$(menubox "$_TimeZTitle" "$_TimeSubZBody" 20 70 12 ${SUBZONES[$ZONE]})"; then + if ! SUBZONE="$(menubox "$_TimeZTitle" "$_TimeSubZBody" ${SUBZONES[$ZONE]})"; then return 1 fi @@ -2517,13 +2403,13 @@ select_wm_or_de() { tput civis if ! INSTALL_WMS="$(dialog --cr-wrap --no-cancel --stdout --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 \ - "openbox" "A lightweight, powerful, and highly configurable stacking window manager" off \ - "bspwm" "A tiling window manager that represents windows as the leaves of a binary tree" off \ + --title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 14 \ + "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 \ "gnome" "A desktop environment that aims to be simple and easy to use" off \ - "cinnamon" "A desktop environment combining traditional desktop with modern graphical effects" 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)"; then return 1 @@ -2537,11 +2423,7 @@ select_wm_or_de() # packages needed for the selected WMs/DEs for wm in $INSTALL_WMS; do LOGIN_CHOICES+="$wm - " - if [[ ${WM_EXT[$wm]} && $wm == 'plasma' ]]; then - if yesno "$_WMChoice" "\nInstall kde-applications?\n\nNOTE: This is a large package group.\n"; then - WM_PACKAGES+=" ${WM_EXT[plasma]}" - fi - elif [[ ${WM_EXT[$wm]} ]]; then + if [[ ${WM_EXT[$wm]} ]]; then WM_PACKAGES+=" ${WM_EXT[$wm]}" fi done @@ -2554,7 +2436,7 @@ select_wm_or_de() if [[ $WM_NUM -eq 1 ]]; then LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}" else - if ! LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"; then + if ! LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" $LOGIN_CHOICES)"; then return 1 fi LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}" @@ -2570,7 +2452,7 @@ select_wm_or_de() select_login() { - if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" 0 0 0 \ + if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" \ "xinit" "Console login without a display manager" \ "lightdm" "Lightweight display manager with a gtk greeter")"; then return 1 @@ -2599,7 +2481,7 @@ select_packages() tput civis SELECTED=$(dialog --cr-wrap --no-cancel --stdout \ --backtitle "$BT" --title " $_Packages " \ - --default-item $SELECTED --menu "$_PackageMenu" 0 0 0 \ + --default-item $SELECTED --menu "$_PackageMenu" 0 0 14 \ 1 "Browsers" \ 2 "Editors" \ 3 "Terminals" \ @@ -2648,9 +2530,7 @@ select_mirrorcmd() MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate --verbose" yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic" "Custom" && return 0 - c="$(json 'country_name' \ - "$(json 'ip' \ - "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_name")" + c="$(json 'country_name' "$(json 'ip' "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_name")" MIRROR_CMD="reflector --country $c --score 80 --latest 40 --fastest 10 --sort rate --verbose" tput cnorm @@ -2667,9 +2547,7 @@ select_mirrorcmd() 'score': MirrorStatus score; 'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")" else - c="$(json 'country_code' \ - "$(json 'ip' \ - "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_code")" + c="$(json 'country_code' "$(json 'ip' "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_code")" local w="https://www.archlinux.org/mirrorlist" if [[ $c ]]; then if [[ $c =~ (CA|US) ]]; then @@ -2692,7 +2570,7 @@ edit_configs() 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 14 "$str" "-" \ "keyboard" "${EDIT_FILES[keyboard]}" \ "console" "${EDIT_FILES[console]}" \ "locale" "${EDIT_FILES[locale]}" \ @@ -2714,14 +2592,12 @@ edit_configs() for f in $(printf "%s" "${EDIT_FILES[$choice]}"); do [[ -e ${MNT}$f ]] && exists+=" ${MNT}$f" done - if [[ $exists ]]; then vim -O $exists else msgbox "$_ErrTitle" "$_NoFileErr" fi fi - edit_configs } @@ -2798,6 +2674,8 @@ CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{ print $1 " -" }' | sort)" +: "${COLUMNS=$(tput cols)}" + # various associative arrays # { @@ -2836,8 +2714,8 @@ declare -A WM_SESSIONS=( # additional packages installed for each wm/de declare -A WM_EXT=( -[gnome]="gnome-extra" -[plasma]="kde-applications" +[gnome]="" +[plasma]="kdebase-meta" [bspwm]="sxhkd archlabs-skel-bspwm rofi archlabs-polybar" [xfce4]="xfce4-goodies xfce4-pulseaudio-plugin archlabs-skel-xfce4" [i3-gaps]="i3status perl-anyevent-i3 archlabs-skel-i3-gaps rofi archlabs-polybar" @@ -2872,10 +2750,9 @@ declare -A PKG_EXT=( [zathura]="zathura-pdf-poppler" [noto-fonts]="noto-fonts-emoji" [cairo-dock]="cairo-dock-plug-ins" -[kdenlive]="qt5ct qt5-styleplugins" [qbittorrent]="qt5ct qt5-styleplugins" [qutebrowser]="qt5ct qt5-styleplugins" -[kdenlive]="kdebase-runtime dvdauthor frei0r-plugins breeze breeze-gtk" +[kdenlive]="kdebase-meta dvdauthor frei0r-plugins breeze breeze-gtk qt5ct qt5-styleplugins" ) # mkfs command to format a partition as a given file system @@ -2907,7 +2784,10 @@ for arg in "$@"; do done # initial prep -select_language +# select_language +src $LNG/english.trans +FONT="ter-i16n" +LOC="en_US.UTF-8" select_keymap system_checks system_identify