Add cinnamon, add option for LTS kernel, minor fixes and touch-ups

This commit is contained in:
natemaia 2018-08-20 02:26:13 -07:00
parent 24577414f1
commit 63fac78577

View File

@ -15,7 +15,7 @@
# immutable variables {
readonly DIST="Archlabs" # Linux distributor
readonly VER="1.6.35" # Installer version
readonly VER="1.6.36" # Installer version
readonly LIVE="liveuser" # Live session user
readonly TRN="/usr/share/archlabs-installer" # Translation path
readonly MNT="/mnt/install" # Install mountpoint
@ -115,6 +115,7 @@ initialize_variables() {
declare -g EXTRA_MNT=""
declare -g SWAP_FILE="none"
declare -g SWAP_SIZE="${SYS_MEM}M"
declare -g KERNEL="linux"
declare -g NEWUSER=""
declare -g USER_PASS=""
@ -480,75 +481,6 @@ ff02::2 ip6-allrouters
EOF
}
user_input_values() {
local user="$1"
tput cnorm
local values
if [[ $SET_ROOT_PASSWD != true ]]; then
values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
--title " $_UserTitle " --insecure --mixedform "$_UserBody" 27 75 10 \
"$_Username" 1 1 "$user" 1 $((${#_Username} + 2)) 71 0 0 \
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1 \
"$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) 71 0 2 \
"$_Password" 8 1 "" 8 $((${#_Password} + 2)) 71 0 1 \
"$_Password2" 9 1 "" 9 $((${#_Password2} + 2)) 71 0 1)"
else
values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
--title " $_UserTitle " --insecure --mixedform "$_UserBody" 20 75 4 \
"$_Username" 1 1 "$user" 1 $((${#_Username} + 2)) 71 0 0 \
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1)"
fi
[[ $? != 0 || $values == "" ]] && return 1
user="$(awk -F'~' '{print $1}' <<< "$values")"
local pass pass2
pass="$(awk -F'~' '{print $2}' <<< "$values")"
pass2="$(awk -F'~' '{print $3}' <<< "$values")"
# if the root password has not yet been set
local rpass rpass2
if [[ $SET_ROOT_PASSWD != true ]]; then
rpass="$(awk -F'~' '{print $5}' <<< "$values")"
rpass2="$(awk -F'~' '{print $6}' <<< "$values")"
# when both passwords match but are empty
# resort to using the user passwords instead
if [[ $rpass == "" && $rpass2 == "" ]]; then
rpass="$pass"
rpass2="$pass2"
fi
fi
# make sure we dont have anything wrong and that the passwords match
if [[ ${#user} -eq 0 || $user =~ \ |\' || $user =~ [^a-z0-9\ ] || $pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
tput civis
# passwords don't match
if [[ $pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
if [[ "$rpass" != "$rpass2" ]]; then
msgbox "$_ErrTitle" "$_RootPassErr\n$_TryAgain"
else
msgbox "$_ErrTitle" "$_UserPassErr\n$_TryAgain"
fi
else
# bad username
msgbox "$_UserErrTitle" "$_UserErrBody"
user=""
fi
# recursively loop back unless the user chooses cancel, then bail
user_input_values "$user" || return 1
else
NEWUSER="$user"
USER_PASS="$pass"
[[ $SET_ROOT_PASSWD != true ]] && ROOT_PASS="$rpass"
fi
return 0
}
create_user() {
if [[ $AUTOLOGIN == true && $LOGIN_TYPE == 'lightdm' ]]; then
local groups="rfkill,wheel,autologin,nopasswdlogin,network,lp,storage,power,video,audio,lp"
@ -607,7 +539,7 @@ swap_livuser() {
if [[ $AUTOLOGIN != true || $LOGIN_TYPE == 'lightdm' ]]; then
rm -rf $MNT/etc/systemd/system/getty@tty1.service.d >/dev/null 2>&1
elif [[ $AUTOLOGIN == true && $LOGIN_TYPE != 'lightdm' ]]; then
elif [[ $LOGIN_TYPE != 'lightdm' ]]; then
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/systemd/system/getty@tty1.service.d/autologin.conf
fi
@ -623,20 +555,90 @@ fix_home_files() {
if [[ $AUTOLOGIN == true ]]; then
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
rm -rf $user_home/.{zprofile,xinitrc}
sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
else
sed -i "s/:-openbox/:-${LOGIN_WM}/g" $user_home/.xinitrc
sed -i '/archlabs-installer/d' $user_home/.zprofile
echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx -- vt1 &>/dev/null' >> $user_home/.zprofile
fi
else
rm -rf $user_home/.zprofile
sed -i '/archlabs-installer/d' $user_home/.zprofile
echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx -- vt1 &>/dev/null' >> $user_home/.zprofile
sed -i "s/:-openbox/:-${LOGIN_WM}/g" $user_home/.xinitrc
fi
return 0
}
choose_window_manager() {
user_input_values() {
local user="$1"
local pass pass2
tput cnorm
local values
if [[ $SET_ROOT_PASSWD != true ]]; then
values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
--title " $_UserTitle " --insecure --mixedform "$_UserBody" 27 75 10 \
"$_Username" 1 1 "$user" 1 $((${#_Username} + 2)) 71 0 0 \
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1 \
"$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) 71 0 2 \
"$_Password" 8 1 "" 8 $((${#_Password} + 2)) 71 0 1 \
"$_Password2" 9 1 "" 9 $((${#_Password2} + 2)) 71 0 1)"
else
values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
--title " $_UserTitle " --insecure --mixedform "$_UserBody" 20 75 4 \
"$_Username" 1 1 "$user" 1 $((${#_Username} + 2)) 71 0 0 \
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1)"
fi
[[ $? != 0 || $values == "" ]] && return 1
user="$(awk -F'~' '{print $1}' <<< "$values")"
pass="$(awk -F'~' '{print $2}' <<< "$values")"
pass2="$(awk -F'~' '{print $3}' <<< "$values")"
# if the root password has not yet been set
local rpass rpass2
if [[ $SET_ROOT_PASSWD != true ]]; then
rpass="$(awk -F'~' '{print $5}' <<< "$values")"
rpass2="$(awk -F'~' '{print $6}' <<< "$values")"
# when both passwords match but are empty
# resort to using the user passwords instead
if [[ $rpass == "" && $rpass2 == "" ]]; then
rpass="$pass"
rpass2="$pass2"
fi
fi
# make sure we dont have anything wrong and that the passwords match
if [[ ${#user} -eq 0 || $user =~ \ |\' || $user =~ [^a-z0-9\ ] || $pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
tput civis
# passwords don't match
if [[ $pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
if [[ "$rpass" != "$rpass2" ]]; then
msgbox "$_ErrTitle" "$_RootPassErr\n$_TryAgain"
else
msgbox "$_ErrTitle" "$_UserPassErr\n$_TryAgain"
fi
else
# bad username
msgbox "$_UserErrTitle" "$_UserErrBody"
user=""
fi
# recursively loop back unless the user chooses cancel, then bail
user_input_values "$user" || return 1
else
NEWUSER="$user"
USER_PASS="$pass"
[[ $SET_ROOT_PASSWD != true ]] && ROOT_PASS="$rpass"
fi
return 0
}
window_manager() {
LOGIN_WM=""
LOGIN_TYPE=""
WM_PACKAGES=""
@ -647,6 +649,7 @@ choose_window_manager() {
"bspwm" "A tiling window manager that represents windows as the leaves of a binary tree" off \
"i3-gaps" "A fork of i3 window manager with more features including gaps" off \
"gnome" "A desktop environment that aims to be simple and easy to use" off \
"cinnamon" "A desktop environment combining a traditional desktop layout with modern graphical effects" off \
"xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"
INSTALL_WMS="${INSTALL_WMS:-openbox}"
@ -659,6 +662,7 @@ choose_window_manager() {
bspwm) WM_PACKAGES="$WM_PACKAGES $wm sxhkd lxappearance" ;;
i3-gaps) WM_PACKAGES="$WM_PACKAGES $wm i3status perl-anyevent-i3 lxappearance" ;;
gnome) WM_PACKAGES="$WM_PACKAGES $wm gnome-extra" ;;
cinnamon) WM_PACKAGES="$WM_PACKAGES $wm" ;;
xfce4) WM_PACKAGES="$WM_PACKAGES $wm xfce4-goodies xfce4-pulseaudio-plugin" ;;
esac
done
@ -686,6 +690,7 @@ choose_window_manager() {
case $LOGIN_WM in
i3-gaps) LOGIN_WM='i3' ;;
gnome) LOGIN_WM='gnome-session' ;;
cinnamon) LOGIN_WM='cinnamon-session' ;;
openbox) LOGIN_WM='openbox-session' ;;
xfce4) LOGIN_WM='startxfce4' ;;
esac
@ -693,6 +698,74 @@ choose_window_manager() {
return 0
}
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
return 0
}
######################################################################
## System Partitioning Functions ##
######################################################################
@ -1436,8 +1509,8 @@ luks_keyfile() {
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 linux" 2>$ERR >/dev/null 2>&1
check_for_errors "mkinitcpio -p linux" || return 1
chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR >/dev/null 2>&1
check_for_errors "mkinitcpio -p $KERNEL" || return 1
fi
return 0
@ -1723,9 +1796,15 @@ lvm_menu() {
install_main() {
if [[ $UNPACKED_BASE != true ]]; then
# whether to use a custom mirror sorting command later
update_mirrorlist_cmd || MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate"
choose_window_manager || return 1
select_extra_packages
mirrorlist_cmd || MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate"
window_manager || return 1
extra_packages
if yesno "Choose Kernel" "\nWant to use the standard linux or linux LTS kernel" "Linux" "Linux LTS"; then
KERNEL="linux-lts"
else
KERNEL="linux"
fi
# user can choose to bail at this point
unpack_base_system || { initialize_variables; return 1; }
@ -1747,10 +1826,11 @@ install_main() {
update_system
DONE_UPDATE=true
else
chroot_cmd "pacman -Rs archlabs-installer --noconfirm" >/dev/null 2>&1
if ! grep -qi "hypervisor" <<< "$(dmesg)" && pacman -Qsq virtualbox-guest &>/dev/null; then
chroot_cmd "pacman -Rns $(pacman -Qsq virtualbox-guest) --noconfirm" >/dev/null 2>&1
if ! grep -qi "hypervisor" <<< "$(dmesg)"; then
chroot_cmd "pacman -Rns archlabs-installer virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm" 2>/dev/null
[[ -e $MNT/etc/xdg/autostart/vboxclient.desktop ]] && rm -f $MNT/etc/xdg/autostart/vboxclient.desktop
else
chroot_cmd "pacman -Rs archlabs-installer --noconfirm" 2>/dev/null
fi
fi
@ -1761,6 +1841,8 @@ install_main() {
[[ $FULL_DONE == true ]] && return 0
fi
fi
return 0
}
unpack_base_system() {
@ -1805,7 +1887,6 @@ EOF
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -exec rm '{}' \;
rm -rf $MNT/etc/{mkinitcpio-archiso.conf,sudoers.d/g_wheel,polkit-1/rules.d/49-nopasswd_global.rules}
# rm -rf $MNT/usr/bin/{install-al,al-installer}
sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers
cp -rf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
@ -1814,20 +1895,47 @@ EOF
cp -f /tmp/keyboard $MNT/etc/default/
cp -f /tmp/vconsole.conf $MNT/etc/
cp -f /etc/resolv.conf $MNT/etc/
grep -qi "hypervisor" <<< "$(dmesg)" && rm -rf $MNT/etc/X11/xorg.conf.d
UNPACKED_BASE=true
return 0
}
update_system() {
local pkgcmd
if [[ $KERNEL == 'linux-lts' ]]; then
pkgcmd="pacman -Rs linux --noconfirm ; pacman -S iputils --noconfirm ; pacman -S base-devel git linux-lts linux-lts-headers --needed --noconfirm"
else
pkgcmd="pacman -S iputils --noconfirm ; pacman -S base-devel git --needed --noconfirm"
fi
if ! grep -qi "hypervisor" <<< "$(dmesg)"; then
pkgcmd="pacman -Rs archlabs-installer virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm ; $pkgcmd"
else
pkgcmd="pacman -Rs archlabs-installer --noconfirm ; $pkgcmd"
fi
if [[ $BOOTLOADER == 'grub' && $KERNEL == 'linux-lts' ]]; then
pkgcmd="$pkgcmd; grub-mkconfig -o /boot/grub/grub.cfg"
elif [[ $BOOTLOADER != 'grub' ]]; then
pkgcmd="$pkgcmd; pacman -Rs grub --noconfirm"
rm -rf $MNT/etc/default/grub
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
install_packages
return 0
}
install_packages() {
tput civis
local pkgs="$WM_PACKAGES"
[[ $LOGIN_TYPE == 'lightdm' ]] && pkgs="$pkgs lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
[[ $EXTRA_PACKAGES != "" ]] && pkgs="$pkgs $EXTRA_PACKAGES"
if [[ $INSTALL_WMS == 'gnome' ]]; then
if [[ $INSTALL_WMS == 'gnome' || $INSTALL_WMS == 'cinnamon' ]]; then
REMOVE_PKGS="$(pacman -Qssq 'xfce4*' 2>/dev/null)"
fi
@ -1841,74 +1949,6 @@ install_packages() {
return 0
}
select_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
return 0
}
setup_lightdm() {
chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target' >/dev/null 2>&1
@ -1928,24 +1968,7 @@ setup_lightdm() {
fi
}
update_system() {
local pkgcmd
pkgcmd="pacman -Syyu --noconfirm; pacman -S iputils --noconfirm; pacman -S base-devel git --needed --noconfirm"
if ! grep -qi "hypervisor" <<< "$(dmesg)" && pacman -Qsq virtualbox-guest &>/dev/null; then
pkgcmd="pacman -Rs archlabs-installer $(pacman -Qsq virtualbox-guest) --noconfirm; $pkgcmd"
else
pkgcmd="pacman -Rs archlabs-installer --noconfirm; $pkgcmd"
fi
tput civis
chroot_cmd "$pkgcmd" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" \
--title " $_UpdSysTitle " --progressbox "$_UpdSysBody\n" 30 90
install_packages
return 0
}
update_mirrorlist_cmd() {
mirrorlist_cmd() {
if ! yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic Sort" "Customize Sort"; then
infobox "$_MirrorTitle" "\nGathering mirror countries..\n"
local countries
@ -1996,11 +2019,9 @@ bootloader_config() {
if [[ $BOOTLOADER == "grub" ]]; then
local cfg="$MNT/etc/default/grub"
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g; s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg
if (( LUKS == 1 )); then
sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $cfg
fi
if [[ $SYS != "UEFI" ]]; then
if (( LVM == 1 && SEPERATE_BOOT == 0 )) || (( SEPERATE_BOOT == 2 )); then
sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" $cfg
@ -2044,15 +2065,15 @@ MENU COLOR tabmsg 31;40 #30ffffff #00000000 std
LABEL archlabs
MENU LABEL $DIST Linux
LINUX ../vmlinuz-linux
LINUX ../vmlinuz-$KERNEL
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && echo -n "$LUKS_DEV ")rw
INITRD ../initramfs-linux.img
INITRD ../initramfs-$KERNEL.img
LABEL archlabsfallback
MENU LABEL $DIST Linux Fallback
LINUX ../vmlinuz-linux
LINUX ../vmlinuz-$KERNEL
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && echo -n "$LUKS_DEV ")rw
INITRD ../initramfs-linux-fallback.img
INITRD ../initramfs-$KERNEL-fallback.img
LABEL hdt
MENU LABEL HDT (Hardware Detection Tool)
@ -2077,8 +2098,8 @@ editor no
EOF
cat > $MNT/boot/loader/entries/${DIST,,}.conf << EOF
title $DIST Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
linux /vmlinuz-$KERNEL
initrd /initramfs-$KERNEL.img
options root=$ROOT_PART_ID rw
EOF
for file in $MNT/boot/loader/entries/arch*?.conf; do
@ -2115,18 +2136,12 @@ setup_bootloader() {
infobox "$_InstBootTitle" "$msg\nMountpoint: ${BOOT_MNTS[$SYS-$BOOTLOADER]}\n"
if [[ $SYS == "UEFI" ]]; then
# ensure efivarfs is mounted in host and in chroot
local eficmd="mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars"
$eficmd >/dev/null 2>&1
BOOT_CMDS[$BOOTLOADER]="$eficmd ; ${BOOT_CMDS[$BOOTLOADER]}"
# remove old EFI boot entries from previous installs
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
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
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
@ -2136,17 +2151,8 @@ setup_bootloader() {
local udevcmd="mkdir -p /run/udev && mount --rbind /run/udev /run/udev"
$udevcmd >/dev/null 2>&1
BOOT_CMDS[grub]="$udevcmd ; ${BOOT_CMDS[grub]}"
# BIOS uses the base device name, eg. /dev/sda.. so add it to the end of BOOT_CMDS[grub]
[[ $SYS == "BIOS" ]] && BOOT_CMDS[grub]="${BOOT_CMDS[grub]} $BOOT_DEVICE"
# add grub-mkconfig last
BOOT_CMDS[grub]="${BOOT_CMDS[grub]} && grub-mkconfig -o /boot/grub/grub.cfg"
else
# for other bootloaders remove grub and it's configs
rm -rf $MNT/etc/default/grub
find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
BOOT_CMDS[$BOOTLOADER]="pacman -Rs grub --noconfirm && ${BOOT_CMDS[$BOOTLOADER]}"
BOOT_CMDS[grub]="${BOOT_CMDS[grub]} ; grub-mkconfig -o /boot/grub/grub.cfg"
fi
# create the bootloader configs and run the setup commands, BOOT_CMDS[$BOOTLOADER]
@ -2156,7 +2162,6 @@ setup_bootloader() {
# copy grub efi stub to generic catch all
[[ $GRUB_UEFI_FALLBACK == true ]] && grub_uefi_fallback
BOOT_DONE=true
# offer to setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
@ -2182,9 +2187,9 @@ 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 linux" 2>$ERR | dialog --cr-wrap --backtitle "$BT" \
chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR | dialog --cr-wrap --backtitle "$BT" \
--title " $_RunMkinit " --progressbox "$_RunMkinitBody\nHOOKS: $MKINIT_HOOKS $add\n" 30 90
check_for_errors "mkinitcpio -p linux" || return 1
check_for_errors "mkinitcpio -p $KERNEL" || return 1
return 0
}