You've already forked al-installer
Move keyfile to before initial mkinit run to save time, remove several dialogs
This commit is contained in:
@ -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,70 +698,68 @@ 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 \
|
||||
"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 \
|
||||
"qutebrowser" "A keyboard-focused vim-like web browser based on Python and PyQt5" 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 \
|
||||
"emacs" "An extensible, customizable, self-documenting real-time display editor" off \
|
||||
"neovim" "A fork of Vim aiming to improve user experience, plugins, and GUIs." off \
|
||||
"mousepad" "A simple text editor" off \
|
||||
"urxvt" "A unicode enabled rxvt-clone terminal emulator" off \
|
||||
"tilix" "A tiling terminal emulator for Linux using GTK+ 3" off \
|
||||
"terminator" "Terminal emulator that supports tabs and grids" off \
|
||||
"tilda" "A Gtk based drop down terminal for Linux and Unix" off \
|
||||
"xfce4-terminal" "A terminal emulator primarily for the XFCE desktop" off \
|
||||
"termite" "A minimal VTE-based terminal emulator" off \
|
||||
"pcmanfm" "A fast and lightweight file manager" off \
|
||||
"gnome-disk-utility" "Disk Management Utility" off \
|
||||
"gnome-system-monitor" "View current processes and monitor system state" off \
|
||||
"steam steam-native-runtime" "A popular game distribution platform by Valve" off \
|
||||
"vlc qt4" "a free and open source cross-platform multimedia player" off \
|
||||
"audacious" "A free and advanced audio player based on GTK+" off \
|
||||
"nicotine+" "A graphical client for Soulseek" off \
|
||||
"lollypop" "A new music playing application" off \
|
||||
"rhythmbox" "Music playback and management application" off \
|
||||
"deadbeef" "A GTK+ audio player for GNU/Linux" off \
|
||||
"clementine" "A modern music player and library organizer" off \
|
||||
"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 \
|
||||
"mutt" "Small but very powerful text-based mail client" off \
|
||||
"deluge" "A BitTorrent client written in python" off \
|
||||
"transmission-gtk" "Free BitTorrent client GTK+ GUI" off \
|
||||
"qbittorrent" "An advanced BitTorrent client" off \
|
||||
"hexchat" "A popular and easy to use graphical IRC client" off \
|
||||
"pidgin" "Multi-protocol instant messaging client" off \
|
||||
"weechat" "Fast, light and extensible IRC client" off \
|
||||
"irssi" "Modular text mode IRC client" off \
|
||||
"libreoffice-fresh" "Full featured office suite" off \
|
||||
"abiword" "Fully-featured word processor" off \
|
||||
"calligra" "A set of applications for productivity" off \
|
||||
"evince" "Document viewer" off \
|
||||
"zathura" "Minimalistic document viewer" off \
|
||||
"qpdfview" "A tabbed PDF viewer" off \
|
||||
"mupdf" "Lightweight PDF and XPS viewer" off \
|
||||
"gimp" "GNU Image Manipulation Program" off \
|
||||
"inkscape" "Professional vector graphics editor" off \
|
||||
"krita" "Edit and paint images" off \
|
||||
"simplescreenrecorder" "A feature-rich screen recorder" off \
|
||||
"obs-studio" "Free opensource streaming/recording software" off \
|
||||
"guvcview" "Capture video from camera devices" off \
|
||||
"gpick" "Advanced color picker using GTK+ toolkit" off \
|
||||
"gcolor2" "A simple GTK+2 color selector" off \
|
||||
"plank" "Stupidly simple dock" off \
|
||||
"docky" "The finest dock no money can buy" off \
|
||||
"cairo-dock" "Light, eye-candy filled dock and desklets" off \
|
||||
"ttf-hack" "A hand groomed and optically balanced typeface based on Bitstream Vera Mono." off \
|
||||
"ttf-anonymous-pro" "A family of four fixed-width fonts designed especially with coding in mind" off \
|
||||
"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
|
||||
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 \
|
||||
"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 \
|
||||
"qutebrowser" "A keyboard-focused vim-like web browser based on Python and PyQt5" 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 \
|
||||
"emacs" "An extensible, customizable, self-documenting real-time display editor" off \
|
||||
"neovim" "A fork of Vim aiming to improve user experience, plugins, and GUIs." off \
|
||||
"mousepad" "A simple text editor" off \
|
||||
"urxvt" "A unicode enabled rxvt-clone terminal emulator" off \
|
||||
"tilix" "A tiling terminal emulator for Linux using GTK+ 3" off \
|
||||
"terminator" "Terminal emulator that supports tabs and grids" off \
|
||||
"tilda" "A Gtk based drop down terminal for Linux and Unix" off \
|
||||
"xfce4-terminal" "A terminal emulator primarily for the XFCE desktop" off \
|
||||
"termite" "A minimal VTE-based terminal emulator" off \
|
||||
"pcmanfm" "A fast and lightweight file manager" off \
|
||||
"gnome-disk-utility" "Disk Management Utility" off \
|
||||
"gnome-system-monitor" "View current processes and monitor system state" off \
|
||||
"steam steam-native-runtime" "A popular game distribution platform by Valve" off \
|
||||
"vlc qt4" "a free and open source cross-platform multimedia player" off \
|
||||
"audacious" "A free and advanced audio player based on GTK+" off \
|
||||
"nicotine+" "A graphical client for Soulseek" off \
|
||||
"lollypop" "A new music playing application" off \
|
||||
"rhythmbox" "Music playback and management application" off \
|
||||
"deadbeef" "A GTK+ audio player for GNU/Linux" off \
|
||||
"clementine" "A modern music player and library organizer" off \
|
||||
"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 \
|
||||
"mutt" "Small but very powerful text-based mail client" off \
|
||||
"deluge" "A BitTorrent client written in python" off \
|
||||
"transmission-gtk" "Free BitTorrent client GTK+ GUI" off \
|
||||
"qbittorrent" "An advanced BitTorrent client" off \
|
||||
"hexchat" "A popular and easy to use graphical IRC client" off \
|
||||
"pidgin" "Multi-protocol instant messaging client" off \
|
||||
"weechat" "Fast, light and extensible IRC client" off \
|
||||
"irssi" "Modular text mode IRC client" off \
|
||||
"libreoffice-fresh" "Full featured office suite" off \
|
||||
"abiword" "Fully-featured word processor" off \
|
||||
"calligra" "A set of applications for productivity" off \
|
||||
"evince" "Document viewer" off \
|
||||
"zathura" "Minimalistic document viewer" off \
|
||||
"qpdfview" "A tabbed PDF viewer" off \
|
||||
"mupdf" "Lightweight PDF and XPS viewer" off \
|
||||
"gimp" "GNU Image Manipulation Program" off \
|
||||
"inkscape" "Professional vector graphics editor" off \
|
||||
"krita" "Edit and paint images" off \
|
||||
"simplescreenrecorder" "A feature-rich screen recorder" off \
|
||||
"obs-studio" "Free opensource streaming/recording software" off \
|
||||
"guvcview" "Capture video from camera devices" off \
|
||||
"gpick" "Advanced color picker using GTK+ toolkit" off \
|
||||
"gcolor2" "A simple GTK+2 color selector" off \
|
||||
"plank" "Stupidly simple dock" off \
|
||||
"docky" "The finest dock no money can buy" off \
|
||||
"cairo-dock" "Light, eye-candy filled dock and desklets" off \
|
||||
"ttf-hack" "A hand groomed and optically balanced typeface based on Bitstream Vera Mono." off \
|
||||
"ttf-anonymous-pro" "A family of four fixed-width fonts designed especially with coding in mind" off \
|
||||
"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)"
|
||||
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,9 +2141,7 @@ 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
|
||||
find $MNT/boot/efi/EFI/ -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# grub is finicky and requires special treatment
|
||||
@ -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
|
||||
|
Reference in New Issue
Block a user