From ff1002624b94a2ab60390667e13a6fde8471efcf Mon Sep 17 00:00:00 2001 From: natemaia Date: Fri, 30 Aug 2019 18:59:30 -0700 Subject: [PATCH] Don't install junk for dwm, cleanup some messy sections --- archlabs-installer | 133 +++++++++++++++------------------------------ 1 file changed, 43 insertions(+), 90 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index 1d6aff7..2b9b7ca 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -14,8 +14,7 @@ # will result in "My Distro Linux" used where needed : ${DIST="ArchLabs"} - -VER="2.0.63" # installer version +VER="2.0.64" # installer version MNT="/mnt" # install mountpoint ANS="/tmp/ans" # dialog answer file @@ -101,7 +100,7 @@ AL_BASE_PKGS="archlabs-skel-base archlabs-fonts archlabs-themes archlabs-dARK ar # baseline (usually installed in the background) BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler xdg-user-dirs " -BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good scrot bash-completion" +BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good scrot" # extras for window managers WM_BASE_PKGS="arandr archlabs-networkmanager-dmenu nitrogen polkit-gnome volumeicon xclip exo laptop-detect " @@ -419,14 +418,12 @@ select_login() AUTOLOGIN='' # no autologin unless using xinit - if [[ -z $LOGIN_TYPE ]]; then - dlg LOGIN_TYPE menu "Login Management" "\nSelect what kind of login management to use." \ - "xinit" "Console login without a display manager" \ - "ly" "TUI display manager with a ncurses-like interface" \ - "lightdm" "Lightweight display manager with a gtk greeter" \ - "gdm" "Gnome display manager" \ - "sddm" "Simple desktop display manager" || return 1 - fi + dlg LOGIN_TYPE menu "Login Management" "\nSelect what kind of login management to use." \ + "xinit" "Console login without a display manager" \ + "ly" "TUI display manager with a ncurses-like interface" \ + "lightdm" "Lightweight display manager with a gtk greeter" \ + "gdm" "Gnome display manager" \ + "sddm" "Simple desktop display manager" || return 1 case $LOGIN_TYPE in ly) EDIT_FILES[login]="/etc/ly/config.ini" ;; @@ -692,7 +689,7 @@ select_packages() xterm "The standard terminal emulator for the X window system" "$(ofn xterm "${USER_PKGS[*]}")" \ zathura "Minimalistic document viewer" "$(ofn zathura "${USER_PKGS[*]}")" - if [[ $USER_PKGS ]]; then + if [[ $USER_PKGS ]]; then # add any needed PKG_EXT to the list for i in $USER_PKGS; do [[ ${PKG_EXT[$i]} && $USER_PKGS != *"${PKG_EXT[$i]}"* ]] && USER_PKGS+=" ${PKG_EXT[$i]}" done @@ -1408,6 +1405,7 @@ install_base() if [[ $VM ]]; then find $MNT/etc/X11/xorg.conf.d/ -name '*.conf' -delete elif lspci | grep ' VGA ' | grep -q 'Intel'; then + echo "Creating Intel VGA Tear Free config /etc/X11/xorg.conf.d/20-intel.conf" cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<- EOF Section "Device" Identifier "Intel Graphics" @@ -1504,7 +1502,6 @@ install_boot() install_user() { - echo "Creating new user $NEWUSER and setting password" rm -f $MNT/root/.zshrc # remove welcome message from root zshrc chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR @@ -1516,6 +1513,7 @@ install_user() [[ $MYSHELL == '/usr/bin/mksh' ]] && cp -fv $MNT/etc/skel/.mkshrc $MNT/root/.mkshrc fi + echo "Creating new user $NEWUSER and setting password" local groups='audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' chrun "useradd -m -u 1000 -g users -G $groups -s $MYSHELL $NEWUSER" 2>$ERR @@ -1531,7 +1529,6 @@ install_user() fi [[ $INSTALL_WMS == *dwm* ]] && install_suckless - [[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> $MNT/home/$NEWUSER/.xprofile # remove some commands from ~/.xprofile when using KDE or Gnome as the login session @@ -1550,9 +1547,7 @@ install_user() install_login() { local serv="$MNT/etc/systemd/system/getty@tty1.service.d" - echo "Setting up $LOGIN_TYPE" - case $LOGIN_TYPE in ly|sddm|gdm|lightdm) rm -rf "$serv" "$MNT/home/$NEWUSER/.xinitrc" @@ -1595,29 +1590,25 @@ install_packages() local rmpkg="archlabs-installer " local inpkg="$BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $PACKAGES $USER_PKGS " - # add extra packages chosen throughout the install - if [[ $MYSHELL == '/usr/bin/zsh' ]]; then - inpkg+="zsh-completions " - else - rmpkg+="zsh " - [[ $MYSHELL == '/usr/bin/mksh' ]] && inpkg+="mksh " - fi + 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 - if [[ $KERNEL != 'linux' ]]; then - inpkg+="$KERNEL " - rmpkg+="linux " + [[ $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 " + else + inpkg+="arandr nitrogen polkit-gnome xclip xdotool compton gnome-keyring dunst feh " fi - # 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|dwm|fluxbox) ]] && inpkg+="$WM_BASE_PKGS " - - # ensure a terminal gets installed if one wasn't chosen or a DE that installs one - [[ $inpkg =~ (term|urxvt|tilix|alacritty|sakura|tilda|plasma|cinnamon) || $INSTALL_WMS == *dwm* ]] || inpkg+="xterm " - # update first to avoid issues chrun "pacman -Syyu --noconfirm" @@ -1661,22 +1652,11 @@ install_suckless() printf "failed to clone %s repo\n" "$i" fi done - - if [[ -x $MNT/usr/bin/dwm ]]; then - printf "To configure dwm edit %s\n" "/home/$NEWUSER/suckless/dwm/config.h" - printf "You can then recompile it with 'sudo make clean install'\n" - sleep 2 - fi } install_mkinitcpio() { local add='' - - # luks keyfile creation - # currently not used due to not prompting for passphrase on startup - # [[ $LUKS_UUID && $LUKS_PASS && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile - [[ $LUKS ]] && add="encrypt" [[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; } sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" $MNT/etc/mkinitcpio.conf @@ -1739,10 +1719,6 @@ setup_grub() [[ $BOOT_DEV ]] || { part_device 1 || return 1; } BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_DEV" else - # since we're not using the keyfile this is dead code - # if [[ $ROOT_PART == */dev/mapper/* && -z $LVM && -z $LUKS_PASS ]]; then - # luks_pass "$_luksopen" 1 || return 1 - # fi BCMDS[grub]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars >/dev/null 2>&1 grub-install --recheck --force --target=x86_64-efi --efi-directory=/$BOOTDIR --bootloader-id=$DIST" grep -q /sys/firmware/efi/efivars /proc/mounts || mount -t efivarfs efivarfs /sys/firmware/efi/efivars >/dev/null 2>&1 @@ -2272,22 +2248,6 @@ luks_basic() return 0 } -luks_keyfile() -{ - if [[ ! -e $MNT/crypto_keyfile.bin ]]; then - # printf "Creating LUKS keyfile /crypto_keyfile.bin\n" - local n - n="$(lsblk -lno NAME,UUID,TYPE | awk "/$LUKS_UUID/"' && /part|crypt|lvm/ {print $1}')" - local mkkey="dd bs=512 count=8 if=/dev/urandom of=/crypto_keyfile.bin" - mkkey="$mkkey && chmod 000 /crypto_keyfile.bin" - mkkey="$mkkey && cryptsetup luksAddKey /dev/$n /crypto_keyfile.bin <<< '$LUKS_PASS'" - chrun "$mkkey" - sed -i 's/FILES=()/FILES=(\/crypto_keyfile.bin)/g' $MNT/etc/mkinitcpio.conf 2>$ERR - fi - - return 0 -} - luks_advanced() { if luks_setup; then @@ -2312,7 +2272,6 @@ luks_advanced() ofn() { - # does $2 contain $1 [[ "$2" == *"$1"* ]] && printf "on" || printf "off" } @@ -2464,26 +2423,19 @@ errshow() (( $1 == 1 )) && { fatal=1; shift; } - local txt="\nThe command exited abnormally:\n\n$1\n\n" - if [[ $err ]]; then - txt+="With the following message:\n\n$err\n\n" + local txt+="\nThe command exited abnormally:\n\n$1\n\nWith the following message:\n\n$err\n\n" else - txt+="With no error message:\n\n" + local txt+="\nThe command exited abnormally:\n\n$1\n\nWith no error message:\n\n" fi if (( fatal )); then - txt+="Errors at this stage are fatal and the install cannot continue.\n" - else - txt+="Errors at this stage are non-fatal and can be either fixed or ignored depending on the error.\n" - fi - msg "Install Error" "$txt" - - if (( fatal )); then + msg "Install Error" "${txt}Errors at this stage are fatal and the install cannot continue.\n" [[ -r $DBG && $TERM == 'linux' ]] && less "$DBG" die 1 fi + msg "Install Error" "${txt}Errors at this stage are non-fatal and can be either fixed or ignored depending on the error.\n" return 1 } @@ -2526,20 +2478,21 @@ net_connect() { if chk_connect; then return 0 - else - if hash nmtui >/dev/null 2>&1; then - tput civis - if [[ $TERM == 'linux' ]]; then - printf "%b" "\e]P1191919" "\e]P4191919" - nmtui-connect - printf "%b" "\e]P1D15355" "\e]P4255a9b" - else - nmtui-connect - fi - chk_connect + elif hash nmtui >/dev/null 2>&1; then + tput civis + if [[ $TERM == 'linux' ]]; then + printf "%b" "\e]P1191919" "\e]P4191919" + nmtui-connect + printf "%b" "\e]P1D15355" "\e]P4255a9b" else - return 1 + nmtui-connect fi + chk_connect + elif hash wifi-menu >dev/null 2>&1; then + wifi-menu + chk_connect + else + return 1 fi }