Change LUKS and LVM to strings

This commit is contained in:
natemaia
2018-10-27 18:20:30 -07:00
parent 0c1b09ab7e
commit 2bb960f486
8 changed files with 129 additions and 127 deletions

View File

@ -12,7 +12,7 @@
# immutable {
readonly DIST="ArchLabs" # Linux distributor
readonly VER="1.7.2" # Installer version
readonly VER="1.7.5" # Installer version
readonly LIVE="liveuser" # Live session user
readonly MNT="/mnt/install" # Install mountpoint
readonly ERR="/tmp/errlog" # Built-in error log
@ -24,7 +24,7 @@ readonly VM="$(dmesg | grep -i "hypervisor")"
readonly SALT="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
readonly SYS_MEM=$(grep 'MemTotal' /proc/meminfo | awk '{print int($2 / 1024)"M"}')
readonly LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if($1) print $1 " -"}' /etc/locale.gen)"
readonly CONSOLE_MAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
readonly CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
if grep -q 'GenuineIntel' /proc/cpuinfo; then
readonly UCODE="intel-ucode.img"
@ -59,6 +59,8 @@ epo Esperanto np Nepali et Amharic sn Wolof ml Bambara tz Swahili ke Swahili bw
ph Filipino id Indonesian my Malay tm Turkmen bt Dzongkha lv Latvian md Moldavian mao Maori
by Belarusian me Montenegrin mk Macedonian kh Khmer az Azerbaijani"
readonly KERNELS="linux - linux-lts -"
declare -Agr BMNTS=(
[UEFI-grub]="/boot/efi" [UEFI-systemd-boot]="/boot" [BIOS-grub]="/boot"
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/boot"
@ -94,7 +96,7 @@ init() {
declare -g BOOTLDR=""
declare -g EXTRA_MNT=""
declare -g EXTRA_MNTS=""
declare -g SWAP="none"
declare -g SWAP=""
declare -g SWAP_SIZE="$SYS_MEM"
declare -g NEWUSER=""
declare -g USER_PASS=""
@ -243,18 +245,18 @@ keymap() {
[[ $? != 0 || $KEYMAP == "" ]] && return 1
# when a matching console map is not available open a selection dialog
if ! [[ $CONSOLE_MAPS =~ "$KEYMAP -" ]]; then
CONSOLE_MAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_CMapTitle " --menu "$_CMapBody" 20 70 12 $CONSOLE_MAPS)"
[[ $? != 0 || $CONSOLE_MAP == "" ]] && return 1
if [[ $CMAPS =~ "$KEYMAP -" ]]; then
CMAP="$KEYMAP"
else
CONSOLE_MAP="$KEYMAP"
CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_CMapTitle " --menu "$_CMapBody" 20 70 12 $CMAPS)"
[[ $? != 0 || $CMAP == "" ]] && return 1
fi
if [[ $DISPLAY && $TERM != 'linux' ]]; then
hash setxkbmap >/dev/null 2>&1 && setxkbmap $KEYMAP >/dev/null 2>&1
setxkbmap $KEYMAP >/dev/null 2>&1
else
hash loadkeys >/dev/null 2>&1 && loadkeys $CONSOLE_MAP >/dev/null 2>&1
loadkeys $CMAP >/dev/null 2>&1
fi
return 0
}
@ -438,7 +440,7 @@ packages() {
([[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]) && pkgs+=" ttf-hack"
([[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]) && pkgs+=" qt5ct qt5-styleplugins"
EXTRA_PACKAGES+="$pkgs"
EXTRA_PACKAGES+=" $pkgs"
return 0
}
@ -482,51 +484,59 @@ mirrors() {
}
display() {
msgbox "$_PrepTitle" "\nConfiguration values used for install\n\n
Root: $ROOT_PART
Boot: $BOOT_PART
Swap: $SWAP
local cmd mnt
cmd="${BCMDS[$BOOTLDR]}"
mnt="${BMNTS[$SYS-$BOOTLDR]}"
msgbox "$_PrepTitle" "\nConfiguration values for the current install\n\n
Root: ${ROOT_PART:-None}
Boot: ${BOOT_PART:-None}
Swap: ${SWAP:-None}
Extra: ${EXTRA_MNTS:-None}
Hooks: ${MKINIT_HOOKS:-None}
LVM: $LVM
LUKS: $LUKS
LVM: ${LVM:-None}
LUKS: ${LUKS:-None}
Bootloader: $BOOTLDR
Boot Mount: ${BMNTS[$SYS-$BOOTLDR]}
Boot Command: ${BCMDS[$BOOTLDR]}
Bootloader: ${BOOTLDR:-None}
Boot Mount: ${mnt:-None}
Boot Command: ${cmd:-None}
User: $NEWUSER
Hostname: $HOSTNAME
Locale: $LOCALE
Keymap: $KEYMAP
Timezone: $ZONE/$SUBZONE
User: ${NEWUSER:-None}
Hostname: ${HOSTNAME:-None}
Locale: ${LOCALE:-None}
Keymap: ${KEYMAP:-None}
Timezone: ${ZONE:-None}/${SUBZONE:-None}
Autologin: $AUTOLOGIN
Login: $LOGIN_WM
Login Type: $LOGIN_TYPE
Autologin: ${AUTOLOGIN:-None}
Login: ${LOGIN_WM:-None}
Login Type: ${LOGIN_TYPE:-None}
Sessions: $INSTALL_WMS
Kernel: $KERNEL
Mirrors: $MIRROR_CMD
Packages: $EXTRA_PACKAGES\n"
Sessions: ${INSTALL_WMS:-None}
Kernel: ${KERNEL:-None}
Mirrors: ${MIRROR_CMD:-None}
Packages: ${EXTRA_PACKAGES:-None}\n"
}
configure() {
tput cnorm
HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"
[[ $? != 0 || $HOSTNAME == "" ]] && return 1
[[ $? != 0 || ! $HOSTNAME ]] && return 1
tput civis
LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"
[[ $? != 0 || $LOCALE == "" ]] && return 1
[[ $? != 0 || ! $LOCALE ]] && return 1
timezone || return 1
mirrors || return 1
user || return 1
sessions || return 1
yesno 'Choose Kernel' "\nUse the current kernel or the LTS kernel?\n" 'Current' 'LTS' &&
KERNEL='linux' || KERNEL='linux-lts'
tput civis
KERNEL="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_KernelTitle " --menu "$_KernelBody" 0 0 0 $KERNELS)"
[[ $? != 0 || ! $KERNEL ]] && return 1
packages || return 1
CONFIG_DONE=true
return 0
@ -540,14 +550,17 @@ configs() {
fi
tput civis
local exitstr="Exit"
[[ $DEBUG != true ]] && exitstr+=" & Reboot"
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
"1" "Exit & Reboot" "2" "Keyboard" "3" "Locale" "4" "Hostname" "5" "Sudoers" \
"1" "$exitstr" "2" "Keyboard" "3" "Locale" "4" "Hostname" "5" "Sudoers" \
"6" "Mkinitcpio.conf" "7" "Fstab" "8" "Crypttab" "9" "${BOOTLDR^}" "10" "Pacman.conf" \
"11" "${LOGIN_TYPE^}")
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
die 'reboot'
[[ $DEBUG == true ]] && die 0 || die 'reboot'
else
local existing_files=""
for f in $(echo "${FILES[$SELECTED]}"); do