Change LUKS and LVM to strings
This commit is contained in:
parent
0c1b09ab7e
commit
2bb960f486
@ -113,6 +113,9 @@ _DevSelBody="\nSelect a device from the list below.\n\nDevices (/dev) are the av
|
|||||||
_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."
|
_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 forward slash (/).\nSome examples include:"
|
_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a forward slash (/).\nSome examples include:"
|
||||||
|
|
||||||
|
# kernel
|
||||||
|
_KernelTitle="Choose Kernel"
|
||||||
|
_KernelBody="\nKeep the default linux kernel or switch to the LTS kernel?\n"
|
||||||
|
|
||||||
# Partitioning Menu
|
# Partitioning Menu
|
||||||
_PartTitle="Partitioning Tool"
|
_PartTitle="Partitioning Tool"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# immutable {
|
# immutable {
|
||||||
|
|
||||||
readonly DIST="ArchLabs" # Linux distributor
|
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 LIVE="liveuser" # Live session user
|
||||||
readonly MNT="/mnt/install" # Install mountpoint
|
readonly MNT="/mnt/install" # Install mountpoint
|
||||||
readonly ERR="/tmp/errlog" # Built-in error log
|
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 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 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 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
|
if grep -q 'GenuineIntel' /proc/cpuinfo; then
|
||||||
readonly UCODE="intel-ucode.img"
|
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
|
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"
|
by Belarusian me Montenegrin mk Macedonian kh Khmer az Azerbaijani"
|
||||||
|
|
||||||
|
readonly KERNELS="linux - linux-lts -"
|
||||||
|
|
||||||
declare -Agr BMNTS=(
|
declare -Agr BMNTS=(
|
||||||
[UEFI-grub]="/boot/efi" [UEFI-systemd-boot]="/boot" [BIOS-grub]="/boot"
|
[UEFI-grub]="/boot/efi" [UEFI-systemd-boot]="/boot" [BIOS-grub]="/boot"
|
||||||
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/boot"
|
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/boot"
|
||||||
@ -94,7 +96,7 @@ init() {
|
|||||||
declare -g BOOTLDR=""
|
declare -g BOOTLDR=""
|
||||||
declare -g EXTRA_MNT=""
|
declare -g EXTRA_MNT=""
|
||||||
declare -g EXTRA_MNTS=""
|
declare -g EXTRA_MNTS=""
|
||||||
declare -g SWAP="none"
|
declare -g SWAP=""
|
||||||
declare -g SWAP_SIZE="$SYS_MEM"
|
declare -g SWAP_SIZE="$SYS_MEM"
|
||||||
declare -g NEWUSER=""
|
declare -g NEWUSER=""
|
||||||
declare -g USER_PASS=""
|
declare -g USER_PASS=""
|
||||||
@ -243,18 +245,18 @@ keymap() {
|
|||||||
[[ $? != 0 || $KEYMAP == "" ]] && return 1
|
[[ $? != 0 || $KEYMAP == "" ]] && return 1
|
||||||
|
|
||||||
# when a matching console map is not available open a selection dialog
|
# when a matching console map is not available open a selection dialog
|
||||||
if ! [[ $CONSOLE_MAPS =~ "$KEYMAP -" ]]; then
|
if [[ $CMAPS =~ "$KEYMAP -" ]]; then
|
||||||
CONSOLE_MAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
CMAP="$KEYMAP"
|
||||||
--title " $_CMapTitle " --menu "$_CMapBody" 20 70 12 $CONSOLE_MAPS)"
|
|
||||||
[[ $? != 0 || $CONSOLE_MAP == "" ]] && return 1
|
|
||||||
else
|
else
|
||||||
CONSOLE_MAP="$KEYMAP"
|
CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
|
--title " $_CMapTitle " --menu "$_CMapBody" 20 70 12 $CMAPS)"
|
||||||
|
[[ $? != 0 || $CMAP == "" ]] && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $DISPLAY && $TERM != 'linux' ]]; then
|
if [[ $DISPLAY && $TERM != 'linux' ]]; then
|
||||||
hash setxkbmap >/dev/null 2>&1 && setxkbmap $KEYMAP >/dev/null 2>&1
|
setxkbmap $KEYMAP >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
hash loadkeys >/dev/null 2>&1 && loadkeys $CONSOLE_MAP >/dev/null 2>&1
|
loadkeys $CMAP >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -438,7 +440,7 @@ packages() {
|
|||||||
([[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]) && pkgs+=" ttf-hack"
|
([[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]) && pkgs+=" ttf-hack"
|
||||||
([[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]) && pkgs+=" qt5ct qt5-styleplugins"
|
([[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]) && pkgs+=" qt5ct qt5-styleplugins"
|
||||||
|
|
||||||
EXTRA_PACKAGES+="$pkgs"
|
EXTRA_PACKAGES+=" $pkgs"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,51 +484,59 @@ mirrors() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
display() {
|
display() {
|
||||||
msgbox "$_PrepTitle" "\nConfiguration values used for install\n\n
|
local cmd mnt
|
||||||
Root: $ROOT_PART
|
cmd="${BCMDS[$BOOTLDR]}"
|
||||||
Boot: $BOOT_PART
|
mnt="${BMNTS[$SYS-$BOOTLDR]}"
|
||||||
Swap: $SWAP
|
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}
|
Extra: ${EXTRA_MNTS:-None}
|
||||||
|
Hooks: ${MKINIT_HOOKS:-None}
|
||||||
|
|
||||||
LVM: $LVM
|
LVM: ${LVM:-None}
|
||||||
LUKS: $LUKS
|
LUKS: ${LUKS:-None}
|
||||||
|
|
||||||
Bootloader: $BOOTLDR
|
Bootloader: ${BOOTLDR:-None}
|
||||||
Boot Mount: ${BMNTS[$SYS-$BOOTLDR]}
|
Boot Mount: ${mnt:-None}
|
||||||
Boot Command: ${BCMDS[$BOOTLDR]}
|
Boot Command: ${cmd:-None}
|
||||||
|
|
||||||
User: $NEWUSER
|
User: ${NEWUSER:-None}
|
||||||
Hostname: $HOSTNAME
|
Hostname: ${HOSTNAME:-None}
|
||||||
Locale: $LOCALE
|
Locale: ${LOCALE:-None}
|
||||||
Keymap: $KEYMAP
|
Keymap: ${KEYMAP:-None}
|
||||||
Timezone: $ZONE/$SUBZONE
|
Timezone: ${ZONE:-None}/${SUBZONE:-None}
|
||||||
|
|
||||||
Autologin: $AUTOLOGIN
|
Autologin: ${AUTOLOGIN:-None}
|
||||||
Login: $LOGIN_WM
|
Login: ${LOGIN_WM:-None}
|
||||||
Login Type: $LOGIN_TYPE
|
Login Type: ${LOGIN_TYPE:-None}
|
||||||
|
|
||||||
Sessions: $INSTALL_WMS
|
Sessions: ${INSTALL_WMS:-None}
|
||||||
Kernel: $KERNEL
|
Kernel: ${KERNEL:-None}
|
||||||
Mirrors: $MIRROR_CMD
|
Mirrors: ${MIRROR_CMD:-None}
|
||||||
Packages: $EXTRA_PACKAGES\n"
|
Packages: ${EXTRA_PACKAGES:-None}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
configure() {
|
configure() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"
|
HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"
|
||||||
[[ $? != 0 || $HOSTNAME == "" ]] && return 1
|
[[ $? != 0 || ! $HOSTNAME ]] && return 1
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"
|
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"
|
||||||
[[ $? != 0 || $LOCALE == "" ]] && return 1
|
[[ $? != 0 || ! $LOCALE ]] && return 1
|
||||||
|
|
||||||
timezone || return 1
|
timezone || return 1
|
||||||
mirrors || return 1
|
mirrors || return 1
|
||||||
user || return 1
|
user || return 1
|
||||||
sessions || 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
|
packages || return 1
|
||||||
CONFIG_DONE=true
|
CONFIG_DONE=true
|
||||||
return 0
|
return 0
|
||||||
@ -540,14 +550,17 @@ configs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
|
local exitstr="Exit"
|
||||||
|
[[ $DEBUG != true ]] && exitstr+=" & Reboot"
|
||||||
|
|
||||||
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
|
--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" \
|
"6" "Mkinitcpio.conf" "7" "Fstab" "8" "Crypttab" "9" "${BOOTLDR^}" "10" "Pacman.conf" \
|
||||||
"11" "${LOGIN_TYPE^}")
|
"11" "${LOGIN_TYPE^}")
|
||||||
|
|
||||||
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
|
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
|
||||||
die 'reboot'
|
[[ $DEBUG == true ]] && die 0 || die 'reboot'
|
||||||
else
|
else
|
||||||
local existing_files=""
|
local existing_files=""
|
||||||
for f in $(echo "${FILES[$SELECTED]}"); do
|
for f in $(echo "${FILES[$SELECTED]}"); do
|
||||||
|
@ -12,11 +12,11 @@ prep_for_grub() {
|
|||||||
local cfg="$MNT/etc/default/grub"
|
local cfg="$MNT/etc/default/grub"
|
||||||
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
|
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
|
||||||
s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg
|
s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg
|
||||||
if [[ $LUKS -eq 1 ]]; then
|
if [[ $LUKS_DEV ]]; then
|
||||||
sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g;
|
sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g;
|
||||||
s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $cfg
|
s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $cfg
|
||||||
fi
|
fi
|
||||||
if [[ $SYS == 'BIOS' && $LVM -eq 1 && $SEPERATE_BOOT == false ]]; then
|
if [[ $SYS == 'BIOS' && $LVM && $SEPERATE_BOOT == false ]]; then
|
||||||
sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" $cfg
|
sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" $cfg
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@ -124,8 +124,7 @@ uefi_boot_fallback() {
|
|||||||
# also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems
|
# also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems
|
||||||
|
|
||||||
local esp="${MNT}${BMNTS[$SYS-$BOOTLDR]}"
|
local esp="${MNT}${BMNTS[$SYS-$BOOTLDR]}"
|
||||||
|
local default="Boot"
|
||||||
local default="boot"
|
|
||||||
default="$(find $esp/EFI/ -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d)"
|
default="$(find $esp/EFI/ -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d)"
|
||||||
[[ $default ]] && default="$(basename $default)"
|
[[ $default ]] && default="$(basename $default)"
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ install() {
|
|||||||
oneshot install_base
|
oneshot install_base
|
||||||
|
|
||||||
# generate /etc/fstab and touch it up if we used a swapfile
|
# generate /etc/fstab and touch it up if we used a swapfile
|
||||||
genfstab -U $MNT > $MNT/etc/fstab # 2>$ERR
|
genfstab -U $MNT > $MNT/etc/fstab 2>$ERR
|
||||||
echeck "genfstab -U $MNT > $MNT/etc/fstab"
|
echeck "genfstab -U $MNT > $MNT/etc/fstab"
|
||||||
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
|
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ BACKSPACE="guess"
|
|||||||
EOF
|
EOF
|
||||||
# console keymap
|
# console keymap
|
||||||
cat > $MNT/etc/vconsole.conf <<EOF
|
cat > $MNT/etc/vconsole.conf <<EOF
|
||||||
KEYMAP=$CONSOLE_MAP
|
KEYMAP=$CMAP
|
||||||
FONT=$FONT
|
FONT=$FONT
|
||||||
EOF
|
EOF
|
||||||
# set the hostname
|
# set the hostname
|
||||||
@ -206,14 +206,14 @@ EOF
|
|||||||
run_mkinitcpio() {
|
run_mkinitcpio() {
|
||||||
local add=""
|
local add=""
|
||||||
# setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
|
# setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
|
||||||
[[ $LUKS -eq 1 && $LVM -eq 0 && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile
|
[[ $LUKS && ! $LVM && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile
|
||||||
|
|
||||||
# new hooks needed in /etc/mkinitcpio.conf if we used LUKS and/or LVM
|
# new hooks needed in /etc/mkinitcpio.conf if we used LUKS and/or LVM
|
||||||
(( LVM == 1 )) && add="lvm2"
|
[[ $LVM ]] && add="lvm2"
|
||||||
(( LUKS == 1 )) && add="encrypt$([[ $add ]] && printf " %s" "$add")"
|
[[ $LUKS ]] && add="encrypt$([[ $add ]] && printf " %s" "$add")"
|
||||||
sed -i "s/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g" $MNT/etc/mkinitcpio.conf
|
sed -i "s/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g" $MNT/etc/mkinitcpio.conf
|
||||||
|
|
||||||
chrun "mkinitcpio -p $KERNEL" # 2>$ERR
|
chrun "mkinitcpio -p $KERNEL" 2>$ERR
|
||||||
echeck "mkinitcpio -p $KERNEL"
|
echeck "mkinitcpio -p $KERNEL"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,21 +239,12 @@ package_operations() {
|
|||||||
rmpkg+=" virtualbox-guest-modules-arch linux"
|
rmpkg+=" virtualbox-guest-modules-arch linux"
|
||||||
inpkg+=" linux-lts"
|
inpkg+=" linux-lts"
|
||||||
# if the system is a VM then install the needed packages otherwise remove the guest utils
|
# if the system is a VM then install the needed packages otherwise remove the guest utils
|
||||||
if [[ $VM ]]; then
|
[[ $VM ]] && inpkg+=" virtualbox-guest-dkms linux-lts-headers" || rmpkg+=" virtualbox-guest-utils"
|
||||||
inpkg+=" virtualbox-guest-dkms linux-lts-headers"
|
|
||||||
else
|
|
||||||
rmpkg+=" virtualbox-guest-utils"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
# if the system is not a VM then remove the guest utils
|
# if the system is not a VM then remove the guest utils
|
||||||
if ! [[ $VM ]]; then
|
[[ $VM ]] || rmpkg+=" virtualbox-guest-modules-arch virtualbox-guest-utils"
|
||||||
rmpkg+=" virtualbox-guest-modules-arch virtualbox-guest-utils"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $UCODE == 'amd-ucode.img' ]]; then
|
|
||||||
inpkg+=" amd-ucode"
|
|
||||||
fi
|
fi
|
||||||
|
[[ $UCODE == 'amd-ucode.img' ]] && inpkg+=" amd-ucode"
|
||||||
|
|
||||||
# for only gnome or cinnamon we don't need the xfce provided stuff
|
# for only gnome or cinnamon we don't need the xfce provided stuff
|
||||||
[[ $INSTALL_WMS =~ (gnome|cinnamon) ]] && rmpkg+=" $(pacman -Qssq 'xfce4*' 2>/dev/null)"
|
[[ $INSTALL_WMS =~ (gnome|cinnamon) ]] && rmpkg+=" $(pacman -Qssq 'xfce4*' 2>/dev/null)"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
declare -g LUKS=0
|
declare -g LUKS=""
|
||||||
declare -g LUKS_DEV=""
|
declare -g LUKS_DEV=""
|
||||||
declare -g LUKS_PART=""
|
declare -g LUKS_PART=""
|
||||||
declare -g LUKS_PASS=""
|
declare -g LUKS_PASS=""
|
||||||
@ -36,10 +36,10 @@ luks_open() {
|
|||||||
luks_pass "$_LuksOpen" "$LUKS_NAME" || return 1
|
luks_pass "$_LuksOpen" "$LUKS_NAME" || return 1
|
||||||
|
|
||||||
infobox "$_LuksOpen" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
infobox "$_LuksOpen" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
||||||
cryptsetup open --type luks $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
cryptsetup open --type luks $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
||||||
echeck "cryptsetup open --type luks $LUKS_PART $LUKS_NAME"
|
echeck "cryptsetup open --type luks $LUKS_PART $LUKS_NAME"
|
||||||
|
|
||||||
LUKS=1
|
LUKS=' encrypted'
|
||||||
luks_show
|
luks_show
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ luks_setup() {
|
|||||||
modprobe -a dm-mod dm_crypt
|
modprobe -a dm-mod dm_crypt
|
||||||
unmountp
|
unmountp
|
||||||
|
|
||||||
if [[ $ROOT_PART == "" || $LVM -eq 1 ]]; then
|
if [[ ! $ROOT_PART || $LVM ]]; then
|
||||||
find_partitions 'part|lvm' || return 1
|
find_partitions 'part|lvm' || return 1
|
||||||
[[ $BOOT_PART != "" ]] && decr_count "$BOOT_PART"
|
[[ $BOOT_PART != "" ]] && decr_count "$BOOT_PART"
|
||||||
|
|
||||||
@ -117,13 +117,13 @@ luks_default() {
|
|||||||
luks_setup || return 1
|
luks_setup || return 1
|
||||||
infobox "$_LuksEncrypt" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
infobox "$_LuksEncrypt" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
||||||
|
|
||||||
cryptsetup -q luksFormat $LUKS_PART <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
cryptsetup -q luksFormat $LUKS_PART <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
||||||
echeck "cryptsetup -q luksFormat $LUKS_PART"
|
echeck "cryptsetup -q luksFormat $LUKS_PART"
|
||||||
|
|
||||||
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
||||||
echeck "cryptsetup open $LUKS_PART $LUKS_NAME"
|
echeck "cryptsetup open $LUKS_PART $LUKS_NAME"
|
||||||
|
|
||||||
LUKS=1
|
LUKS=' encrypted'
|
||||||
luks_show
|
luks_show
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -137,10 +137,10 @@ luks_keycmd() {
|
|||||||
|
|
||||||
infobox "$_LuksEncryptAdv" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
infobox "$_LuksEncryptAdv" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
||||||
|
|
||||||
cryptsetup -q $cipher luksFormat $LUKS_PART <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
cryptsetup -q $cipher luksFormat $LUKS_PART <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
||||||
echeck "cryptsetup -q $cipher luksFormat $LUKS_PART"
|
echeck "cryptsetup -q $cipher luksFormat $LUKS_PART"
|
||||||
|
|
||||||
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
||||||
echeck "cryptsetup open $LUKS_PART $LUKS_NAME"
|
echeck "cryptsetup open $LUKS_PART $LUKS_NAME"
|
||||||
|
|
||||||
luks_show
|
luks_show
|
||||||
@ -192,7 +192,7 @@ luks_keyfile() {
|
|||||||
mkkey="$mkkey && cryptsetup luksAddKey /dev/$n /crypto_keyfile.bin <<< '$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")'"
|
mkkey="$mkkey && cryptsetup luksAddKey /dev/$n /crypto_keyfile.bin <<< '$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")'"
|
||||||
|
|
||||||
chrun "$mkkey"
|
chrun "$mkkey"
|
||||||
sed -i 's/FILES=()/FILES=(\/crypto_keyfile.bin)/g' $MNT/etc/mkinitcpio.conf # 2>$ERR
|
sed -i 's/FILES=()/FILES=(\/crypto_keyfile.bin)/g' $MNT/etc/mkinitcpio.conf 2>$ERR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
declare -g LVM=0
|
declare -g LVM=""
|
||||||
declare -g VOL_GROUP_MB=0
|
declare -g VOL_GROUP_MB=0
|
||||||
declare -g GROUP_PARTS=0
|
declare -g GROUP_PARTS=0
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ lvm_extra_lvs() {
|
|||||||
get_lv_size || { break; return 1; }
|
get_lv_size || { break; return 1; }
|
||||||
|
|
||||||
# create it
|
# create it
|
||||||
lvcreate -L "$VOLUME_SIZE" "$VOLUME_GROUP" -n "$VOLUME_NAME" # 2>$ERR
|
lvcreate -L "$VOLUME_SIZE" "$VOLUME_GROUP" -n "$VOLUME_NAME" 2>$ERR
|
||||||
echeck "lvcreate -L $VOLUME_SIZE $VOLUME_GROUP -n $VOLUME_NAME"
|
echeck "lvcreate -L $VOLUME_SIZE $VOLUME_GROUP -n $VOLUME_NAME"
|
||||||
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$_Done LV $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2."
|
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$_Done LV $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2."
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ lvm_create_group() {
|
|||||||
|
|
||||||
# create it
|
# create it
|
||||||
infobox "$_LvmCreateVG" "$_LvmPvActBody1 $VOLUME_GROUP\n" 0
|
infobox "$_LvmCreateVG" "$_LvmPvActBody1 $VOLUME_GROUP\n" 0
|
||||||
vgcreate -f "$VOLUME_GROUP" "$GROUP_PARTS" >/dev/null # 2>$ERR
|
vgcreate -f "$VOLUME_GROUP" "$GROUP_PARTS" >/dev/null 2>$ERR
|
||||||
echeck "vgcreate -f $VOLUME_GROUP $GROUP_PARTS"
|
echeck "vgcreate -f $VOLUME_GROUP $GROUP_PARTS"
|
||||||
|
|
||||||
# get volume size size and transform size to MB if size is given in GB
|
# get volume size size and transform size to MB if size is given in GB
|
||||||
@ -204,7 +204,7 @@ lvm_create() {
|
|||||||
VOL_GROUP_MB=0
|
VOL_GROUP_MB=0
|
||||||
unmountp
|
unmountp
|
||||||
|
|
||||||
if [[ $LUKS -eq 1 && $LUKS_NAME != "" ]]; then
|
if [[ $LUKS && $LUKS_NAME ]]; then
|
||||||
GROUP_PARTS="/dev/mapper/$LUKS_NAME"
|
GROUP_PARTS="/dev/mapper/$LUKS_NAME"
|
||||||
infobox "$_LvmCreateVG" "\nUsing encrypted partition created earlier: $GROUP_PARTS\n" 1
|
infobox "$_LvmCreateVG" "\nUsing encrypted partition created earlier: $GROUP_PARTS\n" 1
|
||||||
else
|
else
|
||||||
@ -217,11 +217,10 @@ lvm_create() {
|
|||||||
|
|
||||||
# last or only logical volume
|
# last or only logical volume
|
||||||
lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VOL_GROUP_MB}MB)" || return 1
|
lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VOL_GROUP_MB}MB)" || return 1
|
||||||
lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" # 2>$ERR
|
lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" 2>$ERR
|
||||||
echeck "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME"
|
echeck "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME"
|
||||||
|
|
||||||
LVM=1
|
LVM=' logical volume'
|
||||||
|
|
||||||
show_devices
|
show_devices
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -248,7 +247,7 @@ lvm_del_all() {
|
|||||||
for i in $PHYSICAL_VOLUMES; do
|
for i in $PHYSICAL_VOLUMES; do
|
||||||
pvremove -f "$i" >/dev/null 2>&1
|
pvremove -f "$i" >/dev/null 2>&1
|
||||||
done
|
done
|
||||||
LVM=0
|
LVM=' logical volume'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -8,10 +8,6 @@
|
|||||||
|
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
########################################################
|
|
||||||
## Partition functions ##
|
|
||||||
########################################################
|
|
||||||
|
|
||||||
format() {
|
format() {
|
||||||
infobox "$_FSTitle" "\nFormatting: $1\n\nCommand: ${FS_CMDS[$2]}\n" 0
|
infobox "$_FSTitle" "\nFormatting: $1\n\nCommand: ${FS_CMDS[$2]}\n" 0
|
||||||
${FS_CMDS[$2]} $1 >/dev/null 2>$ERR
|
${FS_CMDS[$2]} $1 >/dev/null 2>$ERR
|
||||||
@ -62,14 +58,14 @@ decr_count() {
|
|||||||
|
|
||||||
enable_swap() {
|
enable_swap() {
|
||||||
if [[ $1 == "$MNT/swapfile" ]]; then
|
if [[ $1 == "$MNT/swapfile" ]]; then
|
||||||
fallocate -l $SWAP_SIZE $1 # 2>$ERR
|
fallocate -l $SWAP_SIZE $1 2>$ERR
|
||||||
echeck "fallocate -l $SWAP_SIZE $1"
|
echeck "fallocate -l $SWAP_SIZE $1"
|
||||||
chmod 600 $1 # 2>$ERR
|
chmod 600 $1 2>$ERR
|
||||||
echeck "chmod 600 $1"
|
echeck "chmod 600 $1"
|
||||||
fi
|
fi
|
||||||
mkswap $1 >/dev/null # 2>$ERR
|
mkswap $1 >/dev/null 2>$ERR
|
||||||
echeck "mkswap $1"
|
echeck "mkswap $1"
|
||||||
swapon $1 >/dev/null # 2>$ERR
|
swapon $1 >/dev/null 2>$ERR
|
||||||
echeck "swapon $1"
|
echeck "swapon $1"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -116,34 +112,31 @@ select_device() {
|
|||||||
confirm_mount() {
|
confirm_mount() {
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local mount="$2"
|
local mount="$2"
|
||||||
|
|
||||||
local msg="Partition: $part\n"
|
local msg="Partition: $part\n"
|
||||||
[[ $mount == "$MNT" ]] && msg+="Mountpoint: / (root)" || msg+="Mountpoint: ${mount#$MNT}"
|
[[ $mount == "$MNT" ]] && msg+="Mountpoint: / (root)" || msg+="Mountpoint: ${mount#$MNT}"
|
||||||
|
|
||||||
if [[ $(mount) =~ "$mount" ]]; then
|
if [[ $(mount) =~ "$mount" ]]; then
|
||||||
infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1
|
infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1 && decr_count "$part"
|
||||||
decr_count "$part"
|
|
||||||
else
|
else
|
||||||
infobox "$_MntTitle" "$_MntFail\n$msg\n" 1
|
infobox "$_MntTitle" "$_MntFail\n$msg\n" 1 && return 1
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
check_cryptlvm() {
|
check_cryptlvm() {
|
||||||
local part="$1"
|
|
||||||
local dev=""
|
local dev=""
|
||||||
|
local part="$1"
|
||||||
local devs="$(lsblk -lno NAME,FSTYPE,TYPE)"
|
local devs="$(lsblk -lno NAME,FSTYPE,TYPE)"
|
||||||
|
|
||||||
# Identify if $part is "crypt" (LUKS on LVM, or LUKS alone)
|
# Identify if $part is "crypt" (LUKS on LVM, or LUKS alone)
|
||||||
if [[ $(lsblk -lno TYPE "$part") =~ 'crypt' ]]; then
|
if [[ $(lsblk -lno TYPE "$part") =~ 'crypt' ]]; then
|
||||||
LUKS=1
|
LUKS=' encrypted'
|
||||||
LUKS_NAME="${part#/dev/mapper/}"
|
LUKS_NAME="${part#/dev/mapper/}"
|
||||||
|
|
||||||
for dev in $(awk '/lvm/ && /crypto_LUKS/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
|
for dev in $(awk '/lvm/ && /crypto_LUKS/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
|
||||||
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
|
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
|
||||||
LUKS_DEV="$LUKS_DEV cryptdevice=$dev:$LUKS_NAME"
|
LUKS_DEV="$LUKS_DEV cryptdevice=$dev:$LUKS_NAME"
|
||||||
LVM=1
|
LVM=' logical volume'
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -156,7 +149,7 @@ check_cryptlvm() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
elif [[ $(lsblk -lno TYPE "$part") =~ 'lvm' ]]; then
|
elif [[ $(lsblk -lno TYPE "$part") =~ 'lvm' ]]; then
|
||||||
LVM=1
|
LVM=' logical volume'
|
||||||
VOLUME_NAME="${part#/dev/mapper/}"
|
VOLUME_NAME="${part#/dev/mapper/}"
|
||||||
|
|
||||||
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
|
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
|
||||||
@ -169,7 +162,7 @@ check_cryptlvm() {
|
|||||||
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
|
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
|
||||||
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
|
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
|
||||||
LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_UUID:$LUKS_NAME"
|
LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_UUID:$LUKS_NAME"
|
||||||
LUKS=1
|
LUKS=' encrypted'
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -187,7 +180,16 @@ auto_partition() {
|
|||||||
|
|
||||||
# confirm or bail
|
# confirm or bail
|
||||||
yesno "$_PrepParts" "$_PartBody1 $device $_PartBody2 ($size)$_PartBody3" || return 0
|
yesno "$_PrepParts" "$_PartBody1 $device $_PartBody2 ($size)$_PartBody3" || return 0
|
||||||
infobox "$_PrepParts" "\nAuto partitioning device: $device\n" 0
|
|
||||||
|
local newtable format
|
||||||
|
if [[ $SYS == BIOS ]]; then
|
||||||
|
newtable="msdos"; format="ext4"
|
||||||
|
else
|
||||||
|
newtable="gpt"; format="fat32"
|
||||||
|
fi
|
||||||
|
|
||||||
|
infobox "$_PrepParts" "\nRemoving existing partitions on $device and setting partition table to $newtable\n" 0
|
||||||
|
|
||||||
swapoff -a # in case the device was previously used for swap
|
swapoff -a # in case the device was previously used for swap
|
||||||
local dev_info="$(parted -s $device print)"
|
local dev_info="$(parted -s $device print)"
|
||||||
|
|
||||||
@ -196,16 +198,15 @@ auto_partition() {
|
|||||||
parted -s $device rm $i >/dev/null 2>&1
|
parted -s $device rm $i >/dev/null 2>&1
|
||||||
done
|
done
|
||||||
|
|
||||||
local newtable
|
|
||||||
[[ $SYS == BIOS ]] && newtable="msdos" || newtable="gpt"
|
|
||||||
if [[ $(awk '/Table:/ {print $3}' <<< "$dev_info") != "$newtable" ]]; then
|
if [[ $(awk '/Table:/ {print $3}' <<< "$dev_info") != "$newtable" ]]; then
|
||||||
parted -s $device mklabel $newtable >/dev/null 2>&1
|
parted -s $device mklabel $newtable >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
infobox "$_PrepParts" "\nCreating a 512M $format boot partition.\n" 0
|
||||||
if [[ $SYS == "BIOS" ]]; then
|
if [[ $SYS == "BIOS" ]]; then
|
||||||
parted -s $device mkpart primary ext4 1MiB 513MiB >/dev/null 2>&1
|
parted -s $device mkpart primary $format 1MiB 513MiB >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
parted -s $device mkpart ESP fat32 1MiB 513MiB >/dev/null 2>&1
|
parted -s $device mkpart ESP $format 1MiB 513MiB >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
@ -218,6 +219,7 @@ auto_partition() {
|
|||||||
mkfs.vfat -F32 $BOOT_PART >/dev/null 2>&1
|
mkfs.vfat -F32 $BOOT_PART >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
infobox "$_PrepParts" "\nCreating a $size ext4 root partition.\n" 0
|
||||||
parted -s $device mkpart primary ext4 513MiB 100% >/dev/null 2>&1
|
parted -s $device mkpart primary ext4 513MiB 100% >/dev/null 2>&1
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
ROOT_PART=$(lsblk -lno NAME,TYPE $device | awk 'NR == 3 {print "/dev/"$1}')
|
ROOT_PART=$(lsblk -lno NAME,TYPE $device | awk 'NR == 3 {print "/dev/"$1}')
|
||||||
@ -229,20 +231,20 @@ auto_partition() {
|
|||||||
|
|
||||||
mount_partition() {
|
mount_partition() {
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local mount="${MNT}$2"
|
local mountp="${MNT}$2"
|
||||||
local fs="$(lsblk -lno FSTYPE $part)"
|
local fs="$(lsblk -lno FSTYPE $part)"
|
||||||
|
|
||||||
mkdir -p "$mount"
|
mkdir -p "$mountp"
|
||||||
|
|
||||||
if [[ ${FS_OPTS[$fs]} != "" && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then
|
if [[ ${FS_OPTS[$fs]} != "" && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then
|
||||||
mount -o $MNT_OPTS $part "$mount" # 2>$ERR
|
mount -o $MNT_OPTS $part "$mountp" 2>$ERR
|
||||||
echeck "mount -o $MNT_OPTS $part $mount"
|
echeck "mount -o $MNT_OPTS $part $mountp"
|
||||||
else
|
else
|
||||||
mount $part "$mount" # 2>$ERR
|
mount $part "$mountp" 2>$ERR
|
||||||
echeck "mount $part $mount"
|
echeck "mount $part $mountp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
confirm_mount $part "$mount" || return 1
|
confirm_mount $part "$mountp" || return 1
|
||||||
check_cryptlvm "$part"
|
check_cryptlvm "$part"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -292,10 +294,6 @@ setup_boot_device() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################
|
|
||||||
## Mount functions ##
|
|
||||||
########################################################
|
|
||||||
|
|
||||||
mountp() {
|
mountp() {
|
||||||
# prepare partition list PARTS for dialog
|
# prepare partition list PARTS for dialog
|
||||||
lvm_detect
|
lvm_detect
|
||||||
@ -334,7 +332,7 @@ mountp() {
|
|||||||
unmountp() {
|
unmountp() {
|
||||||
swapoff -a
|
swapoff -a
|
||||||
for i in $(mount | awk "/${MNT//\//\\/}/"' {print $3}' | sort -r); do
|
for i in $(mount | awk "/${MNT//\//\\/}/"' {print $3}' | sort -r); do
|
||||||
umount -r "$i" >/dev/null 2>&1
|
umount "$i" >/dev/null 2>&1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,17 +341,17 @@ select_swap() {
|
|||||||
tput civis
|
tput civis
|
||||||
SWAP="$(dialog --backtitle "$BT" --cr-wrap --stdout --title " $_SelSwpSetup " \
|
SWAP="$(dialog --backtitle "$BT" --cr-wrap --stdout --title " $_SelSwpSetup " \
|
||||||
--menu "$_SelSwpBody" 0 0 0 "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)"
|
--menu "$_SelSwpBody" 0 0 0 "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)"
|
||||||
[[ $? != 0 || $SWAP == "$_SelSwpNone" ]] && return 0
|
[[ $? != 0 || $SWAP == "$_SelSwpNone" ]] && { SWAP=""; return 0; }
|
||||||
|
|
||||||
if [[ $SWAP == "$_SelSwpFile" ]]; then
|
if [[ $SWAP == "$_SelSwpFile" ]]; then
|
||||||
tput cnorm
|
tput cnorm
|
||||||
SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"
|
SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"
|
||||||
[[ $? != 0 || $SWAP_SIZE == "" ]] && return 1
|
[[ $? != 0 || $SWAP_SIZE == "" ]] && { SWAP=""; return 0; }
|
||||||
|
|
||||||
while ! [[ ${SWAP_SIZE:0:1} =~ [1-9] && ${SWAP_SIZE: -1} =~ (M|G) ]]; do
|
while ! [[ ${SWAP_SIZE:0:1} =~ [1-9] && ${SWAP_SIZE: -1} =~ (M|G) ]]; do
|
||||||
msgbox "$_SelSwpSetup Error" "\n$_SelSwpErr $SWAP_SIZE\n"
|
msgbox "$_SelSwpSetup Error" "\n$_SelSwpErr $SWAP_SIZE\n"
|
||||||
SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"
|
SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"
|
||||||
[[ $? != 0 || $SWAP_SIZE == "" ]] && { break; return 1; }
|
[[ $? != 0 || $SWAP_SIZE == "" ]] && { SWAP=""; break; return 0; }
|
||||||
done
|
done
|
||||||
|
|
||||||
enable_swap "$MNT/swapfile"
|
enable_swap "$MNT/swapfile"
|
||||||
@ -508,27 +506,26 @@ select_boot_partition() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
select_root_partition() {
|
select_root_partition() {
|
||||||
# if we used LUKS and no LVM or LUKS+LVM
|
# if we used LUKS and no LVM or LUKS+LVM remove the relevant partition labels from the list
|
||||||
# remove the relevant partition labels from the list
|
if [[ $LUKS && ! $LVM ]]; then
|
||||||
if (( LUKS == 1 && LVM == 0 )); then
|
|
||||||
ROOT_PART="/dev/mapper/$LUKS_NAME"
|
ROOT_PART="/dev/mapper/$LUKS_NAME"
|
||||||
decr_count "$LUKS_PART"
|
decr_count "$LUKS_PART"
|
||||||
elif (( LVM == 1 )); then
|
elif [[ $LVM ]]; then
|
||||||
(( LUKS == 1 )) && decr_count "$LUKS_PART"
|
[[ $LUKS ]] && decr_count "$LUKS_PART"
|
||||||
for part in $(echo "$GROUP_PARTS"); do decr_count "$part"; done
|
for part in $(echo "$GROUP_PARTS"); do decr_count "$part"; done
|
||||||
ROOT_PART=""
|
ROOT_PART=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $COUNT -eq 1 && $ROOT_PART == "" ]]; then
|
if [[ $COUNT -eq 1 && ! $ROOT_PART ]]; then
|
||||||
ROOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
ROOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
||||||
infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1
|
infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1
|
||||||
elif [[ $ROOT_PART == "" || $LVM -eq 1 ]]; then
|
elif [[ ! $ROOT_PART || $LVM ]]; then
|
||||||
tput civis
|
tput civis
|
||||||
ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_PrepMount " --menu "$_SelRootBody" 0 0 0 $PARTS)"
|
--title " $_PrepMount " --menu "$_SelRootBody" 0 0 0 $PARTS)"
|
||||||
[[ $? != 0 || $ROOT_PART == "" ]] && return 1
|
[[ $? != 0 || $ROOT_PART == "" ]] && return 1
|
||||||
else
|
else
|
||||||
local msg="\nUsing $([[ $LUKS -eq 1 ]] && printf "encrypted ")root partition:"
|
local msg="\nUsing${LUKS} root partition:" # $LUKS might just be an empty string
|
||||||
infobox "$_PrepMount" "$msg $ROOT_PART\n" 1
|
infobox "$_PrepMount" "$msg $ROOT_PART\n" 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -545,13 +542,12 @@ select_extra_partitions() {
|
|||||||
--title " $_PrepMount " --menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)"
|
--title " $_PrepMount " --menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)"
|
||||||
[[ $? != 0 || $part == "$_Done" || $part == "" ]] && break
|
[[ $? != 0 || $part == "$_Done" || $part == "" ]] && break
|
||||||
|
|
||||||
# choose what filesystem and get mountpoint
|
# choose what filesystem and get the mountpoint
|
||||||
select_filesystem "$part" || { break; return 1; }
|
select_filesystem "$part" || { break; return 1; }
|
||||||
select_mountpoint || { break; return 1; }
|
select_mountpoint || { break; return 1; }
|
||||||
|
|
||||||
# mount it
|
# mount it
|
||||||
mount_partition "$part" "$EXTRA_MNT" || { break; return 1; }
|
mount_partition "$part" "$EXTRA_MNT" || { break; return 1; }
|
||||||
|
|
||||||
EXTRA_MNTS="$EXTRA_MNTS $part: $EXTRA_MNT"
|
EXTRA_MNTS="$EXTRA_MNTS $part: $EXTRA_MNT"
|
||||||
|
|
||||||
# if the mountpoint was /usr add 'usr' to MKINIT_HOOKS
|
# if the mountpoint was /usr add 'usr' to MKINIT_HOOKS
|
||||||
|
@ -28,7 +28,7 @@ ssd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
tput cnorm && unmountp
|
tput cnorm; unmountp; sleep 1
|
||||||
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
||||||
[[ $1 =~ [0-9] ]] && exit $1 || $1
|
[[ $1 =~ [0-9] ]] && exit $1 || $1
|
||||||
}
|
}
|
||||||
@ -164,4 +164,5 @@ debug() {
|
|||||||
$TERM_CMD -e "tail -f /tmp/debug-log" &
|
$TERM_CMD -e "tail -f /tmp/debug-log" &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
DEBUG=true
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user