diff --git a/installer b/installer index 2b6be23..3955e88 100755 --- a/installer +++ b/installer @@ -5,8 +5,8 @@ # Some ideas and code reworked from other resources # AIF, Calamares, and the Arch Wiki.. Credit where credit is due -# shellcheck disable=SC2086,SC2046,SC2254,SC2164 -VER=2.10 +# shellcheck disable=2086,2046,2254,2164,2030,2031 +VER=2.12 # default values { @@ -16,15 +16,16 @@ MNT=/mnt # installation root mountpoint if not set SYS=Unknown # boot type, to be determined: UEFI/BIOS FONT=ter-i16n # font used for the linux console HOOKS=shutdown # additional mkinitcpio HOOKS +WAYLAND=0 # is wayland used, 1 = wayland only, 2 = X + wayland SEL=0 # currently selected main menu item 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 USERCMD='' # optional command(s) entered by the user to run in the chroot +NET_TYPE=networkmanager # network frontend type/package ANS=/tmp/ans # dialog answer output file BG=/tmp/bgout # output from background process ERR=/tmp/errlog # stderr log used internally by errshow() DBG=/tmp/debuglog # debug log file when passed -d -RUN=/run/archiso/bootmnt/arch/boot # path for live system /boot VIRT="$(systemd-detect-virt)" MEM="$(awk '/MemTotal/ {print int($2 / 1024) "M"}' /proc/meminfo)" @@ -36,6 +37,10 @@ CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.* 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 typeset -a SES_PKGS USER_PKGS @@ -43,6 +48,7 @@ typeset -a SES_PKGS USER_PKGS # packages installed specific to archlabs, installed when any session is chosen { typeset -a BASE_PKGS=( +"acpi" "alsa-firmware" "alsa-lib" "alsa-plugins" @@ -54,10 +60,13 @@ typeset -a BASE_PKGS=( "archlabs-skel-base" "archlabs-themes" "archlabs-wallpapers" +"htop" "ffmpeg" +"imagemagick" "gst-libav" "gst-plugins-base" "gst-plugins-good" +"gnome-themes-extra" "gstreamer" "gtk3" "gvfs" @@ -67,35 +76,40 @@ typeset -a BASE_PKGS=( "pavucontrol" "pulseaudio" "pulseaudio-alsa" -"scrot" "sudo" "xdg-user-dirs" "xorg" +"xorg-xwayland" "xorg-drivers" # TODO: should we only install specific drivers? -"xterm" ) # } -# packages installed for most window managers to provide some basic functionality { +# general packages for most window managers to provide some basic functionality { typeset -a WM_PKGS=( +"brightnessctl" +"gnome-keyring" +"gsimplecal" +"polkit-gnome" +) # } + +# Xorg specific packages for most window managers to provide some basic functionality { +typeset -a X_WM_PKGS=( "arandr" "dunst" "exo" "feh" -"gnome-keyring" -"gsimplecal" -"network-manager-applet" "nitrogen" -"polkit-gnome" "picom" +"scrot" "volumeicon" "wmctrl" "xclip" "xdotool" "xfce4-power-manager" "xfce4-settings" +"xterm" ) # } -# packages installed when choosing to use pacstrap { +# packages installed to parity the .iso { typeset -a ISO_PKGS=( "arch-install-scripts" "crda" @@ -115,7 +129,6 @@ typeset -a ISO_PKGS=( "iputils" "ipw2100-fw" "ipw2200-fw" -"iwd" "lftp" "linux-firmware" "lm_sensors" @@ -155,29 +168,32 @@ typeset -a ISO_PKGS=( "wvdial" ) # } -# packages installed for each wm/de, most are depends of the skel packages { +# packages installed for each wm/de { declare -A WM_EXT=( -[awesome]='archlabs-skel-awesome' -[bspwm]='archlabs-skel-bspwm' +[awesome]='archlabs-skel-awesome archlabs-i3lock-color archlabs-i3lock-fancy rofi exo archlabs-ksuperkey inotify-tools' +[bspwm]='archlabs-skel-bspwm archlabs-i3lock-color archlabs-i3lock-fancy jgmenu tint2 sxhkd rofi archlabs-ksuperkey' [cinnamon]='gnome-terminal' [deepin]='deepin-extra' +[dk]='archlabs-skel-dk archlabs-i3lock-color archlabs-i3lock-fancy sxhkd rofi archlabs-ksuperkey archlabs-lemonbar' [dwm]='nitrogen polkit-gnome gnome-keyring dunst lxappearance' -[fluxbox]='archlabs-skel-fluxbox' +[fluxbox]='archlabs-skel-fluxbox archlabs-i3lock-color archlabs-i3lock-fancy jgmenu rofi lxmenu-data archlabs-ksuperkey' [gnome]='gnome-tweaks' -[i3-gaps]='archlabs-skel-i3-gaps' +[i3-gaps]='archlabs-skel-i3-gaps archlabs-i3lock-color archlabs-i3lock-fancy i3status perl-anyevent-i3 rofi archlabs-ksuperkey' [jwm]='' [lxqt]='breeze breeze-icons picom libpulse network-manager-applet' -[openbox]='archlabs-skel-openbox' +[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' [plasma]='kde-applications-meta powerdevil' -[xfce4]='archlabs-skel-xfce4 xfce4-goodies' +[sway]='archlabs-skel-sway grim mako slurp swayidle swaylock swappy lxappearance archlabs-foot archlabs-sway-save-outputs archlabs-wlsunset archlabs-wdisplays archlabs-azote archlabs-autotiling archlabs-nwg-bar archlabs-nwg-dock archlabs-nwg-shell-config archlabs-nwg-drawer archlabs-nwg-menu archlabs-nwg-panel archlabs-nwg-wrapper archlabs-gopsuinfo wl-clipboard' +[xfce4]='archlabs-skel-xfce4 xfce4-goodies xfce4-pulseaudio-plugin network-manager-applet volumeicon rofi archlabs-ksuperkey' ) # } # packages installed for each login option { declare -A LOGIN_PKGS=( +[ly]='ly' [gdm]='gdm' -[lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice' [sddm]='sddm' -[xinit]='xorg-xinit' +[console]='xorg-xinit' +[lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice' ) # } # extras installed for user selected packages { @@ -219,6 +235,8 @@ declare -A WM_SESSIONS=( [gnome]='gnome-session' [i3-gaps]='i3' [jwm]='jwm' +[dk]='dk' +[sway]='sway' [lxqt]='startlxqt' [openbox]='openbox-session' [plasma]='startplasma-x11' @@ -270,72 +288,77 @@ 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' ) # } -# mirrorlist country codes to names table { -typeset -A COUNTRIES=( -[AU]='Australia' -[AT]='Austria' -[BD]='Bangladesh' -[BY]='Belarus' -[BE]='Belgium' -[BA]='Bosnia and Herzegovina' -[BR]='Brazil' -[BG]='Bulgaria' -[CA]='Canada' -[CL]='Chile' -[CN]='China' -[CO]='Colombia' -[HR]='Croatia' -[CZ]='Czechia' -[DK]='Denmark' -[EC]='Ecuador' -[FI]='Finland' -[FR]='France' -[GE]='Georgia' -[DE]='Germany' -[GR]='Greece' -[HK]='Hong Kong' -[HU]='Hungary' -[IS]='Iceland' -[IN]='India' -[ID]='Indonesia' -[IR]='Iran' -[IE]='Ireland' -[IL]='Israel' -[IT]='Italy' -[JP]='Japan' -[KZ]='Kazakhstan' -[KE]='Kenya' -[LV]='Latvia' -[LT]='Lithuania' -[LU]='Luxembourg' -[NL]='Netherlands' -[NC]='New Caledonia' -[NZ]='New Zealand' -[MK]='North Macedonia' -[NO]='Norway' -[PY]='Paraguay' -[PH]='Philippines' -[PL]='Poland' -[PT]='Portugal' -[RO]='Romania' -[RU]='Russia' -[RS]='Serbia' -[SG]='Singapore' -[SK]='Slovakia' -[SI]='Slovenia' -[ZA]='South Africa' -[KR]='South Korea' -[ES]='Spain' -[SE]='Sweden' -[CH]='Switzerland' -[TW]='Taiwan' -[TH]='Thailand' -[TR]='Turkey' -[UA]='Ukraine' -[GB]='United Kingdom' -[US]='United States' -[VN]='Vietnam' -) # } +# 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 { # Basics (somewhat in order) @@ -445,15 +468,15 @@ main() WARN=true fi case $SEL in - 1) dev_menu || (( SEL-- )) ;; - 2) mount_menu || (( SEL-- )) ;; - 3) prechecks 0 && { select_bootldr || (( SEL-- )); } ;; - 4) prechecks 1 && { select_mkuser || (( SEL-- )); } ;; - 5) prechecks 2 && { select_config || (( SEL-- )); } ;; - 6) prechecks 3 && { select_sessions || (( SEL-- )); } ;; - 7) prechecks 3 && { select_packages || (( SEL-- )); } ;; - 8) prechecks 3 && select_usercmd ;; - 9) prechecks 3 && select_show ;; + 1) dev_menu || (( SEL-- )) ;; + 2) mount_menu || (( SEL-- )) ;; + 3) prechecks 0 && { select_bootldr || (( SEL-- )); } ;; + 4) prechecks 1 && { select_mkuser || (( SEL-- )); } ;; + 5) prechecks 2 && { select_config || (( SEL-- )); } ;; + 6) prechecks 3 && { select_sessions || (( SEL-- )); } ;; + 7) prechecks 3 && { select_packages || (( SEL-- )); } ;; + 8) prechecks 3 && select_usercmd ;; + 9) prechecks 3 && select_show ;; 10) prechecks 3 && install_main ;; *) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die 0 esac @@ -508,13 +531,19 @@ select_login() { AUTOLOGIN='' - dlg LOGIN_TYPE menu "Login" "\nSelect what kind of login management to use." \ - "xinit" "Console login with no graphical display manager" \ - "lightdm" "Lightweight display manager (deepin and xfce default)" \ - "gdm" "Gnome display manager (gnome default)" \ - "sddm" "Simple desktop display manager (plasma and lxqt default)" || return 1 + arr=("console" "Console login with no graphical display manager" + "ly" "TUI display manager with an ncurses like interface" + "gdm" "Gnome display manager (gnome default)" + "sddm" "Simple desktop display manager (plasma and lxqt default)" + ) + (( 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 + ly) + EDIT_FILES[login]="/etc/ly/config.ini" + ;; gdm) EDIT_FILES[login]="none" ;; @@ -531,12 +560,17 @@ select_login() local txt="\nWith a deepin install you can choose to use their greeter for lightdm\n\nUse the deepin greeter?\n" [[ $INSTALL_WMS == *deepin* ]] && yesno "Greeter" "$txt" && LIGHTDM_GREETER="deepin-greeter" ;; - xinit) - EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile" + console) if (( $(wc -w <<< "$INSTALL_WMS") > 1 )); then dlg LOGIN_WM menu "Session" "$_login" $LOGIN_CHOICES || return 1 LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}" 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" + fi + [[ $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 ;; @@ -653,27 +687,25 @@ select_keymap() { if [[ ! -f /tmp/xkeys ]]; then dlg KEYMAP menu "Keyboard" "$_keymap" \ - us English af Afghani al Albanian am Armenian ara Arabic \ - at German au English az Azerbaijani ba Bosnian bd Bangla \ - be Belgian 'bg' Bulgarian br Portuguese bt Dzongkha bw Tswana \ - by Belarusian ca French 'cd' French ch German cm English \ - cn Chinese cz Czech de German dk Danish dz Berber \ - ee Estonian epo Esperanto es Spanish et Amharic 'fi' Finnish \ - fo Faroese fr French gb English ge Georgian gh English \ - gn French gr Greek hr Croatian hu Hungarian id Indonesian \ - ie Irish il Hebrew 'in' Indian iq Iraqi ir Persian \ - is Icelandic it Italian jp Japanese ke Swahili kg Kyrgyz \ - kh Khmer kr Korean kz Kazakh la Lao latam Spanish \ - lk Sinhala lt Lithuanian lv Latvian ma Arabic mao Maori \ - md Moldavian me Montenegrin mk Macedonian ml Bambara mm Burmese \ - mn Mongolian mt Maltese mv Dhivehi my Malay ng English \ - nl Dutch no Norwegian np Nepali ph Filipino pk Urdu \ - pl Polish pt Portuguese ro Romanian rs Serbian ru Russian \ - se Swedish si Slovenian sk Slovak sn Wolof sy Arabic \ - tg French th Thai tj Tajik tm Turkmen tr Turkish \ - tw Taiwanese tz Swahili ua Ukrainian uz Uzbek vn Vietnamese \ - za English \ - || return 1 + us English af Afghani al Albanian am Armenian ara Arabic \ + at German au English az Azerbaijani ba Bosnian bd Bangla \ + be Belgian 'bg' Bulgarian br Portuguese bt Dzongkha bw Tswana \ + by Belarusian ca French 'cd' French ch German cm English \ + cn Chinese cz Czech de German dk Danish dz Berber \ + ee Estonian epo Esperanto es Spanish et Amharic 'fi' Finnish \ + fo Faroese fr French gb English ge Georgian gh English \ + gn French gr Greek hr Croatian hu Hungarian id Indonesian \ + ie Irish il Hebrew 'in' Indian iq Iraqi ir Persian \ + is Icelandic it Italian jp Japanese ke Swahili kg Kyrgyz \ + kh Khmer kr Korean kz Kazakh la Lao latam Spanish \ + lk Sinhala lt Lithuanian lv Latvian ma Arabic mao Maori \ + md Moldavian me Montenegrin mk Macedonian ml Bambara mm Burmese \ + mn Mongolian mt Maltese mv Dhivehi my Malay ng English \ + nl Dutch no Norwegian np Nepali ph Filipino pk Urdu \ + pl Polish pt Portuguese ro Romanian rs Serbian ru Russian \ + se Swedish si Slovenian sk Slovak sn Wolof sy Arabic \ + tg French th Thai tj Tajik tm Turkmen tr Turkish \ + tw Taiwanese tz Swahili ua Ukrainian uz Uzbek vn Vietnamese za English || return 1 echo "$KEYMAP" > /tmp/xkeys else @@ -711,59 +743,58 @@ select_mirrors() { codes='' MIRROR_URL='' - typeset -ga MIRROR_COUNTRY + typeset -g MIRROR_COUNTRY typeset c="" - while :; do - c="" - dlg codes check "Mirror Countries" "\nSelect which countries to use mirrors from.\n\nUse [Space] to toggle the selected item.\n\nNot choosing any will result in an automatic selection." \ - AU Australia "$(ofn AU "$codes")" AT Austria "$(ofn AT "$codes")" \ - BA "Bosnia Herzegovina" "$(ofn BA "$codes")" BY Belarus "$(ofn BY "$codes")" \ - BE Belgium "$(ofn BE "$codes")" BR Brazil "$(ofn BR "$codes")" \ - BG Bulgaria "$(ofn BG "$codes")" CA Canada "$(ofn CA "$codes")" \ - CL Chile "$(ofn CL "$codes")" CN China "$(ofn CN "$codes")" \ - CO Colombia "$(ofn CO "$codes")" CZ "Czech Republic" "$(ofn CZ "$codes")" \ - DK Denmark "$(ofn DK "$codes")" EE Estonia "$(ofn EE "$codes")" \ - FI Finland "$(ofn FI "$codes")" FR France "$(ofn FR "$codes")" \ - DE Germany "$(ofn DE "$codes")" GB "United Kingdom" "$(ofn GB "$codes")" \ - GR Greece "$(ofn GR "$codes")" HU Hungary "$(ofn HU "$codes")" \ - IN India "$(ofn IN "$codes")" IE Ireland "$(ofn IE "$codes")" \ - IL Israel "$(ofn IL "$codes")" IT Italy "$(ofn IT "$codes")" \ - JP Japan "$(ofn JP "$codes")" KZ Kazakhstan "$(ofn KZ "$codes")" \ - KR Korea "$(ofn KR "$codes")" LT Lithuania "$(ofn LT "$codes")" \ - LV Latvia "$(ofn LV "$codes")" LU Luxembourg "$(ofn LU "$codes")" \ - MK Macedonia "$(ofn MK "$codes")" NL Netherlands "$(ofn NL "$codes")" \ - NC "New Caledonia" "$(ofn NC "$codes")" NZ "New Zealand" "$(ofn NZ "$codes")" \ - NO Norway "$(ofn NO "$codes")" PL Poland "$(ofn PL "$codes")" \ - PT Portugal "$(ofn PT "$codes")" RO Romania "$(ofn RO "$codes")" \ - RU Russia "$(ofn RU "$codes")" RS Serbia "$(ofn RS "$codes")" \ - SG Singapore "$(ofn SG "$codes")" SK Slovakia "$(ofn SK "$codes")" \ - ZA "South Africa" "$(ofn ZA "$codes")" ES Spain "$(ofn ES "$codes")" \ - LK "Sri Lanka" "$(ofn LK "$codes")" SE Sweden "$(ofn SE "$codes")" \ - CH Switzerland "$(ofn CH "$codes")" TW Taiwan "$(ofn TW "$codes")" \ - TR Turkey "$(ofn TR "$codes")" UA Ukraine "$(ofn UA "$codes")" \ - US "United States" "$(ofn US "$codes")" UZ Uzbekistan "$(ofn UZ "$codes")" \ - VN Vietnam "$(ofn VN "$codes")" || return 1 + [[ $mirrorpid && ! -f /tmp/mcountry ]] && wait $mirrorpid + REF_COUNTRIES="$(< /tmp/mcountry)" + [[ $REF_COUNTRIES ]] || REF_COUNTRIES="$FBREF_COUNTRIES" + # build an associative array of country codes mapped to full names + eval "typeset -A COUNTRIES=( $(awk '{ + if (NF > 3) + printf("[%s]=\"%s %s %s\" ", $4, $1, $2, $3) + else if (NF > 2) + printf("[%s]=\"%s %s\" ", $3, $1, $2) + else + printf("[%s]=\"%s\" ", $2, $1) + }' <<< "$REF_COUNTRIES"))" + + # build a string of available countries and codes with ofn calls for each + avail="echo $(awk -v q="\"'" '{ + if (NF > 3) { + printf("%s %s_%s_%s $(ofn %s \"$codes\") ", $4, $1, $2, $3, $4) + } else if (NF > 2) { + printf("%s %s_%s $(ofn %s \"$codes\") ", $3, $1, $2, $3) + } else { + printf("%s %s $(ofn %s \"$codes\") ", $2, $1, $2) + } + }' <<< "$REF_COUNTRIES")" + + while :; do + # eval the ofn calls added to insert off/on for dialog checkbox + cavail=$(eval $avail) + c="" + dlg codes check "Mirror Countries" "\nSelect which countries to use mirrors from.\n\nUse [Space] to toggle the selected item.\n\nNot choosing any will result in an automatic selection." $cavail || return 1 for i in $codes; do - if [[ $c ]]; then - c+=", ${COUNTRIES[$i]}" - else - c="${COUNTRIES[$i]}" - fi + i="${i//_/ }" + c+="${COUNTRIES[$i]}," done yesno "Mirror Countries" "\nConfirm the following countries: $c\n" && break done + MIRROR_COUNTRY="$c" + + # build a URL for mirror sorting without reflector for i in $codes; do if [[ $MIRROR_URL ]]; then MIRROR_URL+="&country=$i" else MIRROR_URL="https://www.archlinux.org/mirrorlist/?country=$i" fi - MIRROR_COUNTRY+=("--country" "${COUNTRIES[$i]}") done MIRROR_URL+='&use_mirror_status=on' + return 0 } @@ -788,11 +819,14 @@ select_bootldr() select_sessions() { typeset -a pkgs - + WAYLAND=0 LOGIN_CHOICES='' + dlg INSTALL_WMS check "Sessions" "$_sessions\n" \ 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")" \ + 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")" \ 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")" \ lxqt "A port of the lightweight desktop environment (LXDE) to Qt" "$(ofn lxqt "$INSTALL_WMS")" \ @@ -811,6 +845,11 @@ select_sessions() pkgs+=("$i") done + if [[ $INSTALL_WMS =~ $WAYLAND_SESSIONS ]]; then + WAYLAND=1 + [[ $INSTALL_WMS =~ $X_SESSIONS ]] && WAYLAND=2 + fi + for i in $INSTALL_WMS; do LOGIN_CHOICES+="$i - " if [[ $i =~ (plasma|deepin) ]]; then @@ -828,15 +867,9 @@ select_sessions() select_login || return 1 - for pkg in "${pkgs[@]}"; do - [[ ${SES_PKGS[*]} != *"$pkg"* ]] && SES_PKGS+=("$pkg") - done + for pkg in "${pkgs[@]}"; do [[ ${SES_PKGS[*]} != *"$pkg"* ]] && SES_PKGS+=("$pkg"); done - if [[ $INSTALL_WMS ]]; then - echo "$INSTALL_WMS" > /tmp/wmlist - else - rm -f /tmp/wmlist - fi + { [[ $INSTALL_WMS ]] && echo "$INSTALL_WMS" > /tmp/wmlist; } || rm -f /tmp/wmlist return 0 } @@ -857,7 +890,6 @@ select_packages() chromium "An open-source web browser based on the Blink rendering engine" "$(ofn chromium "${USER_PKGS[*]}")" \ clementine "A modern music player and library organizer" "$(ofn clementine "${USER_PKGS[*]}")" \ cmus "A small, fast and powerful console music player" "$(ofn cmus "${USER_PKGS[*]}")" \ - deadbeef "A GTK+ audio player for GNU/Linux" "$(ofn deadbeef "${USER_PKGS[*]}")" \ deluge "A bittorrent client written in python" "$(ofn deluge "${USER_PKGS[*]}")" \ elinks "An advanced and well-established feature-rich text mode web browser" "$(ofn elinks "${USER_PKGS[*]}")" \ emacs "An extensible, customizable, self-documenting real-time display editor" "$(ofn emacs "${USER_PKGS[*]}")" \ @@ -879,7 +911,6 @@ select_packages() gpicview "Lightweight image viewer" "$(ofn gpicview "${USER_PKGS[*]}")" \ guvcview "Capture video from camera devices" "$(ofn guvcview "${USER_PKGS[*]}")" \ hexchat "A popular and easy to use graphical IRC client" "$(ofn hexchat "${USER_PKGS[*]}")" \ - htop "An interactive process viewer" "$(ofn htop "${USER_PKGS[*]}")" \ inkscape "Professional vector graphics editor" "$(ofn inkscape "${USER_PKGS[*]}")" \ irssi "A modular text mode IRC client with Perl scripting" "$(ofn irssi "${USER_PKGS[*]}")" \ kdenlive "A popular non-linear video editor for Linux" "$(ofn kdenlive "${USER_PKGS[*]}")" \ @@ -913,7 +944,6 @@ select_packages() 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[*]}")" \ rhythmbox "A Music playback and management application" "$(ofn rhythmbox "${USER_PKGS[*]}")" \ - rsync "A file transfer program to keep remote files in sync" "$(ofn rsync "${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[*]}")" \ @@ -921,7 +951,6 @@ select_packages() steam "A popular game distribution platform by Valve" "$(ofn steam "${USER_PKGS[*]}")" \ surf "A simple web browser based on WebKit2/GTK+" "$(ofn surf "${USER_PKGS[*]}")" \ terminator "Terminal emulator that supports tabs and grids" "$(ofn terminator "${USER_PKGS[*]}")" \ - termite "A minimal VTE-based terminal emulator" "$(ofn termite "${USER_PKGS[*]}")" \ thunar "A modern file manager for the Xfce Desktop Environment" "$(ofn thunar "${USER_PKGS[*]}")" \ thunderbird "Standalone mail and news reader from mozilla" "$(ofn thunderbird "${USER_PKGS[*]}")" \ tilda "A GTK based drop down terminal for Linux and Unix" "$(ofn tilda "${USER_PKGS[*]}")" \ @@ -1179,7 +1208,7 @@ part_mount() btrfs_name "\nEnter the name of the subvolume on $part to be mounted at $mntp.\n\ne.g. mount -o subvol=YOUR_SUBVOL $part $mntp\n" || return 1 btrfs_mount "$part" "$mntp" "$SUBVOL" || return 1 else - if [[ $BTRFS -ne 2 && $fs && ${FS_OPTS[$fs]} && $part != "$BOOT" && $part != "$AUTO_ROOT" ]] && select_mntopts "$part" "$fs"; then + if [[ $BTRFS -ne 2 && $fs && ${FS_OPTS[$fs]} && $part != "$BOOT" && $part != "$AUTO_ROOT" ]] && mount_opts "$part" "$fs"; then mount -o $MNT_OPTS "$part" "$mntp" > /dev/null 2> "$ERR" errshow 0 "mount -o $MNT_OPTS $part $mntp" || return 1 else @@ -1361,20 +1390,20 @@ mount_menu() fi [[ $LUKS && $LUKS_PART ]] && part_countdec $LUKS_PART [[ $LVM && $LVM_PARTS ]] && part_countdec $LVM_PARTS - select_root || { ROOT=''; return 1; } - select_boot || { BOOT=''; return 1; } + mount_root || { ROOT=''; return 1; } + mount_boot || { BOOT=''; return 1; } if [[ $BOOT ]]; then part_mount "$BOOT" "/boot" || return 1 part_bootdev SEP_BOOT=true fi - select_swap || return 1 - select_extra || return 1 + mount_swap || return 1 + mount_extra || return 1 install_background return 0 } -select_boot() +mount_boot() { local s pts dev size isize ptcount=0 @@ -1461,7 +1490,7 @@ select_boot() return 0 } -select_root() +mount_root() { local pts dev size isize ptcount=0 @@ -1495,7 +1524,7 @@ select_root() fi if [[ $ROOT ]]; then - select_filesystem "$ROOT" || return 1 + mount_filesystem "$ROOT" || return 1 part_mount "$ROOT" || return 1 if (( BTRFS == 2 )); then btrfs_subvols "$ROOT" || return 1 @@ -1509,7 +1538,7 @@ select_root() return 1 } -select_swap() +mount_swap() { local pts dev size isize @@ -1557,7 +1586,7 @@ select_swap() return 0 } -select_extra() +mount_extra() { local part dev size @@ -1575,7 +1604,7 @@ select_extra() dlg part menu 'Mount Extra' "$_expart" 'done' 'finish mounting step' $PARTS || break if [[ $part == 'done' ]]; then break - elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then + elif mount_filesystem "$part" && mount_mountpoint && part_mount "$part" "$EXMNT"; then if (( BTRFS == 2 )); then btrfs_subvols "$part" "$EXMNT" || return 1 fi @@ -1589,7 +1618,7 @@ select_extra() return 0 } -select_mntopts() +mount_opts() { local part="$1" local fs="$2" @@ -1608,7 +1637,7 @@ select_mntopts() return 0 } -select_filesystem() +mount_filesystem() { local part="$1" local fs='' @@ -1650,7 +1679,7 @@ select_filesystem() fi } -select_mountpoint() +mount_mountpoint() { EXMNT='' until [[ $EXMNT ]]; do @@ -1675,7 +1704,7 @@ install_main() errshow 1 "genfstab -U '$MNT' > '$MNT/etc/fstab'" [[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" "$MNT/etc/fstab" install_packages - install_tearfree "$MNT/etc/X11/xorg.conf.d" + install_tearfree install_mkinitcpio install_bootldr chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa" @@ -1689,6 +1718,7 @@ install_main() if [[ -f "$MNT/etc/os-release" ]] && ! grep -q "$DIST" "$MNT/etc/os-release"; then n=$(awk '/^NAME=/ {gsub(/^NAME=|"|'\''/, ""); print $1}' "$MNT/etc/os-release" 2> /dev/null) sed -i "s/$n/$DIST/g" "$MNT/etc/os-release" + sed -i "s/$n/$DIST/g" "$MNT/etc/lsb-release" fi # allow members of the wheel group to run commands as root @@ -1736,25 +1766,26 @@ install_base() tput cnorm if [[ $BG_PID ]] && kill -0 $BG_PID 2> /dev/null; then [[ -e /tmp/wmlist ]] && rm -f /tmp/wmlist - printf "\nA background install process is still running, tailing the output...\n" + printf "\nA background install process is still running, tailing the output...\n\n" tail -f --pid=$BG_PID "$BG" trap - EXIT unset BG_PID fi - mkdir -pv "$MNT/etc/default" "$MNT/etc/X11/xorg.conf.d/" + mkdir -pv "$MNT/etc/default" if [[ $DIST == "ArchLabs" ]]; then # we have some customizations in /etc on the iso we want to preserve - cp -vf /etc/pacman.conf "$MNT/etc/" cp -vf /etc/os-release "$MNT/etc/" - cp -vf /etc/modprobe.d/* "$MNT/etc/modprobe.d/" # */ + cp -vf /etc/lsb-release "$MNT/etc/" + cp -vf /etc/modprobe.d "$MNT/etc/" cp -vf /etc/skel/.zshrc "$MNT/etc/skel/.zshrc" else zshrc fi # copy network settings + [[ -d /var/lib/iwd ]] && cp -rfv /var/lib/iwd "$MNT/var/lib/" [[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf "$MNT/etc/" [[ -d /etc/netctl/interfaces ]] && cp -rfv /etc/netctl/interfaces "$MNT/etc/netctl/" [[ -d /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections "$MNT/etc/NetworkManager/" @@ -1770,52 +1801,55 @@ install_base() chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime" # touchpad config - cat > "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf" <<- EOF - Section "InputClass" - Identifier "touchpad" - Driver "libinput" - MatchIsTouchpad "on" - Option "Tapping" "on" - Option "TappingDrag" "on" - Option "AccelSpeed" "0.7" - Option "AccelProfile" "adaptive" - Option "ScrollMethod" "twofinger" - Option "MiddleEmulation" "on" - Option "DisableWhileTyping" "on" - Option "TappingButtonMap" "lrm" - EndSection - - Section "InputClass" - Identifier "touchpad-ignore-duplicates" - MatchIsTouchpad "on" - MatchOS "Linux" - MatchDevicePath "/dev/input/mouse*" - Option "Ignore" "on" - EndSection - - Section "InputClass" - Identifier "clickpad-buttons" - MatchDriver "libinput" - Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0" - Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%" - EndSection - - Section "InputClass" - Identifier "Disable-clickpad-buttons-on-Apple-touchpads" - MatchProduct "Apple|bcm5974" - MatchDriver "libinput" - Option "SoftButtonAreas" "0 0 0 0 0 0 0 0" - EndSection - EOF - - cat > "$MNT/etc/X11/xorg.conf.d/00-keyboard.conf" <<- EOF - # Use localectl(1) to instruct systemd-localed to update it. - Section "InputClass" - Identifier "system-keyboard" - MatchIsKeyboard "on" - Option "XkbLayout" "$KEYMAP" - EndSection - EOF + if (( WAYLAND != 1 )); then + mkdir -pv "$MNT/etc/X11/xorg.conf.d/" + cat > "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf" <<- EOF + Section "InputClass" + Identifier "touchpad" + Driver "libinput" + MatchIsTouchpad "on" + Option "Tapping" "on" + Option "TappingDrag" "on" + Option "AccelSpeed" "0.5" + Option "AccelProfile" "adaptive" + Option "ScrollMethod" "twofinger" + Option "MiddleEmulation" "on" + Option "DisableWhileTyping" "on" + Option "TappingButtonMap" "lrm" + EndSection + + Section "InputClass" + Identifier "touchpad-ignore-duplicates" + MatchIsTouchpad "on" + MatchOS "Linux" + MatchDevicePath "/dev/input/mouse*" + Option "Ignore" "on" + EndSection + + Section "InputClass" + Identifier "clickpad-buttons" + MatchDriver "libinput" + Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0" + Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%" + EndSection + + Section "InputClass" + Identifier "Disable-clickpad-buttons-on-Apple-touchpads" + MatchProduct "Apple|bcm5974" + MatchDriver "libinput" + Option "SoftButtonAreas" "0 0 0 0 0 0 0 0" + EndSection + EOF + + cat > "$MNT/etc/X11/xorg.conf.d/00-keyboard.conf" <<- EOF + # Use localectl(1) to instruct systemd-localed to update it. + Section "InputClass" + Identifier "system-keyboard" + MatchIsKeyboard "on" + Option "XkbLayout" "$KEYMAP" + EndSection + EOF + fi cat > "$MNT/etc/default/keyboard" <<- EOF # KEYBOARD CONFIGURATION FILE @@ -1841,7 +1875,7 @@ install_base() install_user() { local i=0 - local groups='log,rfkill,wheel' + local groups='video,log,rfkill,wheel' [[ -e $MNT/etc/X11/xorg.conf.d/20-nvida.conf && -e $MNT/usr/bin/optirun ]] && groups+=',bumblebee' rm -f "$MNT/root/.zlogin" # remove welcome message @@ -1885,7 +1919,7 @@ install_login() echo "Setting up $LOGIN_TYPE" - if [[ $LOGIN_TYPE != 'xinit' ]]; then + if [[ $LOGIN_TYPE != 'console' ]]; then [[ $INSTALL_WMS == *dwm* ]] && dwm_xsession rm -rf "$AUTOLOGIN_SERV" "$MNT/home/$NEWUSER/.xinitrc" chrun "systemctl enable $LOGIN_TYPE.service" 2> "$ERR" @@ -1921,9 +1955,33 @@ install_cleanup() [[ $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 != 'xinit' && $INSTALL_WMS =~ (plasma|gnome|cinnamon|deepin)) ]]; then + 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 + # add ~/.local/bin to the PATH + echo \$PATH | grep -q "/home/$user/.local/bin:" || export PATH="/home/$user/.local/bin:\$PATH" + 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 + if [[ "${FAIL_PKG[*]}" ]]; then + echo "#!/bin/bash" > "$MNT/home/$user/packages" + echo "sudo pacman -Syyu ${FAIL_PKG[*]} --needed --noconfirm || exit" >> "$MNT/home/$user/packages" + echo "rm -f /home/%s/packages" "$user" >> "$MNT/home/$user/packages" + fi + + return 0 } install_bootldr() @@ -2003,13 +2061,16 @@ install_bootldr() install_packages() { - typeset -a inpkg rmpkg goodinpkg + typeset -ga FAIL_PKG=() + typeset -a inpkg=() rmpkg=() goodinpkg=() alpkg=() inpkg=("${SES_PKGS[@]}" "${USER_PKGS[@]}" "$NEWSHELL") if [[ $INSTALL_WMS ]]; then inpkg+=("${BASE_PKGS[@]}") - [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox|jwm|awesome) ]] && inpkg+=("${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") + (( WAYLAND == 1 )) || inpkg+=("${X_WM_PKGS[@]}") fi for i in ${LOGIN_PKGS[$LOGIN_TYPE]}; do @@ -2023,10 +2084,7 @@ install_packages() [[ $blk =~ xfs ]] && inpkg+=('xfsprogs') [[ $blk =~ reiserfs ]] <<< "$blk" && inpkg+=('reiserfsprogs') [[ $LVM ]] && inpkg+=('lvm2') - if [[ $BTRFS_MNT ]] || [[ $blk =~ btrfs ]]; then - inpkg+=('btrfs-progs') - fi - + [[ $BTRFS_MNT || $blk =~ btrfs ]] && inpkg+=('btrfs-progs') [[ $NEWSHELL == 'zsh' ]] && inpkg+=('zsh-completions') [[ $NEWSHELL =~ (bash|zsh) ]] && inpkg+=('bash-completion') [[ $INSTALL_WMS =~ dwm ]] && inpkg+=('git' 'make' 'gcc' 'pkgconf') @@ -2038,22 +2096,61 @@ install_packages() # install crucial packages first to avoid issues # reinstalling iputils fixes network issues for non-root users - chrun "pacman -S $KERNEL $UCODE iputils --noconfirm" 2> "$ERR" 2>&1 - errshow 1 "chrun 'pacman -S $KERNEL $UCODE iputils --noconfirm'" + chrun "pacman -Syyu $KERNEL $UCODE iputils --noconfirm" 2> "$ERR" 2>&1 + errshow 1 "chrun 'pacman -Syyu $KERNEL $UCODE iputils --noconfirm'" # install the packages chosen throughout the install plus any extras added # check that packages we're trying to install are available, slow as shit # but I'm done doing this manually every time the arch repos change for pkg in "${inpkg[@]}"; do if pacman -Ssq "^$pkg$" >/dev/null 2>&1; then - goodinpkg+=("$pkg") + if [[ $pkg =~ archlabs- ]]; then + # if it's an AL package we separate it and do an install for just them + alpkg+=("$pkg") + else + goodinpkg+=("$pkg") + fi else echo "package missing or no longer available: $pkg -- ignoring" + sleep 0.5 fi done chrun "pacman -S ${goodinpkg[*]} --needed --noconfirm" 2> "$ERR" 2>&1 errshow 1 "chrun 'pacman -S ${goodinpkg[*]} --needed --noconfirm'" + # install the ArchLabs packages, if it fails we'll inform the user and try again + if [[ ${alpkg[*]} ]] && ! chrun "pacman -S ${alpkg[*]} --needed --noconfirm" 2> "$ERR" 2>&1; then + skelpkg=() + restpkg=() + echo "An error occurred during ArchLabs package install... Retrying" + sleep 1 + # split skel packages from the rest + for pkg in "${alpkg[@]}"; do + if [[ $pkg =~ skel ]]; then + skelpkg+=("$pkg") + else + restpkg+=("$pkg") + fi + done + + if [[ "${skelpkg[*]}" ]]; then + # if the skel packages aren't installed the created user's home will be empty + chrun "pacman -S ${skelpkg[*]} --needed --noconfirm" 2> "$ERR" 2>&1 + errshow 1 "chrun 'pacman -S ${skelpkg[*]} --needed --noconfirm'" + fi + + # other packages can be installed after if they fail again + if ! chrun "pacman -Syyu ${restpkg[*]} --needed --noconfirm" 2> "$ERR" 2>&1; then + echo + echo "Unable to install ArchLabs packages... Creating package list at /home/$NEWUSER/packages" + echo + echo "On first boot run: bash ~/packages" + echo + FAIL_PKG=("${restpkg[@]}") + sleep 2 + fi + fi + # bootloader packages if [[ $BOOTLDR == 'grub' ]]; then chrun "pacman -S os-prober grub --needed --noconfirm" 2> "$ERR" 2>&1 @@ -2108,64 +2205,50 @@ install_suckless() install_tearfree() { - local xpath="$1" - if [[ $VIRT != 'none' ]]; then - [[ -e "$xpath/40-touchpad.conf" ]] && rm -fv "$xpath/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 if lspci | grep ' VGA ' | grep -q 'Intel'; then echo "Creating Intel Tear Free config /etc/X11/xorg.conf.d/20-intel.conf" - cat > "$xpath/20-intel.conf" <<- EOF + cat > "$MNT/etc/X11/xorg.conf.d/20-intel.conf" <<- EOF Section "Device" Identifier "Intel Graphics" Driver "intel" Option "TearFree" "true" EndSection EOF - cat "$xpath/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 echo "Creating AMD Tear Free config /etc/X11/xorg.conf.d/20-amdgpu.conf" - cat > "$xpath/20-amdgpu.conf" <<- EOF + cat > "$MNT/etc/X11/xorg.conf.d/20-amdgpu.conf" <<- EOF Section "Device" Identifier "AMD Graphics" Driver "amdgpu" Option "TearFree" "true" EndSection EOF - cat "$xpath/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 echo "Creating Radeon Tear Free config /etc/X11/xorg.conf.d/20-radeon.conf" - cat > "$xpath/20-radeon.conf" <<- EOF + cat > "$MNT/etc/X11/xorg.conf.d/20-radeon.conf" <<- EOF Section "Device" Identifier "AMD Graphics" Driver "radeon" Option "TearFree" "on" EndSection EOF - cat "$xpath/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 echo "Trying nvidia driver install" 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 - if [[ $xpath == *"$MNT"* ]]; then - chrun "nvidia-installer --bumblebee" - else - nvidia-installer --bumblebee - fi + chrun "nvidia-installer --bumblebee" else - if [[ $xpath == *"$MNT"* ]]; then - chrun "nvidia-installer" # unsure which card so try auto detection - else - nvidia-installer - fi + chrun "nvidia-installer" # unsure which card so try auto detection fi - if [[ -e $xpath/20-nvidia.conf ]]; then - cat "$xpath/20-nvidia.conf" + 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" - if [[ $xpath == *"$MNT"* ]]; then - echo "Trying to load the driver for live session" - nvidia-smi -r - fi 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 nvida xorg config /etc/X11/xorg.conf.d/20-nvidia.conf" @@ -2177,12 +2260,9 @@ install_tearfree() echo "Unknown video card - aborting driver setup" fi - if lspci | grep ' VGA ' | grep -q 'Intel\|AMD/ATI'; then - if [[ $xpath == *"$MNT"* && -f "$MNT/etc/skel/.config/picom.conf" ]]; then - sed -i 's/xrender/glx/g' "$MNT/etc/skel/.config/picom.conf" - elif [[ -f /etc/skel/.config/picom.conf ]]; then - sed -i 's/xrender/glx/g' /etc/skel/.config/picom.conf - 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 } @@ -2201,29 +2281,27 @@ install_mkinitcpio() install_mirrorlist() { - local url='' country='' ip_add='' + local url='' country='' ip='' local key="access_key=5f29642060ab983b31fdf4c2935d8c56" + typeset -a args=("--verbose" "--connection-timeout" "2" "--threads" "10") # avoid SSL errors when the time is wrong - timedatectl set-ntp 1 && timedatectl > /dev/null 2>&1 + timedatectl set-ntp 1 > /dev/null 2>&1 && timedatectl > /dev/null 2>&1 # 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 if hash reflector > /dev/null 2>&1; then if [[ $AUTO_MIRROR ]]; then - reflector --verbose --connection-timeout 2 --threads 10 \ - --latest 200 --age 24 --score 75 --sort rate --fastest 6 --save /etc/pacman.d/mirrorlist + reflector "${args[@]}" -l 250 -a 24 --score 100 --sort rate -f 5 --save /etc/pacman.d/mirrorlist else - reflector --verbose --connection-timeout 2 --threads 10 "${MIRROR_COUNTRY[@]}" \ - --latest 100 --age 24 --score 50 --sort rate --fastest 6 --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 else echo "Ranking mirrorlist, This may take a while..." if [[ $AUTO_MIRROR ]]; then - ip_add="$(curl -fsSL "http://api.ipstack.com/check&?$key&fields=ip" | - python -c "import sys, json; print(json.load(sys.stdin)['ip'])")" - country="$(curl -fsSL "http://api.ipstack.com/$ip_add?$key&fields=country_code" | + 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 @@ -2240,16 +2318,16 @@ install_mirrorlist() else url="$MIRROR_URL" fi - curl -fsSL "$url" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 6 - > /etc/pacman.d/mirrorlist + curl -fsSL "$url" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 - > /etc/pacman.d/mirrorlist fi + chmod +r /etc/pacman.d/mirrorlist } install_background() { - local luks='' net='networkmanager' key="9E4F11C6A072942A7B3FD3B0B81EB14A09A25EB0" + local luks='' key="9E4F11C6A072942A7B3FD3B0B81EB14A09A25EB0" - [[ ! -d /etc/NetworkManager/system-connections ]] && net='netctl' [[ $LUKS ]] && luks='cryptsetup' select_mirrors || AUTO_MIRROR=true @@ -2257,7 +2335,7 @@ install_background() install_mirrorlist > /tmp/bgout 2>&1 al_repo "/etc/pacman.conf" pacman -Syy >> /tmp/bgout 2>&1 - pacstrap /mnt >> /tmp/bgout 2>&1 + pacstrap /mnt base rsync >> /tmp/bgout 2>&1 cp -Rf /etc/pacman.d "$MNT/etc/" cp -f /etc/pacman.conf "$MNT/etc/" @@ -2271,13 +2349,14 @@ install_background() chrun "pacman-key --lsign-key '$key'" fi chrun "pacman -S archlinux-keyring archlabs-keyring --noconfirm" - chrun "pacman -S ${ISO_PKGS[*]} $net $luks --noconfirm --needed" + chrun "pacman -S ${ISO_PKGS[*]} $luks $NET_TYPE --noconfirm --needed" + } >> /tmp/bgout 2>&1 - if [[ $net == "networkmanager" ]]; then + if [[ $NET_TYPE == 'networkmanager' ]]; then chrun 'systemctl enable NetworkManager.service' >> /tmp/bgout 2>&1 else - chrun 'systemctl enable netctl.service' >> /tmp/bgout 2>&1 + chrun 'systemctl enable iwd.service' >> /tmp/bgout 2>&1 fi if [[ -e /tmp/wmlist ]]; then @@ -2295,9 +2374,20 @@ install_background() # these are called based on which DM is chosen after it is installed # additional config can be handled here, for now only lightdm and xinit. +config_ly() +{ + 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_gdm() { - : #TODO + 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() @@ -2309,21 +2399,16 @@ config_sddm() 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_xinit() +config_console() { - if [[ $INSTALL_WMS ]]; then - 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 - rm -rf "$MNT/home/$NEWUSER/.xinitrc" "$MNT/root/.xinitrc" - return 0 - fi + typeset ses='startx' back='x11' + [[ $LOGIN_WM =~ $WAYLAND_SESSIONS ]] && ses="$LOGIN_WM" back='wayland' if [[ $AUTOLOGIN ]]; then mkdir -p "$AUTOLOGIN_SERV" @@ -2336,14 +2421,39 @@ config_xinit() rm -rf "$AUTOLOGIN_SERV" fi - # run `startx` after logging in regardless of autologin - 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" + if [[ $INSTALL_WMS ]]; then + rm "$MNT/home/$NEWUSER/$LOGINRC" + if (( WAYLAND != 1 )); then + 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 + 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" + + # automatically run $ses when logging in on tty1 + [ -z "\$DISPLAY" ] && [ \$XDG_VTNR -eq 1 ] && $ses + EOF + else + rm -rf "$MNT/home/$NEWUSER/.xinitrc" "$MNT/root/.xinitrc" + return 0 + fi - # automatically run startx when logging in on tty1 - [ -z "\$DISPLAY" ] && [ \$XDG_VTNR -eq 1 ] && startx - EOF } config_lightdm() @@ -2399,6 +2509,10 @@ prerun_grub() sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" "$MNT/etc/default/grub" fi + # fix network interface names changing after reboot + # https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ + sed -i 's/\(GRUB_CMDLINE_LINUX=".*\)"/\1 net.ifnames=0"/g' "$MNT/etc/default/grub" + # setup for os-prober module mkdir -p /run/{lvm,udev} "$MNT/hostrun/"{lvm,udev} mount --bind /run/lvm "$MNT/hostrun/lvm" @@ -2421,7 +2535,7 @@ prerun_efistub() { BCMDS[efistub]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1 efibootmgr -v -d $BOOT_D -p $BOOT_NUM -c -L '${DIST} Linux' -l /vmlinuz-${KERNEL} \ - -u 'root=$ROOT_ID rw $( + -u 'root=$ROOT_ID rw net.ifnames=0 $( [[ $BTRFS_MNT ]] && printf '%s ' "$BTRFS_MNT" [[ $UCODE ]] && printf 'initrd=\%s.img ' "$UCODE" )initrd=\initramfs-${KERNEL}.img'" @@ -2449,7 +2563,7 @@ prerun_syslinux() mkdir -pv "$c" cp -rfv "$s/"* "$c/" - cp -fv "$RUN/syslinux/splash.png" "$c/" + cp -fv "/run/archiso/bootmnt/arch/boot/syslinux/splash.png" "$c/" cat > "$c/syslinux.cfg" <<- EOF UI vesamenu.c32 @@ -2481,13 +2595,13 @@ prerun_syslinux() LABEL $DIST MENU LABEL $DIST Linux LINUX $d/vmlinuz-$KERNEL - APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") + APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL.img LABEL ${DIST}fallback MENU LABEL $DIST Linux Fallback LINUX $d/vmlinuz-$KERNEL - APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") + APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL-fallback.img EOF return 0 @@ -2502,9 +2616,9 @@ setup_refind() 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 ]] && + "$DIST Linux" "root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $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 ]] && + "$DIST Linux Fallback" "root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") add_efi_memmap $([[ $UCODE ]] && printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-%v-fallback.img" EOF @@ -2543,14 +2657,14 @@ prerun_systemd-boot() title $DIST Linux linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img") initrd /initramfs-$KERNEL.img - options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") + options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") EOF cat > "$MNT/boot/loader/entries/${DIST,,}-fallback.conf" <<- EOF title $DIST Linux Fallback linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img") initrd /initramfs-$KERNEL-fallback.img - options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") + options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") EOF mkdir -pv "$MNT/etc/pacman.d/hooks" @@ -2597,7 +2711,7 @@ btrfs_mount() local subvol="$3" [[ $mntp == "$MNT" ]] && BTRFS_MNT="rootflags=subvol=$subvol" - select_mntopts "$part" 'btrfs' && [[ $MNT_OPTS ]] && MNT_OPTS+=',' + mount_opts "$part" 'btrfs' && [[ $MNT_OPTS ]] && MNT_OPTS+=',' mount -o ${MNT_OPTS}subvol="$subvol" "$part" "$mntp" 2> "$ERR" errshow 0 "mount -o ${MNT_OPTS}subvol=$subvol $part $mntp" || return 1 msg "Mount Complete" "\nMounted $part subvol=$subvol at $mntp\n" 1 @@ -3052,12 +3166,12 @@ dlg() menu) tput civis dialog --backtitle "$DIST - $SYS - v$VER" --title " $title " \ - --menu "$body" 0 0 $n "$@" 2> "$ANS" || return 1 + --menu "$body" 0 0 $n "$@" 2> "$ANS" || { tput cnorm; return 1; } ;; check) tput civis dialog --backtitle "$DIST - $SYS - v$VER" --title " $title " \ - --checklist "$body" 0 0 $n "$@" 2> "$ANS" || return 1 + --checklist "$body" 0 0 $n "$@" 2> "$ANS" || { tput cnorm; return 1; } ;; input) tput cnorm @@ -3093,91 +3207,14 @@ msg() fi } -live() -{ - local ses="$1" - - if ! select_keymap; then - clear - die 0 - elif ! net_connect; then - msg "Not Connected" "\nRunning live requires an active internet connection to install packages.\n\nExiting..\n" 2 - die 1 - fi - - m=$(awk '/MemTotal/ {print int($2 / 1000)}' /proc/meminfo) - case "$ses" in - plasma) - if (( m < 6650 )); then - msg "Not Enough Memory" "\nLive session requires at least 6.5G of system memory for installing packages.\n\nExiting..\n" 2 - die 1 - fi - s="6G" - ;; - *) - if (( m < 4600 )); then - msg "Not Enough Memory" "\nLive session requires at least 4.5G of system memory for installing packages.\n\nExiting..\n" 2 - die 1 - fi - s="4G" - ;; - esac - - clear - if ! mount /run/archiso/cowspace -o remount,size=$s; then - msg "Remount Fail" "\nUnable to remount root with a larger copy-on-write space, this is needed for installing packages.\n\nExiting..\n" 2 - die 1 - fi - [[ -f /etc/pacman.d/mirrorlist.bak ]] || { echo "Sorting mirrorlist"; install_mirrorlist; } - al_repo "/etc/pacman.conf" - tput cnorm - pacman -Syyu --noconfirm || exit 1 - rm -rf /var/cache/pacman/pkg/* # */ - pacman -S ${BASE_PKGS[*]} xorg-xinit --needed --noconfirm || exit 1 - rm -rf /var/cache/pacman/pkg/* # */ - case "$ses" in - openbox|bspwm|i3-gaps|fluxbox|jwm|awesome) - pacman -S "$ses" ${WM_PKGS[*]} ${WM_EXT[$ses]} --needed --noconfirm || exit 1 - ;; - gnome|cinnamon|deepin) - pacman -S "$ses" ${WM_EXT[$ses]} --needed --noconfirm || exit 1 - ;; - plasma) - pacman -S "$ses" --needed --noconfirm || exit 1 - ;; - dwm) - pacman -S git make gcc pkgconf --needed --noconfirm || exit 1 - install_suckless "/root" nochroot - ;; - esac - pacman -Scc --noconfirm - rm -rf /var/cache/pacman/pkg/* # */ - cp -rfT /etc/skel /root - install_tearfree "/etc/X11/xorg.conf.d" - case "$ses" in - plasma|gnome|cinnamon|deepin) - sed -i '/super/d; /nitrogen/d; /picom/d' /root/.xprofile - ;; - dwm) - sed -i '/super/d; /picom/d' /root/.xprofile - ;; - esac - rm -f /root/.zlogin - echo -e "pulseaudio &\n(sleep 1; pamixer --unmute --set-volume 50) &" >> /root/.xprofile - sed -i "/exec/ c exec ${WM_SESSIONS[$ses]}" /root/.xinitrc - printf "\n%s has been set as the login session in ~/.xinitrc, to start it run\n\n\tstartx\n\n" "$ses" - exit 0 -} - usage() { cat <<- EOF - usage: $1 [-cfhDn] [-r ROOT] [-b BOOT] [-l SESSION] [-d DISTRO] [-m MOUNTPOINT] + usage: $1 [-cfhDnt] [-r ROOT] [-b BOOT] [-d DISTRO] [-m MOUNTPOINT] options: -h print this message and exit -f skip setting the font size - -l install and setup a live session -D enable xtrace and log output to $DBG -c disable network connection tests -m set the mountpoint used for the new installation @@ -3188,20 +3225,6 @@ usage() -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 - sessions: - i3-gaps - A fork of i3wm with more features including gaps - openbox - A lightweight, powerful, and highly configurable stacking wm - dwm - A dynamic WM for X that manages windows in tiled, floating, or monocle layouts - awesome - A customized Awesome WM session created by @elanapan - lxqt - A port of the lightweight desktop environment (LXDE) to Qt - bspwm - A tiling wm that represents windows as the leaves of a binary tree - fluxbox - A lightweight and highly-configurable window manager - jwm - A lightweight window manager for Xorg written in C - gnome - A desktop environment that aims to be simple and easy to use - cinnamon - A desktop environment combining traditional desktop with modern effects - plasma - A kde software project currently comprising a full desktop environment - xfce4 - A lightweight and modular desktop environment based on gtk+2/3 - EOF exit 0 } @@ -3257,7 +3280,8 @@ zshrc() alias ll='ls -lAh' alias grep='grep --color=auto' alias grub-update='sudo grub-mkconfig -o /boot/grub/grub.cfg' - alias mirror-update='sudo reflector --verbose --score 100 -l 50 -f 10 --sort rate --save /etc/pacman.d/mirrorlist' + alias mirror-update='sudo reflector --verbose --connection-timeout 2 --threads 10 --latest 200 --age 24 --score 75 --sort rate --fastest 6 --save /etc/pacman.d/mirrorlist' + ls() # ls with preferred arguments { @@ -3451,7 +3475,7 @@ al_repo() { local conf="$1" - grep -q 'archlabs_repo' "$conf" 2> /dev/null && return 0 + grep -q '[archlabs]' "$conf" 2> /dev/null && return 0 if ! grep -q 'ILoveCandy' "$conf" 2> /dev/null; then sed -i 's/^#Color/Color/' "$conf" @@ -3460,13 +3484,14 @@ al_repo() cat >> "$conf" <<- EOF - # [archlabs_unstable] - # Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch + # [archlabs-testing] + # Server = https://github.com/ArchLabs/\$repo/raw/master/\$arch + # Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch - [archlabs_repo] + [archlabs] Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch + Server = https://github.com/ArchLabs/\$repo/raw/master/\$arch Server = https://sourceforge.net/projects/archlabs-repo/files/\$repo/\$arch - Server = https://github.com/ARCHLabs/\$repo/raw/master/\$arch EOF return 1 @@ -3680,7 +3705,7 @@ chk_connect() { if [[ ! -f /tmp/new ]]; then msg "Network Connect" "\nVerifying network connection\n" 0 - if [[ $VIRT != 'none' ]] && hash nm-online > /dev/null 2>&1; then + if [[ $VIRT != 'none' ]] && hash nm-online > /dev/null 2>&1 && [[ $(systemctl is-active NetworkManager.service) == "active" ]]; then nm-online > /dev/null 2>&1 else ping -qc1 'archlinux.org' > /dev/null 2>&1 @@ -3697,12 +3722,15 @@ net_connect() if [[ $TERM == 'linux' ]]; then printf "%b" "\e]P1191919" "\e]P4191919" # fix up the nasty default colours of nmtui nmtui-connect - printf "%b" "\e]P1D15355" "\e]P4255a9b" # restore defaults + termcol # restore defaults else nmtui-connect fi - elif hash wifi-menu > /dev/null 2>&1; then - wifi-menu + elif hash iwctl > /dev/null 2>&1; then + echo "To list available commands for iwd use the command: help" + echo "For more info see: https://wiki.archlinux.org/title/Iwd#Usage" + tput civis + iwctl else return 1 fi @@ -3760,6 +3788,12 @@ system_identify() else SYS="BIOS" fi + + if hash nmtui >/dev/null 2>&1; then + NET_TYPE=networkmanager + else + NET_TYPE=iwd + fi } ############################################################################### @@ -3786,10 +3820,10 @@ fi trap 'printf "\n^C\n" && die 1' INT -while getopts ":htcnrfD:b:m:d:l:" OPT; do +while getopts ":htcnrfD:b:m:d:" OPT; do case "$OPT" in D) debug ;; - h) usage "$0" ;; + h) usage "${0##*/}" ;; n) NOMOUNT=true ;; t) TEARFREE=true ;; m) MNT="$OPTARG" ;; @@ -3810,14 +3844,6 @@ while getopts ":htcnrfD:b:m:d:l:" OPT; do fi BOOT="$OPTARG" ;; - l) - if [[ "${!WM_SESSIONS[*]}" =~ $OPTARG ]]; then - live "$OPTARG" - else - echo "error: invalid session for -l, see -h for a list of available sessions" - die 1 - fi - ;; \?) echo "invalid option: $OPTARG" die 2 @@ -3882,8 +3908,16 @@ elif ! net_connect; then die 1 fi +mirrorpid='' + if [[ ! -f /tmp/new ]]; then - msg "Update" "\nChecking for newer installer versions.\n" 1 + msg "Update" "\nChecking for newer installer versions.\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 ) & + mirrorpid=$! + else + echo "$FBREF_COUNTRIES" > /tmp/mcountry + fi 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 cp /tmp/new /usr/bin/installer @@ -3893,6 +3927,7 @@ if [[ ! -f /tmp/new ]]; then fi fi + # warn before starting the background process if [[ $NOMOUNT ]]; then wrn="\nA background install process will begin early when using -n flag\n\nSome files may be overwritten during the process\n" @@ -3903,4 +3938,5 @@ fi while :; do main done + # vim:fdm=marker:fmr={,}