Large update

This commit is contained in:
natemaia 2022-08-20 19:33:07 -07:00
parent ba89e69277
commit b92cdd34ef

590
installer
View File

@ -16,7 +16,6 @@ MNT=/mnt # installation root mountpoint if not set
SYS=Unknown # boot type, to be determined: UEFI/BIOS SYS=Unknown # boot type, to be determined: UEFI/BIOS
FONT=ter-i16n # font used for the linux console FONT=ter-i16n # font used for the linux console
HOOKS=shutdown # additional mkinitcpio HOOKS HOOKS=shutdown # additional mkinitcpio HOOKS
WAYLAND=0 # is wayland used, 1 = wayland only, 2 = X + wayland
SEL=0 # currently selected main menu item SEL=0 # currently selected main menu item
BTRFS=0 # is btrfs used, 1 = btrfs alone, 2 = btrfs + subvolume(s) BTRFS=0 # is btrfs used, 1 = btrfs alone, 2 = btrfs + subvolume(s)
EXMNTS='' # extra partitions that were mounted, used to verify mountpoint and show user EXMNTS='' # extra partitions that were mounted, used to verify mountpoint and show user
@ -37,10 +36,6 @@ CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*
export DIALOGOPTS="--cr-wrap" export DIALOGOPTS="--cr-wrap"
# regex to match wayland and X sessions for menu changes
WAYLAND_SESSIONS='sway'
X_SESSIONS='(awesome|bspwm|cinnamon|deepin|dwm|fluxbox|gnome|i3-gaps|jwm|dk|lxqt|openbox|plasma|xfce4)'
# package arrays built later from user selections # package arrays built later from user selections
typeset -a SES_PKGS USER_PKGS typeset -a SES_PKGS USER_PKGS
@ -81,18 +76,18 @@ typeset -a BASE_PKGS=(
"xorg" "xorg"
"xorg-xwayland" "xorg-xwayland"
"xorg-drivers" # TODO: should we only install specific drivers? "xorg-drivers" # TODO: should we only install specific drivers?
# all the sessions we offer use these
"archlabs-i3lock-color"
"archlabs-i3lock-fancy"
"rofi"
) # } ) # }
# general packages for most window managers to provide some basic functionality { # general packages for window managers to provide some basic functionality {
typeset -a WM_PKGS=( typeset -a WM_PKGS=(
"brightnessctl" "brightnessctl"
"gnome-keyring"
"gsimplecal" "gsimplecal"
"polkit-gnome" "polkit-gnome"
) # }
# Xorg specific packages for most window managers to provide some basic functionality {
typeset -a X_WM_PKGS=(
"arandr" "arandr"
"dunst" "dunst"
"exo" "exo"
@ -101,11 +96,10 @@ typeset -a X_WM_PKGS=(
"picom" "picom"
"scrot" "scrot"
"volumeicon" "volumeicon"
"lxappearance"
"wmctrl" "wmctrl"
"xclip" "xclip"
"xdotool" "xdotool"
"xfce4-power-manager"
"xfce4-settings"
"xterm" "xterm"
) # } ) # }
@ -131,6 +125,7 @@ typeset -a ISO_PKGS=(
"ipw2200-fw" "ipw2200-fw"
"lftp" "lftp"
"linux-firmware" "linux-firmware"
"linux-firmware-marvell"
"lm_sensors" "lm_sensors"
"lsb-release" "lsb-release"
"lsscsi" "lsscsi"
@ -155,6 +150,7 @@ typeset -a ISO_PKGS=(
"rp-pppoe" "rp-pppoe"
"sdparm" "sdparm"
"sg3_utils" "sg3_utils"
"sof-firmware"
"tcpdump" "tcpdump"
"terminus-font" "terminus-font"
"testdisk" "testdisk"
@ -170,28 +166,25 @@ typeset -a ISO_PKGS=(
# packages installed for each wm/de { # packages installed for each wm/de {
declare -A WM_EXT=( declare -A WM_EXT=(
[awesome]='archlabs-skel-awesome archlabs-i3lock-color archlabs-i3lock-fancy rofi exo archlabs-ksuperkey inotify-tools' [dk]='archlabs-skel-dk sxhkd archlabs-lemonbar'
[bspwm]='archlabs-skel-bspwm archlabs-i3lock-color archlabs-i3lock-fancy jgmenu tint2 sxhkd rofi archlabs-ksuperkey' [bspwm]='archlabs-skel-bspwm jgmenu tint2 sxhkd'
[cinnamon]='gnome-terminal' [fluxbox]='archlabs-skel-fluxbox jgmenu lxmenu-data'
[deepin]='deepin-extra' [i3-gaps]='archlabs-skel-i3-gaps i3status perl-anyevent-i3'
[dk]='archlabs-skel-dk archlabs-i3lock-color archlabs-i3lock-fancy sxhkd rofi archlabs-ksuperkey archlabs-lemonbar' [openbox]='archlabs-skel-openbox archlabs-obkey archlabs-kickshaw archlabs-pipemenus obconf jgmenu tint2 conky lxmenu-data'
[dwm]='nitrogen polkit-gnome gnome-keyring dunst lxappearance' ) # }
[fluxbox]='archlabs-skel-fluxbox archlabs-i3lock-color archlabs-i3lock-fancy jgmenu rofi lxmenu-data archlabs-ksuperkey'
[gnome]='gnome-tweaks' # executable name for each wm/de used in ~/.xinitrc {
[i3-gaps]='archlabs-skel-i3-gaps archlabs-i3lock-color archlabs-i3lock-fancy i3status perl-anyevent-i3 rofi archlabs-ksuperkey' declare -A SESSIONS=(
[jwm]='' [dk]='dk'
[lxqt]='breeze breeze-icons picom libpulse network-manager-applet' [i3-gaps]='i3'
[openbox]='archlabs-skel-openbox archlabs-obkey archlabs-kickshaw archlabs-paranoid archlabs-skel-xfce4 archlabs-i3lock-color archlabs-i3lock-fancy archlabs-pipemenus archlabs-ksuperkey obconf jgmenu tint2 conky rofi lxmenu-data' [bspwm]='bspwm'
[plasma]='kde-applications-meta powerdevil' [fluxbox]='startfluxbox'
[sway]='archlabs-skel-sway foot grim slurp swayidle swaylock swappy jq archlabs-nwg-shell archlabs-wlsunset archlabs-azote archlabs-autotiling' [openbox]='openbox-session'
[xfce4]='archlabs-skel-xfce4 xfce4-goodies xfce4-pulseaudio-plugin network-manager-applet volumeicon rofi archlabs-ksuperkey'
) # } ) # }
# packages installed for each login option { # packages installed for each login option {
declare -A LOGIN_PKGS=( declare -A LOGIN_PKGS=(
[ly]='ly' [ly]='ly'
[gdm]='gdm'
[sddm]='sddm'
[console]='xorg-xinit' [console]='xorg-xinit'
[lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice' [lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice'
) # } ) # }
@ -219,30 +212,10 @@ declare -A PKG_EXT=(
declare -A BCMDS=( declare -A BCMDS=(
[efistub]='efibootmgr -v -d /dev/sda -p 1 -c -l' [efistub]='efibootmgr -v -d /dev/sda -p 1 -c -l'
[grub]='grub-install --recheck --force' [grub]='grub-install --recheck --force'
[refind-efi]='refind-install'
[syslinux]='syslinux-install_update -i -a -m' [syslinux]='syslinux-install_update -i -a -m'
[systemd-boot]='bootctl --path=/boot install' [systemd-boot]='bootctl --path=/boot install'
) # } ) # }
# executable name for each wm/de used in ~/.xinitrc {
declare -A WM_SESSIONS=(
[awesome]='awesome'
[bspwm]='bspwm'
[cinnamon]='cinnamon-session'
[deepin]='startdde'
[dwm]='dwm'
[fluxbox]='startfluxbox'
[gnome]='gnome-session'
[i3-gaps]='i3'
[jwm]='jwm'
[dk]='dk'
[sway]='sway'
[lxqt]='startlxqt'
[openbox]='openbox-session'
[plasma]='startplasma-x11'
[xfce4]='startxfce4'
) # }
# files offered for editing after install is complete { # files offered for editing after install is complete {
declare -A EDIT_FILES=( declare -A EDIT_FILES=(
[login]='' # login is populated once we know the username and shell [login]='' # login is populated once we know the username and shell
@ -260,25 +233,13 @@ declare -A EDIT_FILES=(
# mkfs command flags for filesystem formatting { # mkfs command flags for filesystem formatting {
declare -A FS_CMD_FLAGS=( declare -A FS_CMD_FLAGS=(
[btrfs]='-fq' [btrfs]='-fq' [ext2]='-q' [ext3]='-q' [ext4]='-q' [f2fs]='-f' [jfs]='-q'
[ext2]='-q' [nilfs2]='-q' [ntfs]='-q' [reiserfs]='-q' [vfat]='-F32' [xfs]='-fq'
[ext3]='-q'
[ext4]='-q'
[f2fs]='-f'
[jfs]='-q'
[nilfs2]='-q'
[ntfs]='-q'
[reiserfs]='-q'
[vfat]='-F32'
[xfs]='-fq'
) # } ) # }
# mount options for each filesystem { # mount options for each filesystem {
declare -A FS_OPTS=( declare -A FS_OPTS=(
[vfat]='' [vfat]='' [ntfs]='' [ext2]='' [ext3]=''
[ntfs]=''
[ext2]=''
[ext3]=''
[jfs]='discard errors=continue errors=panic nointegrity' [jfs]='discard errors=continue errors=panic nointegrity'
[reiserfs]='acl nolog notail replayonly user_xattr off' [reiserfs]='acl nolog notail replayonly user_xattr off'
[ext4]='discard dealloc nofail noacl relatime noatime nobarrier nodelalloc' [ext4]='discard dealloc nofail noacl relatime noatime nobarrier nodelalloc'
@ -288,78 +249,6 @@ declare -A FS_OPTS=(
[btrfs]='autodefrag compress=zlib compress=lzo compress=no compress-force=zlib compress-force=lzo discard noacl noatime nodatasum nospace_cache recovery skip_balance space_cache ssd ssd_spread' [btrfs]='autodefrag compress=zlib compress=lzo compress=no compress-force=zlib compress-force=lzo discard noacl noatime nodatasum nospace_cache recovery skip_balance space_cache ssd ssd_spread'
) # } ) # }
# fallback mirrorlist country codes to names table {
FBREF_COUNTRIES="Australia AU
Austria AT
Bangladesh BD
Belarus BY
Belgium BE
Bosnia and Herzegovina BA
Brazil BR
Bulgaria BG
Cambodia KH
Canada CA
Chile CL
China CN
Colombia CO
Croatia HR
Czechia CZ
Denmark DK
Ecuador EC
Estonia EE
Finland FI
France FR
Georgia GE
Germany DE
Greece GR
Hong Kong HK
Hungary HU
Iceland IS
India IN
Indonesia ID
Iran IR
Ireland IE
Israel IL
Italy IT
Japan JP
Kazakhstan KZ
Kenya KE
Latvia LV
Lithuania LT
Luxembourg LU
Mexico MX
Moldova MD
Monaco MC
Netherlands NL
New Caledonia NC
New Zealand NZ
North Macedonia MK
Norway NO
Pakistan PK
Paraguay PY
Poland PL
Portugal PT
Romania RO
Russia RU
Réunion RE
Serbia RS
Singapore SG
Slovakia SK
Slovenia SI
South Africa ZA
South Korea KR
Spain ES
Sweden SE
Switzerland CH
Taiwan TW
Thailand TH
Turkey TR
Ukraine UA
United Kingdom GB
United States US
Vietnam VN"
# }
# dialog text variables { # dialog text variables {
# Basics (somewhat in order) # Basics (somewhat in order)
_keymap="\nSelect which keymap to use from the list below.\n\nThis will determine the installed system keymap once entering a graphical environment.\n\ndefault: us" _keymap="\nSelect which keymap to use from the list below.\n\nThis will determine the installed system keymap once entering a graphical environment.\n\ndefault: us"
@ -425,25 +314,23 @@ main()
tput civis tput civis
dialog --backtitle "$DIST - $SYS - v$VER" --title " Prepare " \ dialog --backtitle "$DIST - $SYS - v$VER" --title " Prepare " \
--default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \ --default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \
1 "* Select bootloader" \ 1 "* User and password" \
2 "* Username and password" \ 2 "* System configuration" \
3 "* System configuration" \ 3 "Select session(s)" \
4 "Select WM(s) and/or DE(s)" \ 4 "Select packages" \
5 "Select additional packages" \ 5 "Run command" \
6 "Enter a post-install command to run" \ 6 "View configuration" \
7 "View installation configuration" \ 7 "* Complete install" 2> "$ANS"
8 "* Confirm choices and complete install" 2> "$ANS"
read -r SEL < "$ANS" read -r SEL < "$ANS"
case $SEL in case $SEL in
1) prechecks 0 && { select_bootldr || (( SEL-- )); } ;; 1) prechecks 1 && { select_mkuser || (( SEL-- )); } ;;
2) prechecks 1 && { select_mkuser || (( SEL-- )); } ;; 2) prechecks 2 && { select_config || (( SEL-- )); } ;;
3) prechecks 2 && { select_config || (( SEL-- )); } ;; 3) prechecks 3 && { select_sessions || (( SEL-- )); } ;;
4) prechecks 3 && { select_sessions || (( SEL-- )); } ;; 4) prechecks 3 && { select_packages || (( SEL-- )); } ;;
5) prechecks 3 && { select_packages || (( SEL-- )); } ;; 5) prechecks 3 && select_usercmd ;;
6) prechecks 3 && select_usercmd ;; 6) prechecks 3 && select_show ;;
7) prechecks 3 && select_show ;; 7) prechecks 3 && install_main ;;
8) prechecks 3 && install_main ;;
*) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die 0 *) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die 0
esac esac
else else
@ -453,14 +340,13 @@ main()
--default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \ --default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \
1 "Storage management" \ 1 "Storage management" \
2 "* Mount partitions" \ 2 "* Mount partitions" \
3 "* Select bootloader" \ 3 "* User and password" \
4 "* Username and password" \ 4 "* System configuration" \
5 "* System configuration" \ 5 "Select session(s)" \
6 "Select WM(s) and/or DE(s)" \ 6 "Select packages" \
7 "Select additional packages" \ 7 "Run command" \
8 "Enter a post-install command to run" \ 8 "View configuration" \
9 "View installation configuration" \ 9 "* Complete install" 2> "$ANS"
10 "* Confirm choices and complete install" 2> "$ANS"
read -r SEL < "$ANS" read -r SEL < "$ANS"
if [[ -z $WARN && $SEL == 2 ]]; then if [[ -z $WARN && $SEL == 2 ]]; then
@ -470,14 +356,13 @@ main()
case $SEL in case $SEL in
1) dev_menu || (( SEL-- )) ;; 1) dev_menu || (( SEL-- )) ;;
2) mount_menu || SEL=0 ;; 2) mount_menu || SEL=0 ;;
3) prechecks 0 && { select_bootldr || (( SEL-- )); } ;; 3) prechecks 1 && { select_mkuser || (( SEL-- )); } ;;
4) prechecks 1 && { select_mkuser || (( SEL-- )); } ;; 4) prechecks 2 && { select_config || (( SEL-- )); } ;;
5) prechecks 2 && { select_config || (( SEL-- )); } ;; 5) prechecks 3 && { select_sessions || (( SEL-- )); } ;;
6) prechecks 3 && { select_sessions || (( SEL-- )); } ;; 6) prechecks 3 && { select_packages || (( SEL-- )); } ;;
7) prechecks 3 && { select_packages || (( SEL-- )); } ;; 7) prechecks 3 && select_usercmd ;;
8) prechecks 3 && select_usercmd ;; 8) prechecks 3 && select_show ;;
9) prechecks 3 && select_show ;; 9) prechecks 3 && install_main ;;
10) prechecks 3 && install_main ;;
*) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die 0 *) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die 0
esac esac
fi fi
@ -486,7 +371,6 @@ main()
select_show() select_show()
{ {
local pkgs="${USER_PKGS[*]} ${SES_PKGS[*]}" fmtpkgs='' pkg='' local pkgs="${USER_PKGS[*]} ${SES_PKGS[*]}" fmtpkgs='' pkg=''
[[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs"
pkgs="${pkgs// / }" pkgs="${pkgs// / }"
pkgs="${pkgs# }" pkgs="${pkgs# }"
@ -546,29 +430,15 @@ select_login()
{ {
AUTOLOGIN='' AUTOLOGIN=''
arr=("console" "Console login with no graphical display manager" dlg LOGIN_TYPE menu "Login" "\nSelect what kind of login management to use." \
"ly" "TUI display manager with an ncurses like interface" "console" "Console login with no graphical display manager" \
"gdm" "Gnome display manager (gnome default)" "ly" "TUI display manager with an ncurses like interface" \
"sddm" "Simple desktop display manager (plasma and lxqt default)" "lightdm" "Lightweight display manager" || return 1
)
(( WAYLAND == 0 )) && arr+=("lightdm" "Lightweight display manager (deepin and xfce default)")
dlg LOGIN_TYPE menu "Login" "\nSelect what kind of login management to use." "${arr[@]}" || return 1
case $LOGIN_TYPE in case $LOGIN_TYPE in
ly) ly)
EDIT_FILES[login]="/etc/ly/config.ini" EDIT_FILES[login]="/etc/ly/config.ini"
;; ;;
gdm)
EDIT_FILES[login]="none"
;;
sddm)
if [[ $INSTALL_WMS =~ (plasma|lxqt) ]]; then
EDIT_FILES[login]="/etc/sddm.conf.d/theme.conf"
else
EDIT_FILES[login]="none"
fi
;;
lightdm) lightdm)
LIGHTDM_GREETER='gtk-greeter' LIGHTDM_GREETER='gtk-greeter'
EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf" EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
@ -578,15 +448,10 @@ select_login()
console) console)
if (( $(wc -w <<< "$INSTALL_WMS") > 1 )); then if (( $(wc -w <<< "$INSTALL_WMS") > 1 )); then
dlg LOGIN_WM menu "Session" "$_login" $LOGIN_CHOICES || return 1 dlg LOGIN_WM menu "Session" "$_login" $LOGIN_CHOICES || return 1
LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}" LOGIN_WM="${SESSIONS[$LOGIN_WM]}"
fi fi
if [[ $LOGIN_WM =~ $WAYLAND_SESSIONS ]]; then # wayland console login
EDIT_FILES[login]="/home/$NEWUSER/$LOGINRC"
else
EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile" EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
fi [[ -z $LOGIN_WM ]] && LOGIN_WM="${SESSIONS[${INSTALL_WMS%% *}]}"
[[ $WAYLAND -eq 1 ]] && LOGIN_PKGS[console]=''
[[ -z $LOGIN_WM ]] && LOGIN_WM="${WM_SESSIONS[${INSTALL_WMS%% *}]}"
yesno "Autologin" "$(sed "s|USER|$NEWUSER|g; s|RC|$LOGINRC|g" <<< "$_autologin")" && AUTOLOGIN=true yesno "Autologin" "$(sed "s|USER|$NEWUSER|g; s|RC|$LOGINRC|g" <<< "$_autologin")" && AUTOLOGIN=true
;; ;;
esac esac
@ -641,7 +506,20 @@ select_config()
linux-lts 'Long-term support (LTS) linux kernel and modules' \ linux-lts 'Long-term support (LTS) linux kernel and modules' \
linux-zen 'A effort of kernel hackers to provide the best kernel for everyday systems' \ linux-zen 'A effort of kernel hackers to provide the best kernel for everyday systems' \
linux-hardened 'A security-focused linux kernel with hardening patches to mitigate exploits' || { i=3; continue; } linux-hardened 'A security-focused linux kernel with hardening patches to mitigate exploits' || { i=3; continue; }
;;
5)
if [[ $SYS == 'BIOS' ]]; then
dlg BOOTLDR menu "BIOS Bootloader" "\nSelect which bootloader to use." \
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network" || { i=4; continue; }
else
dlg BOOTLDR menu "UEFI Bootloader" "\nSelect which bootloader to use." \
"systemd-boot" "A simple UEFI boot manager which executes configured EFI images" \
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
"efistub" "Boot the kernel image directly (no chainloading support)" \
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network (no chainloading support)" || { i=4; continue; }
fi
setup_${BOOTLDR}
CONFIG_DONE=true CONFIG_DONE=true
;; ;;
esac esac
@ -763,7 +641,18 @@ select_mirrors()
[[ $mirrorpid && ! -f /tmp/mcountry ]] && wait $mirrorpid [[ $mirrorpid && ! -f /tmp/mcountry ]] && wait $mirrorpid
REF_COUNTRIES="$(< /tmp/mcountry)" REF_COUNTRIES="$(< /tmp/mcountry)"
[[ $REF_COUNTRIES ]] || REF_COUNTRIES="$FBREF_COUNTRIES" [[ $REF_COUNTRIES ]] || REF_COUNTRIES="Australia AU
Austria AT Bangladesh BD Belarus BY Belgium BE Bosnia and Herzegovina BA
Brazil BR Bulgaria BG Cambodia KH Canada CA Chile CL China CN Colombia CO
Croatia HR Czechia CZ Denmark DK Ecuador EC Estonia EE Finland FI France FR
Georgia GE Germany DE Greece GR Hong Kong HK Hungary HU Iceland IS India IN
Indonesia ID Iran IR Ireland IE Israel IL Italy IT Japan JP Kazakhstan KZ
Kenya KE Latvia LV Lithuania LT Luxembourg LU Mexico MX Moldova MD Monaco MC
Netherlands NL New Caledonia NC New Zealand NZ North Macedonia MK Norway NO
Pakistan PK Paraguay PY Poland PL Portugal PT Romania RO Russia RU Réunion RE
Serbia RS Singapore SG Slovakia SK Slovenia SI South Africa ZA South Korea KR
Spain ES Sweden SE Switzerland CH Taiwan TW Thailand TH Turkey TR Ukraine UA
United Kingdom GB United States US Vietnam VN"
# build an associative array of country codes mapped to full names # build an associative array of country codes mapped to full names
eval "typeset -A COUNTRIES=( $(awk '{ eval "typeset -A COUNTRIES=( $(awk '{
@ -813,58 +702,24 @@ select_mirrors()
return 0 return 0
} }
select_bootldr()
{
if [[ $SYS == 'BIOS' ]]; then
dlg BOOTLDR menu "BIOS Bootloader" "\nSelect which bootloader to use." \
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network" || return 1
else
dlg BOOTLDR menu "UEFI Bootloader" "\nSelect which bootloader to use." \
"systemd-boot" "A simple UEFI boot manager which executes configured EFI images" \
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
"refind" "A UEFI boot manager that aims to be platform neutral and simplify multi-boot" \
"efistub" "Boot the kernel image directly (no chainloading support)" \
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network (no chainloading support)" || return 1
fi
setup_${BOOTLDR}
return 0
}
select_sessions() select_sessions()
{ {
typeset -a pkgs typeset -a pkgs
WAYLAND=0
LOGIN_CHOICES='' LOGIN_CHOICES=''
dlg INSTALL_WMS check "Sessions" "$_sessions\n" \ dlg INSTALL_WMS check "Sessions" "$_sessions\n" \
i3-gaps "A fork of i3wm with more features including gaps" "$(ofn i3-gaps "$INSTALL_WMS")" \ i3-gaps "A fork of i3wm with more features including gaps" "$(ofn i3-gaps "$INSTALL_WMS")" \
openbox "A lightweight, powerful, and highly configurable stacking wm" "$(ofn openbox "$INSTALL_WMS")" \ openbox "A lightweight, powerful, and highly configurable stacking wm" "$(ofn openbox "$INSTALL_WMS")" \
sway "A tiling Wayland compositor and replacement for the i3 window manager" "$(ofn sway "$INSTALL_WMS")" \
dk "A dynamic tiling window manager in the vein of dwm, bspwm, and xmonad" "$(ofn dk "$INSTALL_WMS")" \ dk "A dynamic tiling window manager in the vein of dwm, bspwm, and xmonad" "$(ofn dk "$INSTALL_WMS")" \
dwm "A dynamic WM for X that manages windows in tiled, floating, or monocle layouts" "$(ofn dwm "$INSTALL_WMS")" \
bspwm "A tiling wm that represents windows as the leaves of a binary tree" "$(ofn bspwm "$INSTALL_WMS")" \ bspwm "A tiling wm that represents windows as the leaves of a binary tree" "$(ofn bspwm "$INSTALL_WMS")" \
lxqt "A port of the lightweight desktop environment (LXDE) to Qt" "$(ofn lxqt "$INSTALL_WMS")" \ fluxbox "A lightweight and highly-configurable window manager" "$(ofn fluxbox "$INSTALL_WMS")"
jwm "A lightweight window manager for Xorg written in C" "$(ofn jwm "$INSTALL_WMS")" \
xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "$INSTALL_WMS")" \
awesome "A customized Awesome WM session created by @elanapan" "$(ofn awesome "$INSTALL_WMS")" \
fluxbox "A lightweight and highly-configurable window manager" "$(ofn fluxbox "$INSTALL_WMS")" \
plasma "A KDE software project currently comprising a full desktop environment" "$(ofn plasma "$INSTALL_WMS")" \
deepin "The desktop environment of the Chinese Deepin Linux distribution." "$(ofn deepin "$INSTALL_WMS")" \
gnome "A desktop environment that aims to be simple and easy to use" "$(ofn gnome "$INSTALL_WMS")" \
cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "$INSTALL_WMS")"
[[ $INSTALL_WMS ]] || return 0 [[ $INSTALL_WMS ]] || return 0
for i in ${INSTALL_WMS/dwm/}; do for i in $INSTALL_WMS; do
pkgs+=("$i") pkgs+=("$i")
done done
if [[ $INSTALL_WMS =~ $WAYLAND_SESSIONS ]]; then
WAYLAND=1
[[ $INSTALL_WMS =~ $X_SESSIONS ]] && WAYLAND=2
fi
for i in $INSTALL_WMS; do for i in $INSTALL_WMS; do
LOGIN_CHOICES+="$i - " LOGIN_CHOICES+="$i - "
if [[ $i =~ (plasma|deepin) ]]; then if [[ $i =~ (plasma|deepin) ]]; then
@ -954,13 +809,11 @@ select_packages()
plank "An elegant, simple, and clean dock" "$(ofn plank "${USER_PKGS[*]}")" \ plank "An elegant, simple, and clean dock" "$(ofn plank "${USER_PKGS[*]}")" \
playerctl "Media player controller for spotify, vlc, audacious, bmp, xmms2, and others." "$(ofn playerctl "${USER_PKGS[*]}")" \ playerctl "Media player controller for spotify, vlc, audacious, bmp, xmms2, and others." "$(ofn playerctl "${USER_PKGS[*]}")" \
qbittorrent "An advanced bittorrent client" "$(ofn qbittorrent "${USER_PKGS[*]}")" \ qbittorrent "An advanced bittorrent client" "$(ofn qbittorrent "${USER_PKGS[*]}")" \
qpdfview "A tabbed PDF viewer" "$(ofn qpdfview "${USER_PKGS[*]}")" \
qt5ct "GUI for managing Qt based application themes, icons, and fonts" "$(ofn qt5ct "${USER_PKGS[*]}")" \ qt5ct "GUI for managing Qt based application themes, icons, and fonts" "$(ofn qt5ct "${USER_PKGS[*]}")" \
qutebrowser "A keyboard-focused vim-like web browser based on Python and PyQt5" "$(ofn qutebrowser "${USER_PKGS[*]}")" \ qutebrowser "A keyboard-focused vim-like web browser based on Python and PyQt5" "$(ofn qutebrowser "${USER_PKGS[*]}")" \
ranger "A simple vim-like file manager" "$(ofn ranger "${USER_PKGS[*]}")" \ ranger "A simple vim-like file manager" "$(ofn ranger "${USER_PKGS[*]}")" \
rhythmbox "A Music playback and management application" "$(ofn rhythmbox "${USER_PKGS[*]}")" \ rhythmbox "A Music playback and management application" "$(ofn rhythmbox "${USER_PKGS[*]}")" \
rxvt-unicode "A unicode enabled rxvt-clone terminal emulator" "$(ofn rxvt-unicode "${USER_PKGS[*]}")" \ rxvt-unicode "A unicode enabled rxvt-clone terminal emulator" "$(ofn rxvt-unicode "${USER_PKGS[*]}")" \
sakura "A terminal emulator based on GTK and VTE" "$(ofn sakura "${USER_PKGS[*]}")" \
simple-scan "Simple scanning utility" "$(ofn simple-scan "${USER_PKGS[*]}")" \ simple-scan "Simple scanning utility" "$(ofn simple-scan "${USER_PKGS[*]}")" \
simplescreenrecorder "A feature-rich screen recorder" "$(ofn simplescreenrecorder "${USER_PKGS[*]}")" \ simplescreenrecorder "A feature-rich screen recorder" "$(ofn simplescreenrecorder "${USER_PKGS[*]}")" \
steam "A popular game distribution platform by Valve" "$(ofn steam "${USER_PKGS[*]}")" \ steam "A popular game distribution platform by Valve" "$(ofn steam "${USER_PKGS[*]}")" \
@ -1827,7 +1680,6 @@ install_base()
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime" chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime"
# touchpad config # touchpad config
if (( WAYLAND != 1 )); then
mkdir -pv "$MNT/etc/X11/xorg.conf.d/" mkdir -pv "$MNT/etc/X11/xorg.conf.d/"
cat > "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf" <<- EOF cat > "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf" <<- EOF
Section "InputClass" Section "InputClass"
@ -1875,7 +1727,6 @@ install_base()
Option "XkbLayout" "$KEYMAP" Option "XkbLayout" "$KEYMAP"
EndSection EndSection
EOF EOF
fi
cat > "$MNT/etc/default/keyboard" <<- EOF cat > "$MNT/etc/default/keyboard" <<- EOF
# KEYBOARD CONFIGURATION FILE # KEYBOARD CONFIGURATION FILE
@ -1902,9 +1753,6 @@ install_user()
{ {
local i=0 local i=0
local groups='video,log,rfkill,wheel' local groups='video,log,rfkill,wheel'
[[ -e $MNT/etc/X11/xorg.conf.d/20-nvidia.conf && -e $MNT/usr/bin/optirun ]] && groups+=',bumblebee'
# rm -f "$MNT/root/.zlogin" # remove welcome message
echo "Setting root user password and shell" echo "Setting root user password and shell"
chrun "chpasswd <<< 'root:$ROOT_PASS'" 2> "$ERR" 2>&1 chrun "chpasswd <<< 'root:$ROOT_PASS'" 2> "$ERR" 2>&1
@ -1918,7 +1766,7 @@ install_user()
echo "Creating user $NEWUSER and setting password" echo "Creating user $NEWUSER and setting password"
# check if there's an existing user home for new user (separate /home) # check if there's an existing user home for new user (separate /home partition)
[[ -d "$MNT/home/$NEWUSER" ]] && i=1 [[ -d "$MNT/home/$NEWUSER" ]] && i=1
chrun "useradd -m -g users -G $groups -s /bin/$NEWSHELL $NEWUSER" 2> "$ERR" 2>&1 chrun "useradd -m -g users -G $groups -s /bin/$NEWSHELL $NEWUSER" 2> "$ERR" 2>&1
@ -1926,8 +1774,6 @@ install_user()
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> "$ERR" 2>&1 chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> "$ERR" 2>&1
errshow 1 "chrun 'chpasswd <<< \"$NEWUSER:$USER_PASS\"'" errshow 1 "chrun 'chpasswd <<< \"$NEWUSER:$USER_PASS\"'"
[[ $INSTALL_WMS == *dwm* ]] && install_suckless "/home/$NEWUSER" chroot
# upgrade existing home with new skeleton configs, making backups when needed # upgrade existing home with new skeleton configs, making backups when needed
(( i )) && cp -rfaT -b --suffix='.bak' "$MNT/etc/skel/" "$MNT/home/$NEWUSER" (( i )) && cp -rfaT -b --suffix='.bak' "$MNT/etc/skel/" "$MNT/home/$NEWUSER"
@ -1946,7 +1792,6 @@ install_login()
echo "Setting up $LOGIN_TYPE" echo "Setting up $LOGIN_TYPE"
if [[ $LOGIN_TYPE != 'console' ]]; then if [[ $LOGIN_TYPE != 'console' ]]; then
[[ $INSTALL_WMS == *dwm* ]] && dwm_xsession
rm -rf "$AUTOLOGIN_SERV" "$MNT/home/$NEWUSER/.xinitrc" rm -rf "$AUTOLOGIN_SERV" "$MNT/home/$NEWUSER/.xinitrc"
chrun "systemctl enable $LOGIN_TYPE.service" 2> "$ERR" chrun "systemctl enable $LOGIN_TYPE.service" 2> "$ERR"
errshow 1 "chrun 'systemctl enable $LOGIN_TYPE.service'" errshow 1 "chrun 'systemctl enable $LOGIN_TYPE.service'"
@ -1972,41 +1817,18 @@ install_cleanup()
[[ $NEWSHELL != 'bash' ]] && rm -rf "$MNT/home/$user/.bash"* [[ $NEWSHELL != 'bash' ]] && rm -rf "$MNT/home/$user/.bash"*
[[ $NEWSHELL != 'zsh' ]] && rm -rf "$MNT/home/$user/.z"* [[ $NEWSHELL != 'zsh' ]] && rm -rf "$MNT/home/$user/.z"*
# cleanup default jwmrc
if [[ $INSTALL_WMS == *jwm* ]]; then
sed '7,14d; s/xlock -mode blank/i3-lock-fancy -p/g; s/root:1/rofi_run/g' "$MNT/etc/system.jwmrc" > "$MNT/home/$user/.jwmrc"
fi
# no picom (compton) or ksuperkey in dwm login
[[ $LOGIN_WM == 'dwm' ]] && sed -i '/super/d; /picom/d' "$MNT/home/$user/.xprofile" "$MNT/root/.xprofile"
# remove some commands from ~/.xprofile when using self contained sessions
if [[ $LOGIN_WM =~ (startplasma-x11|gnome-session|startdde|cinnamon-session) || ($LOGIN_TYPE != 'console' && $INSTALL_WMS =~ (plasma|gnome|cinnamon|deepin)) ]]; then
sed -i '/super/d; /nitrogen/d; /picom/d' "$MNT/home/$user/.xprofile" "$MNT/root/.xprofile"
fi
cat >> "$MNT/etc/profile" <<- EOF cat >> "$MNT/etc/profile" <<- EOF
$([[ $VIRT != 'none' && $INSTALL_WMS =~ sway ]] && echo -e "# disable hardware cursor for sway in VM\nexport WLR_NO_HARDWARE_CURSORS=1")
# add ~/.local/bin to the PATH # add ~/.local/bin to the PATH
echo \$PATH | grep -q "/home/$user/.local/bin:" || export PATH="/home/$user/.local/bin:\$PATH" echo \$PATH | grep -q "/home/$user/.local/bin:" || export PATH="/home/$user/.local/bin:\$PATH"
EOF EOF
# set the keyboard layout for sway session
[[ $INSTALL_WMS =~ sway ]] && sed -i "s/\(set.*\$lang.*\)us/\1$CMAP/" "$MNT/home/$user/.config/sway/variables"
# when using wayland alone strip out unused configs
if (( WAYLAND == 1 )); then
rm -f "$MNT/root/.xinitrc" "$MNT/home/$user/.xprofile" "$MNT/home/$user/.xinitrc" "$MNT/home/$user/.Xresources"
rm -f "$MNT/home/$user/.config/picom.conf" "$MNT/home/$user/.local/bin/rofi_run"
rm -rf "$MNT/home/$user/.config/jgmenu" "$MNT/home/$user/.config/nitrogen" "$MNT/home/$user/.config/dunst" "$MNT/home/$user/.config/xfce4" "$MNT/home/$user/.config/rofi"
fi
# failed to install some AL packages so put a list in a script for the user to install later # failed to install some AL packages so put a list in a script for the user to install later
if [[ "${FAIL_PKG[*]}" ]]; then if [[ "${FAIL_PKG[*]}" ]]; then
echo "#!/bin/bash" > "$MNT/home/$user/packages" cat > "$MNT/home/$user/packages" <<- EOF
echo "sudo pacman -Syyu ${FAIL_PKG[*]} --needed --noconfirm || exit" >> "$MNT/home/$user/packages" #!/bin/bash
echo "rm -f /home/%s/packages" "$user" >> "$MNT/home/$user/packages" sudo pacman -Syyu ${FAIL_PKG[*]} --needed --noconfirm || exit
rm -f /home/$user/packages"
EOF
fi fi
return 0 return 0
@ -2022,7 +1844,7 @@ install_bootldr()
if [[ $ROOT == /dev/mapper* ]]; then if [[ $ROOT == /dev/mapper* ]]; then
ROOT_ID="$ROOT" ROOT_ID="$ROOT"
else else
[[ $BOOTLDR =~ (systemd-boot|refind|efistub) ]] && uuid_type="PARTUUID" [[ $BOOTLDR =~ (systemd-boot|efistub) ]] && uuid_type="PARTUUID"
ROOT_ID="$uuid_type=$(blkid -s $uuid_type -o value $ROOT)" ROOT_ID="$uuid_type=$(blkid -s $uuid_type -o value $ROOT)"
fi fi
@ -2076,11 +1898,6 @@ install_bootldr()
cp -rf "$MNT/boot/EFI/syslinux/"* "$MNT/boot/EFI/BOOT/" cp -rf "$MNT/boot/EFI/syslinux/"* "$MNT/boot/EFI/BOOT/"
cp -f "$MNT/boot/EFI/syslinux/syslinux.efi" "$MNT/boot/EFI/BOOT/BOOTX64.EFI" cp -f "$MNT/boot/EFI/syslinux/syslinux.efi" "$MNT/boot/EFI/BOOT/BOOTX64.EFI"
;; ;;
refind)
k="linux-hardened,linux-zen,linux-lts,linux"
sed -i "/#extra_kernel_version_strings/ c extra_kernel_version_strings $k" "$MNT/boot/EFI/refind/refind.conf"
cp -fv "$MNT/boot/EFI/refind/refind_x64.efi" "$MNT/boot/EFI/BOOT/BOOTX64.EFI"
;;
esac esac
fi fi
@ -2095,10 +1912,8 @@ install_packages()
inpkg=("${SES_PKGS[@]}" "${USER_PKGS[@]}" "$NEWSHELL") inpkg=("${SES_PKGS[@]}" "${USER_PKGS[@]}" "$NEWSHELL")
if [[ $INSTALL_WMS ]]; then if [[ $INSTALL_WMS ]]; then
inpkg+=("${BASE_PKGS[@]}") inpkg+=("${BASE_PKGS[@]}" "${WM_PKGS[@]}")
[[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox|jwm|awesome|sway|dk) ]] && inpkg+=("${WM_PKGS[@]}")
[[ -d /etc/NetworkManager/system-connections ]] && inpkg+=("network-manager-applet") [[ -d /etc/NetworkManager/system-connections ]] && inpkg+=("network-manager-applet")
(( WAYLAND == 1 )) || inpkg+=("${X_WM_PKGS[@]}")
fi fi
for i in ${LOGIN_PKGS[$LOGIN_TYPE]}; do for i in ${LOGIN_PKGS[$LOGIN_TYPE]}; do
@ -2115,7 +1930,6 @@ install_packages()
[[ $BTRFS_MNT || $blk =~ btrfs ]] && inpkg+=('btrfs-progs') [[ $BTRFS_MNT || $blk =~ btrfs ]] && inpkg+=('btrfs-progs')
[[ $NEWSHELL == 'zsh' ]] && inpkg+=('zsh-completions') [[ $NEWSHELL == 'zsh' ]] && inpkg+=('zsh-completions')
[[ $NEWSHELL =~ (bash|zsh) ]] && inpkg+=('bash-completion') [[ $NEWSHELL =~ (bash|zsh) ]] && inpkg+=('bash-completion')
[[ $INSTALL_WMS =~ dwm ]] && inpkg+=('git' 'make' 'gcc' 'pkgconf')
# remove the packages we don't want on the installed system # remove the packages we don't want on the installed system
@ -2184,9 +1998,6 @@ install_packages()
if [[ $BOOTLDR == 'grub' ]]; then if [[ $BOOTLDR == 'grub' ]]; then
chrun "pacman -S os-prober grub --needed --noconfirm" 2> "$ERR" 2>&1 chrun "pacman -S os-prober grub --needed --noconfirm" 2> "$ERR" 2>&1
errshow 1 "chrun 'pacman -S os-prober grub --needed --noconfirm'" errshow 1 "chrun 'pacman -S os-prober grub --needed --noconfirm'"
elif [[ $BOOTLDR == 'refind' ]]; then
chrun "pacman -S refind --needed --noconfirm" 2> "$ERR" 2>&1
errshow 1 "chrun 'pacman -S refind --needed --noconfirm'"
elif [[ $BOOTLDR == 'syslinux' ]]; then elif [[ $BOOTLDR == 'syslinux' ]]; then
chrun "pacman -S syslinux --needed --noconfirm" 2> "$ERR" 2>&1 chrun "pacman -S syslinux --needed --noconfirm" 2> "$ERR" 2>&1
errshow 1 "chrun 'pacman -S syslinux --needed --noconfirm'" errshow 1 "chrun 'pacman -S syslinux --needed --noconfirm'"
@ -2215,10 +2026,6 @@ install_check_bg()
[[ $LUKS ]] && luks='cryptsetup' [[ $LUKS ]] && luks='cryptsetup'
# select_mirrors || AUTO_MIRROR=true
# install_mirrorlist > /tmp/bgout 2>&1
# al_repo "/etc/pacman.conf"
{ {
pacman -Syy pacman -Syy
pacman -S archlinux-keyring --noconfirm pacman -S archlinux-keyring --noconfirm
@ -2252,37 +2059,11 @@ install_check_bg()
fi fi
} }
install_suckless()
{
local dir="$1/suckless"
shift
if [[ $1 == 'chroot' ]]; then
chrun "mkdir -pv '$dir'"
for i in dwm dmenu st; do
if chrun "git clone 'https://git.suckless.org/$i' '$dir/$i'"; then
chrun "cd '$dir/$i' && make PREFIX=/usr install"
else
printf "failed to clone %s repo\n" "$i"
fi
done
else
mkdir -pv "$dir"
for i in dwm dmenu st; do
if git clone "https://git.suckless.org/$i" "$dir/$i"; then
cd "$dir/$i" && make PREFIX=/usr install
else
printf "failed to clone %s repo\n" "$i"
fi
done
fi
}
install_tearfree() install_tearfree()
{ {
if [[ $VIRT != 'none' ]]; then if [[ $VIRT != 'none' ]]; then
[[ -e "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf" ]] && rm -fv "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf" [[ -e "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf" ]] && rm -fv "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf"
elif [[ $TEARFREE ]]; then else
if lspci | grep ' VGA ' | grep -q 'Intel'; then if lspci | grep ' VGA ' | grep -q 'Intel'; then
echo "Creating Intel Tear Free config /etc/X11/xorg.conf.d/20-intel.conf" echo "Creating Intel Tear Free config /etc/X11/xorg.conf.d/20-intel.conf"
cat > "$MNT/etc/X11/xorg.conf.d/20-intel.conf" <<- EOF cat > "$MNT/etc/X11/xorg.conf.d/20-intel.conf" <<- EOF
@ -2292,6 +2073,7 @@ install_tearfree()
Option "TearFree" "true" Option "TearFree" "true"
EndSection EndSection
EOF EOF
sed -i 's/xrender/glx/g' "$MNT/etc/skel/.config/picom.conf"
cat "$MNT/etc/X11/xorg.conf.d/20-intel.conf" cat "$MNT/etc/X11/xorg.conf.d/20-intel.conf"
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*RX\|AMD/ATI.*R[579]'; then # newer RX, R5, R7, and R9 cards can use the amdgpu driver elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*RX\|AMD/ATI.*R[579]'; then # newer RX, R5, R7, and R9 cards can use the amdgpu driver
echo "Creating AMD Tear Free config /etc/X11/xorg.conf.d/20-amdgpu.conf" echo "Creating AMD Tear Free config /etc/X11/xorg.conf.d/20-amdgpu.conf"
@ -2302,6 +2084,7 @@ install_tearfree()
Option "TearFree" "true" Option "TearFree" "true"
EndSection EndSection
EOF EOF
sed -i 's/xrender/glx/g' "$MNT/etc/skel/.config/picom.conf"
cat "$MNT/etc/X11/xorg.conf.d/20-amdgpu.conf" cat "$MNT/etc/X11/xorg.conf.d/20-amdgpu.conf"
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*HD [2-6][0-9]*'; then # older HD 2xxx-6xxx cards must use the radeon driver elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*HD [2-6][0-9]*'; then # older HD 2xxx-6xxx cards must use the radeon driver
echo "Creating Radeon Tear Free config /etc/X11/xorg.conf.d/20-radeon.conf" echo "Creating Radeon Tear Free config /etc/X11/xorg.conf.d/20-radeon.conf"
@ -2312,33 +2095,13 @@ install_tearfree()
Option "TearFree" "on" Option "TearFree" "on"
EndSection EndSection
EOF EOF
sed -i 's/xrender/glx/g' "$MNT/etc/skel/.config/picom.conf"
cat "$MNT/etc/X11/xorg.conf.d/20-radeon.conf" cat "$MNT/etc/X11/xorg.conf.d/20-radeon.conf"
elif hash nvidia-installer > /dev/null 2>&1 && lspci | grep ' VGA ' | grep -q 'NVIDIA'; then # nvidia cards require a bit of checking for notebook gpus elif lspci | grep ' VGA ' | grep -q 'NVIDIA'; then
echo "Trying nvidia driver install" echo "NVIDIA cards are currently unsupported for auto config"
if lspci | grep ' VGA ' | grep -q 'Intel\|AMD' && lspci | grep ' VGA ' | grep -q 'NVIDIA.*[6-9][1-8][05]M[X]\?\|NVIDIA.*Quadro.*[KMP][1-6][0-2][0]*M'; then
chrun "nvidia-installer --bumblebee"
else
chrun "nvidia-installer" # unsure which card so try auto detection
fi
if [[ -e $MNT/etc/X11/xorg.conf.d/20-nvidia.conf ]]; then
cat "$MNT/etc/X11/xorg.conf.d/20-nvidia.conf"
echo
echo "NVIDIA driver installed"
echo "To enable driver vsync:"
echo -e "\trun nvidia-settings (as root) on first boot\n\tenable 'ForceFullCompositionPipeline' under the advanced settings"
echo -e "\tlastly save the change to your nvidia xorg config /etc/X11/xorg.conf.d/20-nvidia.conf"
echo -e "\tand remove everything but the Device and Screen sections from the file"
else
echo "Unable to install nvidia driver"
fi
else else
echo "Unknown video card - aborting driver setup" echo "Unknown video card - aborting driver setup"
fi fi
if lspci | grep ' VGA ' | grep -q 'Intel\|AMD/ATI' && [[ $MNT/etc/X11/xorg.conf.d == *"$MNT"* && -f "$MNT/etc/skel/.config/picom.conf" ]]; then
# the glx backend is better on intel/amd gpus
sed -i 's/xrender/glx/g' "$MNT/etc/skel/.config/picom.conf"
fi
fi fi
} }
@ -2356,8 +2119,7 @@ install_mkinitcpio()
install_mirrorlist() install_mirrorlist()
{ {
local url='' country='' ip='' local url=''
local key="access_key=5f29642060ab983b31fdf4c2935d8c56"
typeset -a args=("--verbose" "--connection-timeout" "2" "--threads" "10") typeset -a args=("--verbose" "--connection-timeout" "2" "--threads" "10")
# avoid SSL errors when the time is wrong # avoid SSL errors when the time is wrong
@ -2366,35 +2128,11 @@ install_mirrorlist()
# make a mirrorlist backup in case of issues # make a mirrorlist backup in case of issues
[[ -f /etc/pacman.d/mirrorlist.bak ]] || cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak [[ -f /etc/pacman.d/mirrorlist.bak ]] || cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
if hash reflector > /dev/null 2>&1; then
if [[ $AUTO_MIRROR ]]; then if [[ $AUTO_MIRROR ]]; then
reflector "${args[@]}" -l 250 -a 24 --score 100 --sort rate -f 5 --save /etc/pacman.d/mirrorlist reflector "${args[@]}" -l 250 -a 24 --score 100 --sort rate -f 5 --save /etc/pacman.d/mirrorlist
else else
reflector "${args[@]}" -c "$MIRROR_COUNTRY" -l 150 -a 24 --score 75 --sort rate -f 5 --save /etc/pacman.d/mirrorlist reflector "${args[@]}" -c "$MIRROR_COUNTRY" -l 150 -a 24 --score 75 --sort rate -f 5 --save /etc/pacman.d/mirrorlist
fi fi
else
echo "Ranking mirrorlist, This may take a while..."
if [[ $AUTO_MIRROR ]]; then
ip="$(curl -s "api.infoip.io/ip")"
country="$(curl -fsSL "http://api.ipstack.com/$ip?$key&fields=country_code" |
python -c "import sys, json; print(json.load(sys.stdin)['country_code'])")"
if [[ $country && "${!COUNTRIES[*]}" =~ $country ]]; then
if [[ $country =~ (CA|US) ]]; then
url="https://www.archlinux.org/mirrorlist/?country=US&country=CA&use_mirror_status=on"
elif [[ $country =~ (AU|NZ) ]]; then
url="https://www.archlinux.org/mirrorlist/?country=AU&country=NZ&use_mirror_status=on"
else
url="https://www.archlinux.org/mirrorlist/?country=${country}&use_mirror_status=on"
fi
else # no country code so just grab all mirrors, will be a very slow sort but we don't have other options
url="https://www.archlinux.org/mirrorlist/?country=all&use_mirror_status=on"
fi
else
url="$MIRROR_URL"
fi
curl -fsSL "$url" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 - > /etc/pacman.d/mirrorlist
fi
chmod +r /etc/pacman.d/mirrorlist chmod +r /etc/pacman.d/mirrorlist
} }
@ -2460,34 +2198,8 @@ config_ly()
EOF EOF
} }
config_gdm()
{
cat >> "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF
# add ~/.local/bin to the PATH
echo \$PATH | grep -q "\$HOME/.local/bin:" || export PATH="\$HOME/.local/bin:\$PATH"
EOF
}
config_sddm()
{
if [[ $INSTALL_WMS =~ (plasma|lxqt) ]]; then
mkdir -p "$MNT/etc/sddm.conf.d"
cat > "$MNT/etc/sddm.conf.d/theme.conf" <<- EOF
[Theme]
Current=breeze
EOF
fi
cat >> "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF
# add ~/.local/bin to the PATH
echo \$PATH | grep -q "\$HOME/.local/bin:" || export PATH="\$HOME/.local/bin:\$PATH"
EOF
}
config_console() config_console()
{ {
typeset ses='startx' back='x11'
[[ $LOGIN_WM =~ $WAYLAND_SESSIONS ]] && ses="$LOGIN_WM" back='wayland'
if [[ $AUTOLOGIN ]]; then if [[ $AUTOLOGIN ]]; then
mkdir -p "$AUTOLOGIN_SERV" mkdir -p "$AUTOLOGIN_SERV"
cat > "$AUTOLOGIN_SERV/autologin.conf" <<- EOF cat > "$AUTOLOGIN_SERV/autologin.conf" <<- EOF
@ -2495,40 +2207,21 @@ config_console()
ExecStart= ExecStart=
ExecStart=-/sbin/agetty -o '-p -f -- \\\u' --noclear --autologin $NEWUSER - \$TERM ExecStart=-/sbin/agetty -o '-p -f -- \\\u' --noclear --autologin $NEWUSER - \$TERM
EOF EOF
# [Service]
# ExecStart=
# ExecStart=-/sbin/agetty --autologin $NEWUSER --noclear %I 38400 linux
else else
rm -rf "$AUTOLOGIN_SERV" rm -rf "$AUTOLOGIN_SERV"
fi fi
if [[ $INSTALL_WMS ]]; then if [[ $INSTALL_WMS ]]; then
rm "$MNT/home/$NEWUSER/$LOGINRC" rm "$MNT/home/$NEWUSER/$LOGINRC"
if (( WAYLAND != 1 )); then
sed -i "/exec/ c exec ${LOGIN_WM}" "$MNT/home/$NEWUSER/.xinitrc" sed -i "/exec/ c exec ${LOGIN_WM}" "$MNT/home/$NEWUSER/.xinitrc"
if [[ $LOGIN_WM == 'gnome-session' ]]; then
# see https://wiki.archlinux.org/index.php/GNOME#Manually
sed -i '/exec/ i export XDG_SESSION_TYPE=x11' "$MNT/home/$NEWUSER/.xinitrc"
sed -i '/exec/ i export GDK_BACKEND=x11' "$MNT/home/$NEWUSER/.xinitrc"
fi
else
cat >> "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF
# wayland specific setup
export XDG_SESSION_TYPE=wayland
export MOZ_ENABLE_WAYLAND=1
export QT_QPA_PLATFORM=wayland
EOF
rm -rf "$MNT/home/$NEWUSER/.xinitrc" "$MNT/root/.xinitrc"
fi
# run the session after logging in regardless of autologin # run the session after logging in regardless of autologin
cat >> "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF cat >> "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF
# add ~/.local/bin to the PATH # add ~/.local/bin to the PATH
echo \$PATH | grep -q "\$HOME/.local/bin:" || export PATH="\$HOME/.local/bin:\$PATH" echo \$PATH | grep -q "\$HOME/.local/bin:" || export PATH="\$HOME/.local/bin:\$PATH"
# automatically run $ses when logging in on tty1 # automatically run startx when logging in on tty1
[ -z "\$DISPLAY" ] && [ \$XDG_VTNR -eq 1 ] && sleep 2 && $ses [ -z "\$DISPLAY" ] && [ \$XDG_VTNR -eq 1 ] && sleep 2 && startx
EOF EOF
else else
rm -rf "$MNT/home/$NEWUSER/.xinitrc" "$MNT/root/.xinitrc" rm -rf "$MNT/home/$NEWUSER/.xinitrc" "$MNT/root/.xinitrc"
@ -2684,36 +2377,6 @@ prerun_syslinux()
return 0 return 0
} }
setup_refind()
{
EDIT_FILES[bootloader]="/boot/refind_linux.conf"
BCMDS[refind-efi]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1; refind-install"
}
prerun_refind()
{
cat > "$MNT/boot/refind_linux.conf" <<- EOF
"$DIST Linux" "root=$ROOT_ID ${LUKS_DEV}${RESUME}rw ([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") add_efi_memmap $([[ $UCODE ]] &&
printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-%v.img"
"$DIST Linux Fallback" "root=$ROOT_ID ${LUKS_DEV}${RESUME}rw ([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") add_efi_memmap $([[ $UCODE ]] &&
printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-%v-fallback.img"
EOF
mkdir -p "$MNT/etc/pacman.d/hooks"
cat > "$MNT/etc/pacman.d/hooks/refind.hook" <<- EOF
[Trigger]
Operation = Upgrade
Type = Package
Target = refind
[Action]
Description = Updating rEFInd on ESP
When = PostTransaction
Exec = /usr/bin/refind-install
EOF
}
setup_systemd-boot() setup_systemd-boot()
{ {
EDIT_FILES[bootloader]="/boot/loader/entries/${DIST,,}.conf" EDIT_FILES[bootloader]="/boot/loader/entries/${DIST,,}.conf"
@ -3287,7 +2950,7 @@ msg()
usage() usage()
{ {
cat <<- EOF cat <<- EOF
usage: $1 [-cfhDnt] [-r ROOT] [-b BOOT] [-d DISTRO] [-m MOUNTPOINT] usage: $1 [-cfhDn] [-r ROOT] [-b BOOT] [-d DISTRO] [-m MOUNTPOINT]
options: options:
-h print this message and exit -h print this message and exit
@ -3299,8 +2962,6 @@ usage()
-n no partitioning, mounting, or formatting (self mount) -n no partitioning, mounting, or formatting (self mount)
-r root partition to use for install, required when using -n -r root partition to use for install, required when using -n
-b boot partition to use for install, required on UEFI systems when using -n -b boot partition to use for install, required on UEFI systems when using -n
-t install and setup drivers for nvidia or tearfree xorg configs for other vendors
if you experience boot issues with this option, remove /etc/X11/xorg.conf.d/20-*.conf
EOF EOF
exit 0 exit 0
@ -3636,7 +3297,7 @@ prechecks()
# the selected entry number ($SEL) back to the step required to progress # the selected entry number ($SEL) back to the step required to progress
local i=1 local i=1
if (( $1 >= 0 )) && ! grep -q " $MNT " /proc/mounts; then if (( $1 >= 1 )) && ! grep -q " $MNT " /proc/mounts; then
msg "Not Mounted" "\nPartition(s) must be mounted first.\n" 2 msg "Not Mounted" "\nPartition(s) must be mounted first.\n" 2
if [[ $NOMOUNT ]]; then if [[ $NOMOUNT ]]; then
die 1 die 1
@ -3644,30 +3305,22 @@ prechecks()
SEL=1 SEL=1
fi fi
i=0 i=0
elif [[ $1 -ge 1 && -z $BOOTLDR ]]; then elif [[ $1 -ge 2 && (-z $NEWUSER || -z $USER_PASS) ]]; then
msg "No Bootloader" "\nBootloader must be selected first.\n" 2 msg "No User" "\nA user must be created first.\n" 2
if [[ $NOMOUNT ]]; then if [[ $NOMOUNT ]]; then
SEL=0 SEL=0
else else
SEL=2 SEL=2
fi fi
i=0 i=0
elif [[ $1 -ge 2 && (-z $NEWUSER || -z $USER_PASS) ]]; then elif [[ $1 -ge 3 && -z $CONFIG_DONE ]]; then
msg "No User" "\nA user must be created first.\n" 2 msg "No Config" "\nSystem configuration must be done first.\n" 2
if [[ $NOMOUNT ]]; then if [[ $NOMOUNT ]]; then
SEL=1 SEL=1
else else
SEL=3 SEL=3
fi fi
i=0 i=0
elif [[ $1 -ge 3 && -z $CONFIG_DONE ]]; then
msg "No Config" "\nSystem configuration must be done first.\n" 2
if [[ $NOMOUNT ]]; then
SEL=2
else
SEL=4
fi
i=0
fi fi
(( i )) # return code (( i )) # return code
} }
@ -3814,20 +3467,6 @@ net_connect()
chk_connect chk_connect
} }
dwm_xsession()
{
mkdir -p "$MNT/usr/share/xsessions"
cat > "$MNT/usr/share/xsessions/dwm.desktop" <<- EOF
[Desktop Entry]
Encoding=UTF-8
Name=Dwm
Comment=Dynamic Window Manager
Exec=dwm
TryExec=dwm
Type=Application
EOF
}
is_bg_install() is_bg_install()
{ {
[[ $BG_PID ]] || return 0 [[ $BG_PID ]] || return 0
@ -3897,12 +3536,11 @@ fi
trap 'printf "\n^C\n" && die 1' INT trap 'printf "\n^C\n" && die 1' INT
while getopts ":htcnrfDb:m:d:" OPT; do while getopts ":hcnrfDb:m:d:" OPT; do
case "$OPT" in case "$OPT" in
D) debug ;; D) debug ;;
h) usage "${0##*/}" ;; h) usage "${0##*/}" ;;
n) NOMOUNT=true ;; n) NOMOUNT=true ;;
t) TEARFREE=true ;;
m) MNT="$OPTARG" ;; m) MNT="$OPTARG" ;;
d) DIST="$OPTARG" ;; d) DIST="$OPTARG" ;;
c) NONET=true ;; c) NONET=true ;;
@ -3989,12 +3627,8 @@ mirrorpid=''
if [[ ! -f /tmp/new ]]; then if [[ ! -f /tmp/new ]]; then
msg "Update" "\nChecking for installer updates.\n" 0 msg "Update" "\nChecking for installer updates.\n" 0
if hash reflector > /dev/null 2>&1; then
( reflector --list-countries 2>/dev/null | sed '1,2d' | awk 'NF{NF--}; {print}' > /tmp/mcountry ) & ( reflector --list-countries 2>/dev/null | sed '1,2d' | awk 'NF{NF--}; {print}' > /tmp/mcountry ) &
mirrorpid=$! mirrorpid=$!
else
echo "$FBREF_COUNTRIES" > /tmp/mcountry
fi
if curl -fsSL 'https://bitbucket.org/archlabslinux/installer/raw/master/installer' -o /tmp/new; then if curl -fsSL 'https://bitbucket.org/archlabslinux/installer/raw/master/installer' -o /tmp/new; then
if (( $(vercmp "$(awk -F= '/^VER=/ {print $2}' /tmp/new)" "$VER") > 0 )); then if (( $(vercmp "$(awk -F= '/^VER=/ {print $2}' /tmp/new)" "$VER") > 0 )); then
cp /tmp/new /usr/local/bin/installer cp /tmp/new /usr/local/bin/installer