Move keyfile to before initial mkinit run to save time, remove several dialogs
This commit is contained in:
parent
a939d24ecd
commit
3b226f0ed7
@ -15,7 +15,7 @@
|
||||
# immutable variables {
|
||||
|
||||
readonly DIST="Archlabs" # Linux distributor
|
||||
readonly VER="1.6.38" # Installer version
|
||||
readonly VER="1.6.39" # Installer version
|
||||
readonly LIVE="liveuser" # Live session user
|
||||
readonly TRN="/usr/share/archlabs-installer" # Translation path
|
||||
readonly MNT="/mnt/install" # Install mountpoint
|
||||
@ -106,7 +106,7 @@ luks_variable_init() {
|
||||
initialize_variables() {
|
||||
# Modified during runtime and are all globally accessible
|
||||
# This is called once when the script is started, and again if/when an error occurs
|
||||
# Some of may never be used, depending on the system and choices made
|
||||
# Some may never be used, depending on the system and choices made
|
||||
|
||||
declare -g ROOT_PART=""
|
||||
declare -g BOOT_DEVICE=""
|
||||
@ -144,7 +144,6 @@ initialize_variables() {
|
||||
declare -g BOOT_DONE=false
|
||||
declare -g FULL_DONE=false
|
||||
declare -g CONFIRM_DONE=false
|
||||
declare -g GRUB_UEFI_FALLBACK=false
|
||||
|
||||
# Commands used to install each bootloader.
|
||||
# NOTE: syslinux and grub in particular can/will change during runtime
|
||||
@ -699,7 +698,6 @@ window_manager() {
|
||||
}
|
||||
|
||||
extra_packages() {
|
||||
if yesno "$_ExtraPackages" "$_ChooseExtraPackages"; then
|
||||
EXTRA_PACKAGES="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 20 \
|
||||
"firefox" "A popular open-source graphical web browser from Mozilla" off \
|
||||
@ -762,7 +760,6 @@ extra_packages() {
|
||||
"ttf-font-awesome" "Iconic font designed for Bootstrap" off \
|
||||
"ttf-fira-code" "Monospaced font with programming ligatures" off \
|
||||
"noto-fonts-cjk" "Google Noto CJK fonts (Chinese, Japanese, Korean)" off)"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -1114,9 +1111,6 @@ select_boot_setup() {
|
||||
EDIT_FILES[9]="/boot/loader/entries/archlabs.conf"
|
||||
else
|
||||
EDIT_FILES[9]="/etc/default/grub"
|
||||
if yesno "$_PrepMount" "$_SetBootDefault"; then
|
||||
GRUB_UEFI_FALLBACK=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1170,7 +1164,7 @@ select_bios_boot_partition() {
|
||||
BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title "$_PrepMount" \
|
||||
--menu "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)"
|
||||
|
||||
if [[ $? != 0 || $BOOT_PART == "$_Skip" || $BOOT_PART == "" ]]; then
|
||||
if [[ $BOOT_PART == "$_Skip" || $BOOT_PART == "" ]]; then
|
||||
BOOT_PART=""
|
||||
else
|
||||
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
|
||||
@ -1490,28 +1484,26 @@ luks_menu() {
|
||||
}
|
||||
|
||||
luks_keyfile() {
|
||||
# Only used when choosing grub as bootloader. Without a keyfile, during boot
|
||||
# the user will be asked to enter password for decryption twice, this is annoying
|
||||
if [[ ! -e $MNT/crypto_keyfile.bin ]] && yesno "$_LuksKeyFileTitle" "$_LuksKeyFile"; then
|
||||
# Only used when choosing grub as bootloader.
|
||||
|
||||
# Without a keyfile, during boot the user will be asked
|
||||
# to enter password for decryption twice, this is annoying
|
||||
|
||||
if [[ ! -e $MNT/crypto_keyfile.bin ]]; then
|
||||
infobox "$_LuksKeyFileTitle" "$_LuksKeyFileCreate"
|
||||
|
||||
local dev
|
||||
dev="$(lsblk -lno NAME,UUID,TYPE | awk "/$LUKS_UUID/"' && /part|crypt|lvm/ {print $1}')"
|
||||
|
||||
dev="/dev/$dev"
|
||||
dev="/dev/$(lsblk -lno NAME,UUID,TYPE | awk "/$LUKS_UUID/"' && /part|crypt|lvm/ {print $1}')"
|
||||
|
||||
local keycmd
|
||||
keycmd="dd bs=512 count=8 if=/dev/urandom of=/crypto_keyfile.bin && chmod 000 /crypto_keyfile.bin &&
|
||||
echo '$LUKS_PASS' | cryptsetup luksAddKey $dev /crypto_keyfile.bin"
|
||||
keycmd="dd bs=512 count=8 if=/dev/urandom of=/crypto_keyfile.bin && chmod 000 /crypto_keyfile.bin"
|
||||
keycmd="$keycmd && echo '$LUKS_PASS' | cryptsetup luksAddKey $dev /crypto_keyfile.bin"
|
||||
|
||||
chroot_cmd "$keycmd" 2>$ERR
|
||||
check_for_errors "$keycmd" || return 1
|
||||
|
||||
sed -i 's/FILES=()/FILES=(\/crypto_keyfile.bin)/g' $MNT/etc/mkinitcpio.conf 2>$ERR
|
||||
check_for_errors 'sed -i "s/FILES=()/FILES=(/crypto_keyfile.bin)/g"' || return 1
|
||||
|
||||
chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR >/dev/null 2>&1
|
||||
check_for_errors "mkinitcpio -p $KERNEL" || return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -1923,28 +1915,36 @@ update_system() {
|
||||
find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
tput civis
|
||||
chroot_cmd "pacman -Syyu --noconfirm ; $pkgcmd" 2>/dev/null | dialog --cr-wrap \
|
||||
--backtitle "$BT" --title " $_UpdSysTitle " --progressbox "$_UpdSysBody\n" 30 90
|
||||
tput cnorm
|
||||
chroot_cmd "pacman -Syyu --noconfirm ; $pkgcmd" 2>/dev/null
|
||||
|
||||
install_packages
|
||||
return 0
|
||||
}
|
||||
|
||||
install_packages() {
|
||||
tput civis
|
||||
|
||||
# packages needed for the selected window manager
|
||||
local pkgs="$WM_PACKAGES"
|
||||
|
||||
# add lightdm packages if chosen
|
||||
[[ $LOGIN_TYPE == 'lightdm' ]] && pkgs="$pkgs lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||
|
||||
# add extra packages
|
||||
[[ $EXTRA_PACKAGES != "" ]] && pkgs="$pkgs $EXTRA_PACKAGES"
|
||||
|
||||
# for gnome and cinnamon we dont need the xfce provided stuff
|
||||
if [[ $INSTALL_WMS == 'gnome' || $INSTALL_WMS == 'cinnamon' ]]; then
|
||||
REMOVE_PKGS="$(pacman -Qssq 'xfce4*' 2>/dev/null)"
|
||||
fi
|
||||
|
||||
local pkgcmd="pacman -S $pkgs --needed --noconfirm"
|
||||
[[ $REMOVE_PKGS != "" ]] && pkgcmd="pacman -Rns $REMOVE_PKGS --noconfirm ; $pkgcmd"
|
||||
|
||||
chroot_cmd "$pkgcmd" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" --title " Install Packages " \
|
||||
--progressbox "\nInstalling packages chosen during install setup.\n\n$pkgs" 30 90
|
||||
# are we removing some packages
|
||||
[[ $REMOVE_PKGS != "" ]] && pkgcmd="pacman -Rs $REMOVE_PKGS --noconfirm ; $pkgcmd"
|
||||
|
||||
chroot_cmd "$pkgcmd" 2>/dev/null
|
||||
|
||||
[[ $LOGIN_TYPE == 'lightdm' ]] && setup_lightdm
|
||||
return 0
|
||||
@ -2141,10 +2141,8 @@ setup_bootloader() {
|
||||
$eficmd >/dev/null 2>&1
|
||||
BOOT_CMDS[$BOOTLOADER]="$eficmd ; ${BOOT_CMDS[$BOOTLOADER]}"
|
||||
find $MNT/boot/efi/EFI/ -maxdepth 1 -mindepth 1 -name '[aA][rR][cC][hH][lL]abs*' -type d -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||
if [[ $GRUB_UEFI_FALLBACK == true ]]; then
|
||||
find $MNT/boot/efi/EFI/ -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# grub is finicky and requires special treatment
|
||||
if [[ $BOOTLOADER == "grub" ]]; then
|
||||
@ -2162,19 +2160,20 @@ setup_bootloader() {
|
||||
check_for_errors "${BOOT_CMDS[$BOOTLOADER]}" || return 1
|
||||
|
||||
# copy grub efi stub to generic catch all
|
||||
[[ $GRUB_UEFI_FALLBACK == true ]] && grub_uefi_fallback
|
||||
grub_uefi_fallback
|
||||
BOOT_DONE=true
|
||||
|
||||
# offer to setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
|
||||
if [[ $LUKS -eq 1 && $SYS == 'UEFI' && $BOOTLOADER == 'grub' && $LUKS_PASS && $LUKS_UUID ]]; then
|
||||
luks_keyfile || return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
run_mkinitcpio() {
|
||||
local conf="$MNT/etc/mkinitcpio.conf"
|
||||
|
||||
# setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
|
||||
if [[ $LUKS -eq 1 && $SYS == 'UEFI' && $BOOTLOADER == 'grub' && $LUKS_PASS && $LUKS_UUID ]]; then
|
||||
luks_keyfile || return 1
|
||||
fi
|
||||
|
||||
# new HOOKS needed in /etc/mkinitcpio.conf if we used LUKS and/or LVM
|
||||
local add
|
||||
(( LVM == 1 )) && add="lvm2"
|
||||
@ -2188,8 +2187,7 @@ run_mkinitcpio() {
|
||||
check_for_errors "sed -i 's/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g' $conf" || return 1
|
||||
|
||||
tput civis
|
||||
chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR | dialog --cr-wrap --backtitle "$BT" \
|
||||
--title " $_RunMkinit " --progressbox "$_RunMkinitBody\nHOOKS: $MKINIT_HOOKS $add\n" 30 90
|
||||
chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR
|
||||
check_for_errors "mkinitcpio -p $KERNEL" || return 1
|
||||
|
||||
return 0
|
||||
|
@ -17,7 +17,6 @@ _Final="\nA telepítés szinte befejeződött.\n"
|
||||
_WelTitle="Welkom bij"
|
||||
_WelBody="\nDit installatieprogramma zal de nieuwste pakketten downloaden van de $DIST repositories. Enkel de hoogstnodige configuratie wordt uitgevoerd\n\nMENU OPTIES: Selecteer de gewenste optie door haar nummer in te tikken of door de pijljestoetsen [op]/[neer] te gebruiken. Bevestig door op [enter] te drukken. Schakel tussen de knoppen door de [Tab] toets of de pijltjestoets [links]/[rechts] te gebruiken. Bevestig door op [enter] te drukken. U kunt navigeren in de lange lijsten door de [pg up] en [pg down] toetsen te gebruiken, en/of door op de eerste letter van de gewenste optie te drukken.\n\nCONFIGURATIE & PAKKET OPTIES: Standaard pakketten in checklists worden vooraf geselecteerd. Gebruik de [Spatiebar] om te (de)selecteren"
|
||||
|
||||
_SetBootDefault="\nSommige UEFI firmware kan geen bootloader vinden tenzij het is ingesteld als standaard. Dit doe je door het kopiëeren van haar efi stub grub en het te hernoemen naar bootx64.efi.\n\nHet is aanbevolen dit te doen tenzij je reeds een standaard bootloader hebt, of wanneer je van plan bent meerdere bootloaders te gebruiken.\n\nStel de grub bootloader in als standaard?\n"
|
||||
|
||||
# Requirements Voorwaarden
|
||||
_NotRoot="\nHet installatieprogramma moet worden uitgevoerd als root.\n"
|
||||
|
@ -76,8 +76,7 @@ _ErrChoice="\nDo you want to keep the current install and fix manually, or wipe
|
||||
|
||||
# keyfile creation
|
||||
_LuksKeyFileTitle="Create Encryption Keyfile"
|
||||
_LuksKeyFile="\nCreate encryption keyfile: /crypto_keyfile.bin\n\nSaves from having to enter password twice during boot to unlock encrypted drive.\n"
|
||||
_LuksKeyFileCreate="\nCreating: /crypto_keyfile.bin\n\nThis will take a minute due to the initramfs being updated after.\n"
|
||||
_LuksKeyFileCreate="\nCreating: /crypto_keyfile.bin\n"
|
||||
|
||||
# timezone
|
||||
_TimeZTitle="Set Timezone"
|
||||
@ -121,8 +120,6 @@ _ChooseExtraPackages="\nChoose additional packages to install?\n"
|
||||
_ExtraPackages="Extra Packages"
|
||||
_ExtraPackagesBody="\nUse [Space] to select/deselect packages(s) to install from the list below."
|
||||
|
||||
_SetBootDefault="\nSome UEFI firmware may not detect the bootloader unless it is set as the default by copying its efi stub to a directory /boot/efi/EFI/boot and renaming it to bootx64.efi.\n\nIt is recommended to do so unless already using a default bootloader, or where intending to use multiple bootloaders.\n\nSet grub bootloader as the default?\n"
|
||||
|
||||
## END NEW
|
||||
|
||||
|
||||
|
@ -156,7 +156,6 @@ _FormBiosBody="[IMPORTANT]\nLa partition boot"
|
||||
_FormUefiBody2="est déjà correctement formaté.\n\nVoulez-vous passer la mise en forme? Choisir 'Non' effacera TOUTES les données (bootloaders) sur la partition.\n\nEn cas de doute, choisissez 'Oui'\n"
|
||||
_SelUefiBody="\nSélectionner une partition UEFI. C'est une partition spéciale permettant le démarrage sur des systèmes UEFI."
|
||||
|
||||
_SetBootDefault="\nCertains microcodes UEFI peuvent ne pas détecter le chargeur d'amorçage, à moins de le définir par défaut en copiant son module efi dans grub et le renommer bootx64.efi.\n\nIl est recommandé de le faire à moins que vous utilisiez déjà un chargeur d'amorçage par défaut, ou si vous avez l'intention d'utiliser plusieurs chargeurs d'amorçage.\n\nDéfinir le chargeur d'amorçage par défaut?\n"
|
||||
|
||||
# Partitions supplémentaires
|
||||
_ExtPartBody="\nSélectionner des partitions additionnelles dans n'importe quel ordre, ou cliquer sur « Terminé » afin de poursuivre."
|
||||
|
@ -13,7 +13,6 @@ _Back="Vissza"
|
||||
_Name="Név:"
|
||||
_Final="\nA telepítés szinte befejeződött.\n"
|
||||
|
||||
_SetBootDefault="\nNéhány UEFI firmwarét nem érzékel a bootloader, kivéve, ha az az alapbeállítás másolja az 'efi stub'-ot grub és átnevezi ezt a 'bootx64.ef'-neki.\n\nEzt ajánlatos megtenni, kivéve, ha ezt már használja a rendszertöltő, vagy ha több rendszertöltőt használsz.\n\nBeállítod a rendszertöltőt alapértelmezettként?\n"
|
||||
|
||||
_MntBody="Használd a [Szóköz] billentyűt a csatolni kívánt meghajtó kijelöléséhez, illetve a kijelölés törléséhez és nézd át újra gondosan. Kérjük ne válassz több változatot ugyanahhoz a lehetőséghez."
|
||||
_MntConfBody="\nErősítsd meg a következő csatolási lehetőségeket:"
|
||||
|
@ -156,7 +156,6 @@ _FormUefiBody="[IMPORTANTE]\nLa partizione EFI"
|
||||
_FormBiosBody="[IMPORTANTE]\nLa partizione boot"
|
||||
_FormUefiBody2="è già formattato correttamente.\n\nVuoi saltare la formattazione? Scegliendo 'No' verranno cancellati TUTTI i dati (bootloader) sulla partizione.\n\nScegli incerto 'Sì'\n"
|
||||
|
||||
_SetBootDefault="\nAlcuni firmware UEFI potrebbero non identificare il bootloader a meno di impostarlo come default copiando il suo stub efi in grub e rinominandolo bootx64.efi.\n\nSi riccomanda di procedere come indicato a meno di non stare già usando un botoader di default, o qualora si vogliano usare bootloader multipli.\n\nImpostare il grub bootloader come default?\n"
|
||||
|
||||
# Extra Partitions
|
||||
_ExtPartBody="\nSeleziona le partizioni addizionali in qualsiasi ordine, altrimenti scegli 'Fatto' per concludere."
|
||||
|
@ -156,7 +156,6 @@ _FormUefiBody="[IMPORTANTE]\nA partição EFI"
|
||||
_FormBiosBody="[IMPORTANTE]\nA partição boot"
|
||||
_FormUefiBody2="já está formatado corretamente.\n\nVocê quer pular a formatação? Escolher 'Não' irá apagar TODOS os dados (bootloaders) na partição.\n\nSe não tiver certeza, escolha 'Sim'.\n"
|
||||
|
||||
_SetBootDefault="\nAlguns firmware UEFI pode não detectar o carregador de boot a menos que seja definido como padrão, copiando o seu stub efi para grub e renomeá-lo para bootx64.efi.\n\nRecomenda-se fazer isto, a menos que já está usando um carregador de boot padrão, ou se quiser usar vários carregadores de boot.\n\nDefinir o carregador de boot como padrão?\n"
|
||||
|
||||
# Partições Extras
|
||||
_ExtPartBody="\nSelecionar partições adicionais em qualquer ordem, ou 'Feito' para finalizar."
|
||||
|
@ -158,7 +158,6 @@ _FormUefiBody="[IMPORTANTE]\nA partição EFI"
|
||||
_FormBiosBody="[IMPORTANTE]\nA partição boot"
|
||||
_FormUefiBody2="já está formatado corretamente.\n\nVocê quer pular a formatação? Escolher 'Não' irá apagar TODOS os dados (bootloaders) na partição.\n\nSe não tiver certeza, escolha 'Sim'.\n"
|
||||
|
||||
_SetBootDefault="\nAlguns firmware UEFI pode não detectar o carregador de boot a menos que seja definido como padrão, copiando o seu stub efi para grub e renomeá-lo para bootx64.efi.\n\nRecomenda-se fazer isto, a menos que já está usando um carregador de boot padrão, ou se quiser usar vários carregadores de boot.\n\nDefinir o carregador de boot como padrão?\n"
|
||||
|
||||
# Partições Extras
|
||||
_ExtPartBody="\nSeleccionar partições adicionais em qualquer ordem, ou 'Pronto' para finalizar."
|
||||
|
@ -156,7 +156,6 @@ _FormUefiBody="[ВАЖНО]\nРаздел EFI"
|
||||
_FormBiosBody="[ВАЖНО]\nРаздел boot"
|
||||
_FormUefiBody2="уже правильно отформатирован.\n\nВы хотите пропустить его форматирование? Выбор 'Нет' удалит ВСЕ данные (загрузчики) в разделе.\n\nЕсли неуверенный выбор 'Да'.\n"
|
||||
|
||||
_SetBootDefault="\nНекоторые прошивки UEFI могут не определять загрузчик до тех пор, пока не скопировать их efi stub в grub и переименовать его в bootx64.efi.\n\nЭто рекомендуется сделать если у вас еще нету загрузчика по умолчанию или вы собираетесь использовать несколько загрузчиков.\n\nСделать загрузчиком по умолчанию?\n"
|
||||
|
||||
# Extra Partitions
|
||||
_ExtPartBody="\nВыберите дополнительные разделы в любом порядке или 'Готово' для завершения."
|
||||
|
@ -156,7 +156,6 @@ _FormUefiBody="[IMPORTANTE]\nLa partición EFI"
|
||||
_FormBiosBody="[IMPORTANTE]\nLa partición boot"
|
||||
_FormUefiBody2="ya está formateado correctamente.\n\n¿Quieres omitir el formateo? Elegir 'No' borrará TODOS los datos (cargadores de arranque) en la partición.\n\nSi no está seguro, elija 'Sí'.\n"
|
||||
|
||||
_SetBootDefault="\nAlgunos firmwares UEFI podrían no detectar el gestor de arranque a menos que sea establecido como predeterminado, copiando su EFISTUB (archivo de arranque) a grub y renombrándolo a bootx64.efi.\n\nSe recomienda hacer esto a menos que ya se esté usando un gestor de arranque predeterminado, o si se quieren usar varios gestores de arranque.\n\n¿Establecer gestor de arranque como el predeterminado?\n"
|
||||
|
||||
# Particiones extra
|
||||
_ExtPartBody="\nSeleccione particiones adicionales en cualquier orden, o 'Finalizar' para terminar el proceso."
|
||||
|
Reference in New Issue
Block a user