Fix issue when indexing empty strings, large cleanup.

This commit is contained in:
natemaia 2020-05-19 23:10:14 -07:00
parent 45f3b08020
commit d6c2a29c14

438
installer
View File

@ -6,28 +6,39 @@
# AIF, Calamares, and the Arch Wiki.. Credit where credit is due
# shellcheck disable=SC2086,SC2046,SC2254,SC2164
VER=2.1.53
VER=2.1.54
# default values {
: "${DIST=ArchLabs}" # distro name if not set
: "${MNT=/mnt}" # installation root mountpoint if not set
ANS=/tmp/ans # dialog answer output file
SYS=Unknown # boot type, to be determined: UEFI/BIOS
FONT=ter-i16n # font used for the linux console
HOOKS=shutdown # additional mkinitcpio HOOKS
SEL=0 # currently selected menu item
PACSTRAP=1 # use a fresh pacstrap or copy the iso filesystem
SYS=Unknown # bios type, to be determined: UEFI/BIOS
SEL=0 # currently selected main menu item
BTRFS=0 # is btrfs used, 1 = btrfs alone, 2 = btrfs + subvolume(s)
PACSTRAP=1 # use pacstrap or copy the iso filesystem
EXMNTS='' # extra partitions that were mounted, used to verify mountpoint and show user
USERCMD='' # optional command(s) entered by the user to run in the chroot
ANS=/tmp/ans # dialog answer output file
BG=/tmp/bgout # output from background process
ERR=/tmp/errlog # stderr log used internally by errshow()
DBG=/tmp/debuglog # debug log file when passed -d
RUN=/run/archiso/bootmnt/arch/boot # path for live system /boot
BTRFS=0 # is btrfs used, 1 = btrfs alone, 2 = btrfs + subvolume(s)
EXMNTS="" # extra partitions that were mounted, used to verify mountpoint and show user
USER_CMD="" # optional command(s) entered by the user to run in the chroot
VM="$(systemd-detect-virt)" # system running in a virtual machine
export DIALOGOPTS="--cr-wrap" # dialog environment variable to hold default options, see `man dialog`
VIRT="$(systemd-detect-virt)"
MEM="$(awk '/MemTotal/ {print int($2 / 1024) "M"}' /proc/meminfo)"
LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if ($1) {print $1 " - "}}' /etc/locale.gen)"
CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " - "}' | sort)"
[[ $LINES ]] || LINES=$(tput lines)
[[ $COLUMNS ]] || COLUMNS=$(tput cols)
export DIALOGOPTS="--cr-wrap"
# }
# package arrays {
# package arrays built later from user selections
typeset -a SES_PKGS USER_PKGS
@ -161,12 +172,50 @@ typeset -a ISO_PKGS=(
"wvdial"
) # }
SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024) "M"}' /proc/meminfo)"
LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if ($1) {print $1 " - "}}' /etc/locale.gen)"
CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " - "}' | sort)"
# packages installed for each wm/de, most are depends of the skel packages {
declare -A WM_EXT=(
[awesome]='archlabs-skel-awesome'
[bspwm]='archlabs-skel-bspwm'
[cinnamon]='gnome-terminal'
[deepin]='deepin-extra'
[dwm]='nitrogen polkit-gnome gnome-keyring dunst lxappearance'
[fluxbox]='archlabs-skel-fluxbox'
[gnome]='gnome-tweaks'
[i3-gaps]='archlabs-skel-i3-gaps'
[jwm]=''
[lxqt]='breeze breeze-icons picom libpulse network-manager-applet'
[openbox]='archlabs-skel-openbox'
[plasma]='kde-applications-meta powerdevil'
[xfce4]='archlabs-skel-xfce4 xfce4-goodies'
) # }
[[ $LINES ]] || LINES=$(tput lines)
[[ $COLUMNS ]] || COLUMNS=$(tput cols)
# packages installed for each login option {
declare -A LOGIN_PKGS=(
[gdm]='gdm'
[lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice'
[sddm]='sddm'
[xinit]='xorg-xinit'
) # }
# extras installed for user selected packages {
# if a package requires additional packages that aren't already dependencies
# they can be added here e.g. [package]="extra"
declare -A PKG_EXT=(
[bluez]='bluez-libs bluez-utils bluez-tools bluez-plugins bluez-hid2hci'
[cairo-dock]='cairo-dock-plug-ins'
[kdenlive]='qt5ct qt5-styleplugins'
[mpd]='mpc'
[mupdf]='mupdf-tools'
[noto-fonts]='noto-fonts-emoji'
[pcmanfm]='tumbler'
[qbittorrent]='qt5ct qt5-styleplugins'
[qt5ct]='qt5-styleplugins'
[qutebrowser]='qt5ct qt5-styleplugins'
[thunar]='tumbler thunar-volman'
[transmission-qt]='qt5ct qt5-styleplugins'
[vlc]='qt5ct qt5-styleplugins'
[zathura]='zathura-pdf-poppler'
) # }
# }
@ -202,23 +251,6 @@ declare -A WM_SESSIONS=(
[xfce4]='startxfce4'
) # }
# Packages installed for each wm/de, most are depends of the skel packages {
declare -A WM_EXT=(
[awesome]='archlabs-skel-awesome'
[bspwm]='archlabs-skel-bspwm'
[cinnamon]='gnome-terminal'
[deepin]='deepin-extra'
[dwm]='nitrogen polkit-gnome gnome-keyring dunst lxappearance'
[fluxbox]='archlabs-skel-fluxbox'
[gnome]='gnome-tweaks'
[i3-gaps]='archlabs-skel-i3-gaps'
[jwm]=''
[lxqt]='breeze breeze-icons picom libpulse network-manager-applet'
[openbox]='archlabs-skel-openbox'
[plasma]='kde-applications-meta powerdevil'
[xfce4]='archlabs-skel-xfce4 xfce4-goodies'
) # }
# files offered for editing after install is complete {
declare -A EDIT_FILES=(
[login]='' # login is populated once we know the username and shell
@ -264,105 +296,77 @@ declare -A FS_OPTS=(
[btrfs]='autodefrag compress=zlib compress=lzo compress=no compress-force=zlib compress-force=lzo discard noacl noatime nodatasum nospace_cache recovery skip_balance space_cache ssd ssd_spread'
) # }
# packages installed for each login option {
declare -A LOGIN_PKGS=(
[gdm]='gdm'
[lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice'
[sddm]='sddm'
[xinit]='xorg-xinit'
) # }
# extras installed for user selected packages {
# if a package requires additional packages that aren't already dependencies
# they can be added here e.g. [package]="extra"
declare -A PKG_EXT=(
[bluez]='bluez-libs bluez-utils bluez-tools bluez-plugins bluez-hid2hci'
[cairo-dock]='cairo-dock-plug-ins'
[kdenlive]='qt5ct qt5-styleplugins'
[mpd]='mpc'
[mupdf]='mupdf-tools'
[noto-fonts]='noto-fonts-emoji'
[pcmanfm]='tumbler'
[qbittorrent]='qt5ct qt5-styleplugins'
[qt5ct]='qt5-styleplugins'
[qutebrowser]='qt5ct qt5-styleplugins'
[thunar]='tumbler thunar-volman'
[transmission-qt]='qt5ct qt5-styleplugins'
[vlc]='qt5ct qt5-styleplugins'
[zathura]='zathura-pdf-poppler'
) # }
# mirrorlist country codes to names table {
typeset -A COUNTRIES=(
[AU]="Australia"
[AT]="Austria"
[BD]="Bangladesh"
[BY]="Belarus"
[BE]="Belgium"
[BA]="Bosnia and Herzegovina"
[BR]="Brazil"
[BG]="Bulgaria"
[CA]="Canada"
[CL]="Chile"
[CN]="China"
[CO]="Colombia"
[HR]="Croatia"
[CZ]="Czechia"
[DK]="Denmark"
[EC]="Ecuador"
[FI]="Finland"
[FR]="France"
[GE]="Georgia"
[DE]="Germany"
[GR]="Greece"
[HK]="Hong Kong"
[HU]="Hungary"
[IS]="Iceland"
[IN]="India"
[ID]="Indonesia"
[IR]="Iran"
[IE]="Ireland"
[IL]="Israel"
[IT]="Italy"
[JP]="Japan"
[KZ]="Kazakhstan"
[KE]="Kenya"
[LV]="Latvia"
[LT]="Lithuania"
[LU]="Luxembourg"
[NL]="Netherlands"
[NC]="New Caledonia"
[NZ]="New Zealand"
[MK]="North Macedonia"
[NO]="Norway"
[PY]="Paraguay"
[PH]="Philippines"
[PL]="Poland"
[PT]="Portugal"
[RO]="Romania"
[RU]="Russia"
[RS]="Serbia"
[SG]="Singapore"
[SK]="Slovakia"
[SI]="Slovenia"
[ZA]="South Africa"
[KR]="South Korea"
[ES]="Spain"
[SE]="Sweden"
[CH]="Switzerland"
[TW]="Taiwan"
[TH]="Thailand"
[TR]="Turkey"
[UA]="Ukraine"
[GB]="United Kingdom"
[US]="United States"
[VN]="Vietnam"
[AU]='Australia'
[AT]='Austria'
[BD]='Bangladesh'
[BY]='Belarus'
[BE]='Belgium'
[BA]='Bosnia and Herzegovina'
[BR]='Brazil'
[BG]='Bulgaria'
[CA]='Canada'
[CL]='Chile'
[CN]='China'
[CO]='Colombia'
[HR]='Croatia'
[CZ]='Czechia'
[DK]='Denmark'
[EC]='Ecuador'
[FI]='Finland'
[FR]='France'
[GE]='Georgia'
[DE]='Germany'
[GR]='Greece'
[HK]='Hong Kong'
[HU]='Hungary'
[IS]='Iceland'
[IN]='India'
[ID]='Indonesia'
[IR]='Iran'
[IE]='Ireland'
[IL]='Israel'
[IT]='Italy'
[JP]='Japan'
[KZ]='Kazakhstan'
[KE]='Kenya'
[LV]='Latvia'
[LT]='Lithuania'
[LU]='Luxembourg'
[NL]='Netherlands'
[NC]='New Caledonia'
[NZ]='New Zealand'
[MK]='North Macedonia'
[NO]='Norway'
[PY]='Paraguay'
[PH]='Philippines'
[PL]='Poland'
[PT]='Portugal'
[RO]='Romania'
[RU]='Russia'
[RS]='Serbia'
[SG]='Singapore'
[SK]='Slovakia'
[SI]='Slovenia'
[ZA]='South Africa'
[KR]='South Korea'
[ES]='Spain'
[SE]='Sweden'
[CH]='Switzerland'
[TW]='Taiwan'
[TH]='Thailand'
[TR]='Turkey'
[UA]='Ukraine'
[GB]='United Kingdom'
[US]='United States'
[VN]='Vietnam'
) # }
# dialog text variables {
# Basics (somewhat in order)
_keymap="\nSelect which keymap to use from the list below.\n\nThis will determine the installed system keymap, NOT locale which is chosen later.\n\nSystem default: us"
_vconsole="\nSelect the console keymap, the console is the tty shell you reach before starting a graphical environment (Xorg).\n\nIts keymap is separate from the one used by the graphical environments, though many do use the same such as 'us' English.\n\nSystem default: us"
_keymap="\nSelect which keymap to use from the list below.\n\nThis will determine the installed system keymap once entering a graphical environment.\n\ndefault: us"
_vconsole="\nSelect the console keymap, the console is the tty shell you reach before starting a graphical environment (Xorg).\n\nIts keymap is separate from the one used by the graphical environments, though many do use the same such as 'us' English.\n\ndefault: us"
_prep="\nThis is the installer main menu, once a step is complete you will return here.\n\nOn successful completion of a step the cursor will advance to the next step.\nOn failure the cursor will be placed on the step required to advance (when possible).\n\nSteps beginning with an asterisk (*) are required.\n\nOnce all required steps are complete, selecting the last step will finalize the install."
_device="\nSelect a device to use from the list below.\n\nDevices (/dev) are the available drives on the system. /sda, /sdb, /sdc ..."
_mount="\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."
@ -509,7 +513,7 @@ select_show()
Hostname: ${NEWHOST:-none}
Timezone: ${ZONE:-none}/${SUBZ:-none}
Chroot cmd: ${USER_CMD:-none}
Chroot cmd: ${USERCMD:-none}
------------ USER CONFIGURATION ---------------
@ -538,9 +542,16 @@ select_login()
"sddm" "Simple desktop display manager (plasma and lxqt default)" || return 1
case $LOGIN_TYPE in
gdm|sddm)
gdm)
EDIT_FILES[login]="none"
;;
sddm)
if [[ $INSTALL_WMS =~ (plasma|lxqt) ]]; then
EDIT_FILES[login]="/etc/sddm.conf.d/theme.conf"
else
EDIT_FILES[login]="none"
fi
;;
lightdm)
LIGHTDM_GREETER='gtk-greeter'
EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
@ -689,6 +700,7 @@ select_keymap()
echo "$KEYMAP" > /tmp/xkeys
else
KEYMAP="$(< /tmp/xkeys)"
: "${KEYMAP='us'}"
fi
if [[ ! -f /tmp/ckeys ]]; then
@ -700,6 +712,7 @@ select_keymap()
echo "$CMAP" > /tmp/ckeys
else
CMAP="$(< /tmp/ckeys)"
: "${CMAP='us'}"
fi
if [[ $TERM == 'linux' ]]; then
@ -713,7 +726,58 @@ select_keymap()
select_usercmd()
{
dlg USER_CMD input "Command" "$_usercmd" "$USER_CMD" nolimit
dlg USERCMD input "Command" "$_usercmd" "$USERCMD" nolimit
}
select_mirrors()
{
codes=''
MIRROR_URL=''
typeset -ga MIRROR_COUNTRY
while :; do
dlg codes check "Mirror Countries" "\nSelect which countries to use mirrors from.\n\nNot choosing any will result in an automatic selection." \
AU Australia "$(ofn AU "$codes")" AT Austria "$(ofn AT "$codes")" \
BA "Bosnia Herzegovina" "$(ofn BA "$codes")" BY Belarus "$(ofn BY "$codes")" \
BE Belgium "$(ofn BE "$codes")" BR Brazil "$(ofn BR "$codes")" \
BG Bulgaria "$(ofn BG "$codes")" CA Canada "$(ofn CA "$codes")" \
CL Chile "$(ofn CL "$codes")" CN China "$(ofn CN "$codes")" \
CO Colombia "$(ofn CO "$codes")" CZ "Czech Republic" "$(ofn CZ "$codes")" \
DK Denmark "$(ofn DK "$codes")" EE Estonia "$(ofn EE "$codes")" \
FI Finland "$(ofn FI "$codes")" FR France "$(ofn FR "$codes")" \
DE Germany "$(ofn DE "$codes")" GB "United Kingdom" "$(ofn GB "$codes")" \
GR Greece "$(ofn GR "$codes")" HU Hungary "$(ofn HU "$codes")" \
IN India "$(ofn IN "$codes")" IE Ireland "$(ofn IE "$codes")" \
IL Israel "$(ofn IL "$codes")" IT Italy "$(ofn IT "$codes")" \
JP Japan "$(ofn JP "$codes")" KZ Kazakhstan "$(ofn KZ "$codes")" \
KR Korea "$(ofn KR "$codes")" LT Lithuania "$(ofn LT "$codes")" \
LV Latvia "$(ofn LV "$codes")" LU Luxembourg "$(ofn LU "$codes")" \
MK Macedonia "$(ofn MK "$codes")" NL Netherlands "$(ofn NL "$codes")" \
NC "New Caledonia" "$(ofn NC "$codes")" NZ "New Zealand" "$(ofn NZ "$codes")" \
NO Norway "$(ofn NO "$codes")" PL Poland "$(ofn PL "$codes")" \
PT Portugal "$(ofn PT "$codes")" RO Romania "$(ofn RO "$codes")" \
RU Russia "$(ofn RU "$codes")" RS Serbia "$(ofn RS "$codes")" \
SG Singapore "$(ofn SG "$codes")" SK Slovakia "$(ofn SK "$codes")" \
ZA "South Africa" "$(ofn ZA "$codes")" ES Spain "$(ofn ES "$codes")" \
LK "Sri Lanka" "$(ofn LK "$codes")" SE Sweden "$(ofn SE "$codes")" \
CH Switzerland "$(ofn CH "$codes")" TW Taiwan "$(ofn TW "$codes")" \
TR Turkey "$(ofn TR "$codes")" UA Ukraine "$(ofn UA "$codes")" \
US "United States" "$(ofn US "$codes")" UZ Uzbekistan "$(ofn UZ "$codes")" \
VN Vietnam "$(ofn VN "$codes")" || return 1
yesno "Mirror Countries" "\nConfirm the following countries: $(for i in $codes; do printf "%s, " "${COUNTRIES[$i]}"; done)" && break
done
for i in $codes; do
if [[ $MIRROR_URL ]]; then
MIRROR_URL+="&country=$i"
else
MIRROR_URL="https://www.archlinux.org/mirrorlist/?country=$i"
fi
MIRROR_COUNTRY+=("--country" "${COUNTRIES[$i]}")
done
MIRROR_URL+='&use_mirror_status=on'
return 0
}
select_bootldr()
@ -763,7 +827,7 @@ select_sessions()
for i in $INSTALL_WMS; do
LOGIN_CHOICES+="$i - "
if [[ $i =~ (plasma|deepin) ]]; then
local pretxt="\nThere are some extra packages available for $i that you may want installed:"
local pretxt="\nThere are some extra packages available for $i that can be installed:"
local txt="These are larger package groups containing applications that are a part of $i"
txt+=" but are not included in the $i package group."
yesno "${i^} Extra" "$pretxt ${WM_EXT[$i]}\n\n$txt\n\nWould you like to install them?\n" || continue
@ -907,57 +971,6 @@ select_packages()
return 0
}
select_mirror_country()
{
codes=''
MIRROR_URL=''
typeset -ga MIRROR_COUNTRY
while :; do
dlg codes check "Mirror Countries" "\nSelect which countries to use mirrors from.\n\nNot choosing any will result in an automatic selection." \
AU Australia "$(ofn AU "$codes")" AT Austria "$(ofn AT "$codes")" \
BA "Bosnia Herzegovina" "$(ofn BA "$codes")" BY Belarus "$(ofn BY "$codes")" \
BE Belgium "$(ofn BE "$codes")" BR Brazil "$(ofn BR "$codes")" \
BG Bulgaria "$(ofn BG "$codes")" CA Canada "$(ofn CA "$codes")" \
CL Chile "$(ofn CL "$codes")" CN China "$(ofn CN "$codes")" \
CO Colombia "$(ofn CO "$codes")" CZ "Czech Republic" "$(ofn CZ "$codes")" \
DK Denmark "$(ofn DK "$codes")" EE Estonia "$(ofn EE "$codes")" \
FI Finland "$(ofn FI "$codes")" FR France "$(ofn FR "$codes")" \
DE Germany "$(ofn DE "$codes")" GB "United Kingdom" "$(ofn GB "$codes")" \
GR Greece "$(ofn GR "$codes")" HU Hungary "$(ofn HU "$codes")" \
IN India "$(ofn IN "$codes")" IE Ireland "$(ofn IE "$codes")" \
IL Israel "$(ofn IL "$codes")" IT Italy "$(ofn IT "$codes")" \
JP Japan "$(ofn JP "$codes")" KZ Kazakhstan "$(ofn KZ "$codes")" \
KR Korea "$(ofn KR "$codes")" LT Lithuania "$(ofn LT "$codes")" \
LV Latvia "$(ofn LV "$codes")" LU Luxembourg "$(ofn LU "$codes")" \
MK Macedonia "$(ofn MK "$codes")" NL Netherlands "$(ofn NL "$codes")" \
NC "New Caledonia" "$(ofn NC "$codes")" NZ "New Zealand" "$(ofn NZ "$codes")" \
NO Norway "$(ofn NO "$codes")" PL Poland "$(ofn PL "$codes")" \
PT Portugal "$(ofn PT "$codes")" RO Romania "$(ofn RO "$codes")" \
RU Russia "$(ofn RU "$codes")" RS Serbia "$(ofn RS "$codes")" \
SG Singapore "$(ofn SG "$codes")" SK Slovakia "$(ofn SK "$codes")" \
ZA "South Africa" "$(ofn ZA "$codes")" ES Spain "$(ofn ES "$codes")" \
LK "Sri Lanka" "$(ofn LK "$codes")" SE Sweden "$(ofn SE "$codes")" \
CH Switzerland "$(ofn CH "$codes")" TW Taiwan "$(ofn TW "$codes")" \
TR Turkey "$(ofn TR "$codes")" UA Ukraine "$(ofn UA "$codes")" \
US "United States" "$(ofn US "$codes")" UZ Uzbekistan "$(ofn UZ "$codes")" \
VN Vietnam "$(ofn VN "$codes")" || return 1
yesno "Mirror Countries" "\nConfirm the following countries: $(for i in $codes; do printf "%s, " "${COUNTRIES[$i]}"; done)" && break
done
for i in $codes; do
if [[ $MIRROR_URL ]]; then
MIRROR_URL+="&country=$i"
else
MIRROR_URL="https://www.archlinux.org/mirrorlist/?country=$i"
fi
MIRROR_COUNTRY+=("--country" "${COUNTRIES[$i]}")
done
MIRROR_URL+='&use_mirror_status=on'
return 0
}
###############################################################################
# device management menus
# acts as an in-between function to avoid cluttering the main menu
@ -977,21 +990,21 @@ dev_menu()
'part' 'Modify the partition layout of a device' \
'luks' 'Setup LUKS encryption on a partition or LVM' \
'lvm' 'Setup logical volume management on partition(s)' \
'back' "$back" || return 0
'back' "$back"
if [[ $choice == 'back' ]]; then
return 0
elif [[ -z $WARN && $choice != 'view' ]]; then
if [[ -z $WARN && $choice != 'view' ]]; then
msg "Data Warning" "$_warn"
WARN=true
fi
case "$choice" in
'view') part_show ;;
'part') part_menu && [[ "$AUTO_ROOT" ]] && return 0 ;;
'luks') luks_menu ;;
'lvm') lvm_menu ;;
'luks') luks_menu || return 1 ;;
'lvm') lvm_menu || return 1 ;;
*) break;
esac
done
return 0
}
###############################################################################
@ -1115,7 +1128,6 @@ part_auto()
part_find()
{
local regexp="$1" err=''
local s dev size isize model
PARTS="$(part_pretty "" "$regexp")"
PART_COUNT=$(wc -l <<< "$PARTS")
@ -1207,13 +1219,12 @@ part_pretty()
s=${size%%__*}
size_t="${s: -1:1}"
isize=${s:0:-1}
isize=${isize%.*}
if [[ $dev = /dev/nvme* ]]; then
model=$(lsblk -lno MODEL "${dev%p[1-9]}" | awk '{gsub(/ |\t/, "_"); print}')
else
model=$(lsblk -lno MODEL "${dev%[1-9]}" | awk '{gsub(/ |\t/, "_"); print}')
fi
[[ $size_t == 'K' || ($size_t == 'M' && $isize -lt 80) ]] || printf "%s\n" "$dev ${size}__$model"
[[ $size_t == 'K' || ($size_t == 'M' && ${isize%.*} -lt 80) ]] || printf "%s\n" "$dev ${size}__$model"
done < <(lsblk -lno TYPE,PATH,SIZE,FSTYPE,LABEL $part |
awk "/$regexp/"' && !'"/${IGNORE_DEV:-NONEXX}/"' {
if ($4 == "") {
@ -1381,11 +1392,11 @@ select_boot()
if (( PART_COUNT )); then
while read -r dev size; do # walk partition list and skip ones that are too small/big for boot
[[ $dev && $size ]] || continue
s=${size%%__*}
size_t="${s: -1:1}"
isize=${s:0:-1}
isize=${isize%.*}
if ! [[ $size_t == 'T' || ($size_t == 'G' && $isize -gt 2) ]]; then
if ! [[ $size_t == 'T' || ($size_t == 'G' && ${isize%.*} -gt 2) ]]; then
pts+="$dev $size "
(( ptcount++ ))
fi
@ -1472,11 +1483,11 @@ select_root()
return 0 # we're done here
else # walk partition list and skip ones that are < 8G
while read -r dev size; do
[[ $dev && $size ]] || continue
s=${size%%__*}
size_t="${s: -1:1}"
isize=${s:0:-1}
isize=${isize%.*}
if ! [[ $size_t == 'M' || ($size_t == 'G' && $isize -lt 8) ]]; then
if ! [[ $size_t == 'M' || ($size_t == 'G' && ${isize%.*} -lt 8) ]]; then
pts+="$dev $size "
(( ptcount++ ))
fi
@ -1514,11 +1525,11 @@ select_swap()
if (( PART_COUNT )) ; then
while read -r dev size; do # walk partition list and skip ones that are > 64G
[[ $dev && $size ]] || continue
s=${size%%__*}
size_t="${s: -1:1}"
isize=${s:0:-1}
isize=${isize%.*}
if ! [[ $size_t == 'T' || ($size_t == 'G' && $isize -gt 64) ]]; then
if ! [[ $size_t == 'T' || ($size_t == 'G' && ${isize%.*} -gt 64) ]]; then
pts+="$dev $size "
fi
done <<< "$PARTS"
@ -1539,7 +1550,7 @@ select_swap()
msg "Swap Size Error" \
"\nSwap size must be 1(M|G) or greater, and can only contain whole numbers\n\nSize entered: $SWAP_S\n" 2
fi
if ! dlg SWAP_S input "Swap Setup" "$_swapsize" "$SYS_MEM"; then
if ! dlg SWAP_S input "Swap Setup" "$_swapsize" "$MEM"; then
SWAP=''
SWAP_S=''
return 1
@ -1563,6 +1574,7 @@ select_extra()
# walk partition list and skip ones that are < 1G
if (( PART_COUNT )); then
while read -r dev size; do
[[ $dev && $size ]] || continue
s=${size%%__*}
[[ ${s: -1:1} == 'M' ]] && part_countdec "$dev"
done <<< "$PARTS"
@ -1698,9 +1710,9 @@ install_main()
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
if [[ "$USER_CMD" ]]; then
chrun "$USER_CMD" 2> "$ERR" 2>&1
errshow 0 "chrun '$USER_CMD'"
if [[ "$USERCMD" ]]; then
chrun "$USERCMD" 2> "$ERR" 2>&1
errshow 0 "chrun '$USERCMD'"
fi
while :; do
@ -1759,9 +1771,9 @@ install_base()
errshow 1 "cp -vf '$RUN/x86_64/vmlinuz' '$MNT/boot/vmlinuz-linux'"
# remove/disable customizations done to airootfs during building
chrun "systemctl disable pacman-init.service choose-mirror.service" > /dev/null 2>&1
rm -f "$MNT/etc/systemd/scripts/choose-mirror"
rm -f "$MNT/etc/systemd/system/"{choose-mirror.service,etc-pacman.d-gnupg.mount,pacman-init.service}
chrun "systemctl disable pacman-init.service" > /dev/null 2>&1
rm -f "$MNT/etc/systemd/system/pacman-init.service"
rm -f "$MNT/etc/systemd/system/etc-pacman.d-gnupg.mount"
sed -i 's/#\(Storage=\)volatile/\1auto/' "$MNT/etc/systemd/journald.conf"
sed -i 's/\(HandleLidSwitch=\)ignore/#\1suspend/' "$MNT/etc/systemd/logind.conf"
sed -i 's/\(HandleSuspendKey=\)ignore/#\1suspend/' "$MNT/etc/systemd/logind.conf"
@ -1830,6 +1842,7 @@ install_user()
rm -f "$MNT/root/.zlogin" # remove welcome message
echo "Setting root user password and shell"
chrun "chpasswd <<< 'root:$ROOT_PASS'" 2> "$ERR" 2>&1
errshow 1 "chrun 'chpasswd <<< \"root:$ROOT_PASS\"'"
if [[ $NEWSHELL != 'zsh' ]]; then # root uses zsh by default
@ -1839,7 +1852,7 @@ install_user()
[[ $NEWSHELL == 'mksh' ]] && cp -fv "$MNT/etc/skel/.mkshrc" "$MNT/root/.mkshrc"
fi
echo "Creating new user $NEWUSER and setting password"
echo "Creating user $NEWUSER and setting password"
# check if there's an existing user home for new user (separate /home)
[[ -d "$MNT/home/$NEWUSER" ]] && i=1
@ -1851,8 +1864,8 @@ install_user()
[[ $INSTALL_WMS == *dwm* ]] && install_suckless "/home/$NEWUSER" chroot
# upgrade existing home with new skeleton configs
[[ $i == 1 ]] && cp -aT "$MNT/etc/skel/" "$MNT/home/$NEWUSER"
# upgrade existing home with new skeleton configs, making backups when needed
(( i )) && cp -rfaT -b --suffix='.bak' "$MNT/etc/skel/" "$MNT/home/$NEWUSER"
install_cleanup "$NEWUSER"
@ -2053,7 +2066,7 @@ install_packages()
errshow 1 "chrun 'pacman -S efibootmgr --needed --noconfirm'"
fi
if [[ $VM == 'oracle' ]]; then
if [[ $VIRT == 'oracle' ]]; then
chrun "pacman -S ${KERNEL}-headers virtualbox-guest-utils virtualbox-guest-dkms --needed --noconfirm"
fi
@ -2090,7 +2103,7 @@ install_tearfree()
{
local xpath="$1"
if [[ $VM != 'none' ]]; then
if [[ $VIRT != 'none' ]]; then
[[ -e "$xpath/40-touchpad.conf" ]] && rm -fv "$xpath/40-touchpad.conf"
elif [[ $TEARFREE ]]; then
if lspci | grep ' VGA ' | grep -q 'Intel'; then
@ -2234,7 +2247,7 @@ install_background()
[[ ! -d /etc/NetworkManager/system-connections ]] && net='netctl'
[[ $LUKS ]] && luks='cryptsetup'
select_mirror_country || AUTO_MIRROR=true
select_mirrors || AUTO_MIRROR=true
if hash rsync > /dev/null 2>&1; then # ask whether to pacstrap or copy if rsync is installed
yesno 'Background Install' "$_bginstall" 'Pacstrap' 'Copy ISO' || PACSTRAP=0
@ -3334,7 +3347,7 @@ chk_connect()
{
if [[ ! -f /tmp/new ]]; then
msg "Network Connect" "\nVerifying network connection\n" 0
if [[ $VM != 'none' ]] && hash nm-online > /dev/null 2>&1; then
if [[ $VIRT != 'none' ]] && hash nm-online > /dev/null 2>&1; then
nm-online > /dev/null 2>&1
else
ping -qc1 'archlinux.org' > /dev/null 2>&1
@ -3398,7 +3411,7 @@ system_devices()
system_identify()
{
if [[ $VM != 'none' ]]; then
if [[ $VIRT != 'none' ]]; then
UCODE=''
elif grep -q 'AuthenticAMD' /proc/cpuinfo; then
UCODE="amd-ucode"
@ -3491,11 +3504,12 @@ fi
if [[ $TERM == 'linux' ]]; then
if [[ -f /tmp/font ]]; then
FONT="$(< /tmp/font)"
: "${FONT=ter-i16n}"
setfont "$FONT"
else
fontsize=16
while [[ $TERM == 'linux' && ! -f /tmp/font ]]; do
dlg fontsize menu "Font Size" "\nSelect a font size from the list below.\n\nDefault: 16" \
dlg fontsize menu "Font Size" "\nSelect a font size from the list below.\n\ndefault: 16" \
12 "setfont ter-i12n" 14 "setfont ter-i14n" 16 "setfont ter-i16n" 18 "setfont ter-i18n" \
20 "setfont ter-i20n" 22 "setfont ter-i22n" 24 "setfont ter-i24n" 28 "setfont ter-i28n" \
32 "setfont ter-i32n" || break
@ -3508,7 +3522,7 @@ if [[ $TERM == 'linux' ]]; then
fi
if [[ ! -f /tmp/weld ]]; then
msg "Welcome to the $DIST Installer" "\nThis will help you get $DIST installed and setup on your system.\n\nIf you are unsure about an option, the default or most common\nwill be mentioned or the first selected entry will be the default.\n\n\nMenu Navigation:\n\n - Select items with the arrow keys or the option number.\n - Use [Space] to toggle check boxes and [Enter] to accept.\n - Switch between fields using [Tab] or the arrow keys.\n - Use [Page Up] and [Page Down] to jump whole pages\n - Press the highlighted key of an option to select it.\n"
msg "Welcome to the $DIST Installer" "\nThis will help you get $DIST installed and setup on your system.\n\nIf you are unsure about an option, the default or most common option\nwill be described, if it is not the first selected entry will be the default.\n\n\nMenu Navigation:\n\n - Select items with the arrow keys or the highlighted key.\n - Repeatedly pressing the highlighted key for an option will cycle through options beginning with that key.\n - Use [Space] to toggle check boxes and [Enter] to accept selection.\n - Use [Escape] or select the cancel/exit button to exit a menu or dialog.\n - Switch between fields using [Tab] or the arrow keys.\n - Use [Page Up] and [Page Down] to jump whole pages.\n"
touch /tmp/weld
fi