Don't install junk for dwm, cleanup some messy sections

This commit is contained in:
natemaia 2019-08-30 18:59:30 -07:00
parent 741ae95e59
commit ff1002624b

View File

@ -14,8 +14,7 @@
# will result in "My Distro Linux" used where needed # will result in "My Distro Linux" used where needed
: ${DIST="ArchLabs"} : ${DIST="ArchLabs"}
VER="2.0.64" # installer version
VER="2.0.63" # installer version
MNT="/mnt" # install mountpoint MNT="/mnt" # install mountpoint
ANS="/tmp/ans" # dialog answer file 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) # 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="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 # extras for window managers
WM_BASE_PKGS="arandr archlabs-networkmanager-dmenu nitrogen polkit-gnome volumeicon xclip exo laptop-detect " 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 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." \
dlg LOGIN_TYPE menu "Login Management" "\nSelect what kind of login management to use." \ "xinit" "Console login without a display manager" \
"xinit" "Console login without a display manager" \ "ly" "TUI display manager with a ncurses-like interface" \
"ly" "TUI display manager with a ncurses-like interface" \ "lightdm" "Lightweight display manager with a gtk greeter" \
"lightdm" "Lightweight display manager with a gtk greeter" \ "gdm" "Gnome display manager" \
"gdm" "Gnome display manager" \ "sddm" "Simple desktop display manager" || return 1
"sddm" "Simple desktop display manager" || return 1
fi
case $LOGIN_TYPE in case $LOGIN_TYPE in
ly) EDIT_FILES[login]="/etc/ly/config.ini" ;; 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[*]}")" \ xterm "The standard terminal emulator for the X window system" "$(ofn xterm "${USER_PKGS[*]}")" \
zathura "Minimalistic document viewer" "$(ofn zathura "${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 for i in $USER_PKGS; do
[[ ${PKG_EXT[$i]} && $USER_PKGS != *"${PKG_EXT[$i]}"* ]] && USER_PKGS+=" ${PKG_EXT[$i]}" [[ ${PKG_EXT[$i]} && $USER_PKGS != *"${PKG_EXT[$i]}"* ]] && USER_PKGS+=" ${PKG_EXT[$i]}"
done done
@ -1408,6 +1405,7 @@ install_base()
if [[ $VM ]]; then if [[ $VM ]]; then
find $MNT/etc/X11/xorg.conf.d/ -name '*.conf' -delete find $MNT/etc/X11/xorg.conf.d/ -name '*.conf' -delete
elif lspci | grep ' VGA ' | grep -q 'Intel'; then 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 cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<- EOF
Section "Device" Section "Device"
Identifier "Intel Graphics" Identifier "Intel Graphics"
@ -1504,7 +1502,6 @@ install_boot()
install_user() install_user()
{ {
echo "Creating new user $NEWUSER and setting password"
rm -f $MNT/root/.zshrc # remove welcome message from root zshrc rm -f $MNT/root/.zshrc # remove welcome message from root zshrc
chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR 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 [[ $MYSHELL == '/usr/bin/mksh' ]] && cp -fv $MNT/etc/skel/.mkshrc $MNT/root/.mkshrc
fi fi
echo "Creating new user $NEWUSER and setting password"
local groups='audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' 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 chrun "useradd -m -u 1000 -g users -G $groups -s $MYSHELL $NEWUSER" 2>$ERR
@ -1531,7 +1529,6 @@ install_user()
fi fi
[[ $INSTALL_WMS == *dwm* ]] && install_suckless [[ $INSTALL_WMS == *dwm* ]] && install_suckless
[[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> $MNT/home/$NEWUSER/.xprofile [[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> $MNT/home/$NEWUSER/.xprofile
# remove some commands from ~/.xprofile when using KDE or Gnome as the login session # remove some commands from ~/.xprofile when using KDE or Gnome as the login session
@ -1550,9 +1547,7 @@ install_user()
install_login() install_login()
{ {
local serv="$MNT/etc/systemd/system/getty@tty1.service.d" local serv="$MNT/etc/systemd/system/getty@tty1.service.d"
echo "Setting up $LOGIN_TYPE" echo "Setting up $LOGIN_TYPE"
case $LOGIN_TYPE in case $LOGIN_TYPE in
ly|sddm|gdm|lightdm) ly|sddm|gdm|lightdm)
rm -rf "$serv" "$MNT/home/$NEWUSER/.xinitrc" rm -rf "$serv" "$MNT/home/$NEWUSER/.xinitrc"
@ -1595,29 +1590,25 @@ install_packages()
local rmpkg="archlabs-installer " local rmpkg="archlabs-installer "
local inpkg="$BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $PACKAGES $USER_PKGS " local inpkg="$BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $PACKAGES $USER_PKGS "
# add extra packages chosen throughout the install case $MYSHELL in
if [[ $MYSHELL == '/usr/bin/zsh' ]]; then *zsh) inpkg+="zsh-completions " ;;
inpkg+="zsh-completions " *mksh) inpkg+="mksh " rmpkg+="zsh " ;;
else *bash) inpkg+="bash-completion " rmpkg+="zsh " ;;
rmpkg+="zsh " esac
[[ $MYSHELL == '/usr/bin/mksh' ]] && inpkg+="mksh "
fi
# using a different kernel, remove the stock one # using a different kernel, remove the stock one
if [[ $KERNEL != 'linux' ]]; then [[ $KERNEL != 'linux' ]] && inpkg+="$KERNEL " rmpkg+="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 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 # update first to avoid issues
chrun "pacman -Syyu --noconfirm" chrun "pacman -Syyu --noconfirm"
@ -1661,22 +1652,11 @@ install_suckless()
printf "failed to clone %s repo\n" "$i" printf "failed to clone %s repo\n" "$i"
fi fi
done 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() install_mkinitcpio()
{ {
local add='' 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" [[ $LUKS ]] && add="encrypt"
[[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; } [[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; }
sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" $MNT/etc/mkinitcpio.conf 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; } [[ $BOOT_DEV ]] || { part_device 1 || return 1; }
BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_DEV" BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_DEV"
else 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 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" 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 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 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() luks_advanced()
{ {
if luks_setup; then if luks_setup; then
@ -2312,7 +2272,6 @@ luks_advanced()
ofn() ofn()
{ {
# does $2 contain $1
[[ "$2" == *"$1"* ]] && printf "on" || printf "off" [[ "$2" == *"$1"* ]] && printf "on" || printf "off"
} }
@ -2464,26 +2423,19 @@ errshow()
(( $1 == 1 )) && { fatal=1; shift; } (( $1 == 1 )) && { fatal=1; shift; }
local txt="\nThe command exited abnormally:\n\n$1\n\n"
if [[ $err ]]; then 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 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 fi
if (( fatal )); then if (( fatal )); then
txt+="Errors at this stage are fatal and the install cannot continue.\n" msg "Install Error" "${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
[[ -r $DBG && $TERM == 'linux' ]] && less "$DBG" [[ -r $DBG && $TERM == 'linux' ]] && less "$DBG"
die 1 die 1
fi 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 return 1
} }
@ -2526,20 +2478,21 @@ net_connect()
{ {
if chk_connect; then if chk_connect; then
return 0 return 0
else elif hash nmtui >/dev/null 2>&1; then
if hash nmtui >/dev/null 2>&1; then tput civis
tput civis if [[ $TERM == 'linux' ]]; then
if [[ $TERM == 'linux' ]]; then printf "%b" "\e]P1191919" "\e]P4191919"
printf "%b" "\e]P1191919" "\e]P4191919" nmtui-connect
nmtui-connect printf "%b" "\e]P1D15355" "\e]P4255a9b"
printf "%b" "\e]P1D15355" "\e]P4255a9b"
else
nmtui-connect
fi
chk_connect
else else
return 1 nmtui-connect
fi fi
chk_connect
elif hash wifi-menu >dev/null 2>&1; then
wifi-menu
chk_connect
else
return 1
fi fi
} }