diff --git a/archlabs-installer b/archlabs-installer index e06f1b1..00341ca 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -5,7 +5,7 @@ # Some ideas and code reworked from other resources # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due -VER=2.0.73 +VER=2.0.74 # bulk default values { @@ -23,17 +23,21 @@ RUN=/run/archiso/bootmnt/arch/boot # path for live system /boot VM="$(dmesg | grep -i hypervisor)" # system running in a virtual machine export DIALOGOPTS="--cr-wrap" # see `man dialog` -BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 libmad libmatroska " -BASE_PKGS+="tumbler playerctl pulseaudio pulseaudio-alsa pavucontrol pamixer scrot " -BASE_PKGS+="xdg-user-dirs ffmpeg gstreamer gst-libav gst-plugins-base gst-plugins-good" -AL_BASE_PKGS="archlabs-skel-base archlabs-fonts archlabs-themes " -AL_BASE_PKGS+="archlabs-icons archlabs-wallpapers archlabs-scripts archlabs-baph" +BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 libmad libmatroska tumbler " +BASE_PKGS+="playerctl pulseaudio pulseaudio-alsa pavucontrol pamixer scrot xdg-user-dirs " +BASE_PKGS+="ffmpeg gstreamer gst-libav gst-plugins-base gst-plugins-good bash-completion " + +AL_BASE_PKGS="archlabs-icons archlabs-fonts archlabs-themes archlabs-baph " +AL_BASE_PKGS+="archlabs-wallpapers archlabs-scripts archlabs-skel-base" + WM_BASE_PKGS="arandr archlabs-networkmanager-dmenu nitrogen polkit-gnome " WM_BASE_PKGS+="volumeicon xclip exo laptop-detect xdotool compton wmctrl feh " WM_BASE_PKGS+="gnome-keyring dunst gsimplecal xfce4-power-manager xfce4-settings" + SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024) "M"}' /proc/meminfo)" LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if ($1) {print $1 " - "}}' /etc/locale.gen)" CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " - "}' | sort)" + [[ $LINES ]] || LINES=$(tput lines) [[ $COLUMNS ]] || COLUMNS=$(tput cols) @@ -353,7 +357,7 @@ select_mkuser() # make sure a username was entered and that the passwords match if [[ ${#u} -eq 0 || $u =~ \ |\' || $u =~ [^a-z0-9] ]]; then - msg "Invalid Username" "\nIncorrect user name.\n\nPlease try again.\n"; u='' + msg "Invalid Username" "\nInvalid user name.\n\nPlease try again.\n"; u='' elif [[ -z $p ]]; then msg "Empty Password" "\nThe user password cannot be left empty.\n\nPlease try again.\n" elif [[ "$p" != "$p2" ]]; then @@ -399,10 +403,10 @@ select_keymap() dlg CMAP menu "Console Keymap" "$_vconsole" $CMAPS || return 1 fi - if [[ $DISPLAY && $TERM != 'linux' ]]; then - setxkbmap "$KEYMAP" >/dev/null 2>&1 - else + if [[ $TERM == 'linux' ]]; then loadkeys "$CMAP" >/dev/null 2>&1 + else + setxkbmap "$KEYMAP" >/dev/null 2>&1 fi return 0 @@ -429,9 +433,6 @@ select_sessions() WM_PKGS="${WM_PKGS// / }" # remove double spaces WM_PKGS="${WM_PKGS# }" # remove leading space - # add archlabs base when choosing any session - [[ $WM_PKGS ]] && WM_PKGS+=" $AL_BASE_PKGS" - for i in $INSTALL_WMS; do LOGIN_CHOICES+="$i - " [[ ${WM_EXT[$i]} && $WM_PKGS != *"${WM_EXT[$i]}"* ]] && WM_PKGS+=" ${WM_EXT[$i]}" @@ -1358,13 +1359,15 @@ install_user() done fi - [[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> $MNT/home/$NEWUSER/.xprofile + [[ $MYSHELL != 'bash' ]] && rm -f "$MNT/home/$NEWUSER/.bash_profile" + [[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> "$MNT/home/$NEWUSER/.xprofile" # remove some commands from ~/.xprofile when using KDE or Gnome as the login session - if [[ $LOGIN_WM =~ (startkde|gnome-session) || ($LOGIN_TYPE =~ (lightdm|ly) && $WM_PKGS =~ (plasma|gnome)) ]]; then - sed -i '/super/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile - sed -i '/nitrogen/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile - sed -i '/compton/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile + if [[ $LOGIN_WM =~ (startkde|gnome-session) || ($LOGIN_TYPE != 'xinit' && $WM_PKGS =~ (plasma|gnome)) ]]; then + sed -i '/super/d; /nitrogen/d; /compton/d' "$MNT/home/$NEWUSER/.xprofile" "$MNT/root/.xprofile" + elif [[ $INSTALL_WMS == 'dwm' ]]; then + # and dwm + sed -i '/super/d; /compton/d' "$MNT/home/$NEWUSER/.xprofile" "$MNT/root/.xprofile" fi # create user home directories (Music, Documents, Downloads, etc..) @@ -1382,17 +1385,7 @@ install_login() rm -rf "$serv" "$MNT/home/$NEWUSER/.xinitrc" chrun "systemctl enable $LOGIN_TYPE.service" 2>$ERR errshow 1 "systemctl enable $LOGIN_TYPE.service" - if [[ $LOGIN_TYPE == 'lightdm' ]]; then - cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf <<- EOF - [greeter] - default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png - background=/usr/share/backgrounds/archlabs/archlabs.jpg - theme-name=Adwaita-dark - icon-theme-name=Adwaita - font-name=DejaVu Sans Mono 11 - position=30%,end 50%,end - EOF - fi + ${LOGIN_TYPE}_config ;; xinit) if [[ $INSTALL_WMS ]]; then @@ -1405,7 +1398,7 @@ install_login() sed -i "s/root/${NEWUSER}/g" $serv/autologin.conf cat > "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF # automatically run startx when logging in on tty1 - [ -z \$DISPLAY ] && [ \$XDG_VTNR -eq 1 ] && exec startx + [ -z "\$DISPLAY" ] && [ \$XDG_VTNR -eq 1 ] && startx EOF else rm -rf $serv @@ -1417,28 +1410,29 @@ install_login() install_packages() { local rmpkg="archlabs-installer " - local inpkg="$BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $PACKAGES $USER_PKGS " + local inpkg="$PACKAGES $USER_PKGS $AL_BASE_PKGS " - case $MYSHELL in zsh) inpkg+="zsh-completions " ;; mksh) inpkg+="mksh " rmpkg+="zsh " ;; bash) inpkg+="bash-completion " rmpkg+="zsh " ;; esac - - # using a different kernel, remove the stock one - [[ $KERNEL != 'linux' ]] && inpkg+="$KERNEL " rmpkg+="linux " - - # don't install extras on dwm only installs - if [[ $INSTALL_WMS != 'dwm' ]]; then - # gnome, plasma, and cinnamon have their own superkey bind and ksuperkey conflicts - [[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+="archlabs-ksuperkey " - # window manager only packages - [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox) ]] && inpkg+="$WM_BASE_PKGS " + if [[ $MYSHELL == 'zsh' ]]; then + inpkg+="zsh-completions " else - inpkg+="arandr nitrogen polkit-gnome xclip xdotool compton gnome-keyring dunst feh " + rmpkg+="zsh " fi - # update first to avoid issues - chrun "pacman -Syyu --noconfirm" + [[ $KERNEL != 'linux' ]] && rmpkg+='linux ' + + if [[ $INSTALL_WMS == 'dwm' ]]; then + inpkg+="nitrogen polkit-gnome xclip gnome-keyring dunst feh " + else + [[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+="archlabs-ksuperkey " + [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox) ]] && inpkg+="$WM_BASE_PKGS " + fi + + # update and install crucial packages first to avoid issues + chrun "pacman -Syyu $KERNEL $BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed" 2>$ERR + errshow 1 "pacman -Syyu $KERNEL $BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed" # remove the packages we don't want on the installed system - [[ $rmpkg ]] && chrun "pacman -Rnsc $rmpkg --noconfirm" + chrun "pacman -Rnsc $rmpkg --noconfirm" # reinstalling iputils fixes the network issue for non-root users chrun "pacman -S iputils $UCODE --noconfirm" @@ -1511,6 +1505,39 @@ install_background() trap "kill $BG_PID 2>/dev/null" EXIT } +############################################################################### +# display manager config +# these are called based on which DM is chosen after it is installed +# additional config can be handled here, for now only lightdm has one + +lightdm_config() +{ + cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf <<- EOF + [greeter] + default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png + background=/usr/share/backgrounds/archlabs/archlabs.jpg + theme-name=Adwaita-dark + icon-theme-name=Adwaita + font-name=DejaVu Sans Mono 11 + position=30%,end 50%,end + EOF +} + +ly_config() +{ + : +} + +gdm_config() +{ + : +} + +sddm_config() +{ + : +} + ############################################################################### # bootloader setup # prerun_* set up the configs needed before actually running the commands