From 3647d2956ee8e071fc5b3717ff0ad46ae6dc82f0 Mon Sep 17 00:00:00 2001 From: natemaia Date: Wed, 17 Apr 2019 18:24:09 -0700 Subject: [PATCH] Remove lightdm, clean up a few spots --- archlabs-installer | 106 +++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 66 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index a0b685c..f3d6387 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.33" # installer version +VER="2.0.34" # installer version DIST="ArchLabs" # linux distributor MNT="/mnt" # install mountpoint ANS="/tmp/ans" # dialog answer file @@ -47,13 +47,12 @@ SWAP_SIZE='' EXMNT='' # holder for additional partitions while mounting EXMNTS='' # when an extra partition is mounted append it's info -FONT="ter-i16n" # font used in the linux console +FONT="ter-i16n" # font used for the linux console HOOKS="shutdown" # list of additional HOOKS to add in /etc/mkinitcpio.conf LOGINRC='' # login shell rc file, eg. .zprofile, .bash_profile, .profile -LOGIN_WM='' # default login session, used only for xinit -LOGIN_TYPE='' # login manager can be: lightdm, xinit -INSTALL_WMS='' # space separated list of chosen wm and de +LOGIN_WM='' # default login session to be placed in ~/.xinitrc +INSTALL_WMS='' # space separated list of chosen wm/de UCODE='' # cpu microcode (if any), eg. amd-ucode, intel-ucode KERNEL='' # can be linux, linux-lts, linux-zen, or linux-hardened @@ -63,11 +62,11 @@ WM_PKGS='' # full list of packages added during wm/de choice PACKAGES='' # list of all packages to install including WM_PKGS USER_PKGS='' # packages selected by the user during install -NEWUSER='' # username for the primary user -USER_PASS='' # password for the primary user +NEWUSER='' # username for the new user +USER_PASS='' # new user's password ROOT_PASS='' # root password -LUKS='' # empty when not using luks encryption +LUKS='' # empty when not using encryption LUKS_DEV='' # boot parameter string for LUKS LUKS_PART='' # partition used for encryption LUKS_PASS='' # encryption password @@ -75,8 +74,8 @@ LUKS_UUID='' # encrypted partition UUID LUKS_NAME='' # name used for encryption LVM='' # empty when not using lvm -VGROUP_MB=0 # available space in volume group LVM_PARTS='' # partitions used for volume group +VGROUP_MB=0 # available space in volume group WARN='' # issued mounting/partitioning warning SEP_BOOT='' # separate boot partition for BIOS @@ -99,13 +98,14 @@ ISO_BASE+="wpa_supplicant lm_sensors lsb-release p7zip pamixer reflector unrar r AL_BASE_PKGS="archlabs-skel-base archlabs-fonts archlabs-themes archlabs-dARK archlabs-icons archlabs-wallpapers archlabs-scripts" # baseline (usually installed in the background) -BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler " +BASE_PKGS="base-devel xorg xorg-drivers xorg-xinit sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler " 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 xdg-user-dirs nitrogen polkit-gnome volumeicon xclip exo " WM_BASE_PKGS+="xdotool compton wmctrl gnome-keyring dunst feh gsimplecal xfce4-power-manager xfce4-settings laptop-detect" + SEL=0 # currently selected menu item ERR="/tmp/errlog" # error log used internally DBG="/tmp/debuglog" # debug log when passed -d @@ -171,6 +171,7 @@ declare -A WM_SESSIONS=( # packages installed for each wm/de { declare -A WM_EXT=( +[dwm]='' [gnome]='' [plasma]='kdebase-meta' [bspwm]='sxhkd archlabs-skel-bspwm rofi archlabs-polybar' @@ -418,33 +419,21 @@ select_show() select_login() { - dlg LOGIN_TYPE menu "Login Management" "\nSelect which login management to use." \ - "xinit" "Console login without a display manager" \ - "lightdm" "Lightweight display manager with a gtk greeter" || return 1 - - if [[ $LOGIN_TYPE == 'lightdm' ]]; then - WM_PKGS+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice" - EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf" - AUTOLOGIN='' + if (( WM_NUM == 1 )); then + LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}" else - if (( WM_NUM == 1 )); then - LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}" - else - dlg LOGIN_WM menu "Login Management" "$_login" $LOGIN_CHOICES || return 1 - LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}" - fi - - local txt="\nDo you want autologin enabled for $NEWUSER?\n\nIf so the following two files will be created (disable autologin by remove them):\n\n - /home/$NEWUSER/$LOGINRC (this runs startx when logging in on tty1)\n - /etc/systemd/system/getty@tty1.service.d/autologin.conf (this logs in $NEWUSER without a password)\n" - - yesno "Autologin" "$txt" && AUTOLOGIN=true || AUTOLOGIN='' - WM_PKGS+=" xorg-xinit" - EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile" + dlg LOGIN_WM menu "Login Session" "$_login" $LOGIN_CHOICES || return 1 + LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}" fi + + local txt="\nDo you want autologin enabled for $NEWUSER?\n\nThe following two files will be created (disable autologin by remove them):\n\n - /home/$NEWUSER/$LOGINRC (this runs startx when logging in on tty1)\n - /etc/systemd/system/getty@tty1.service.d/autologin.conf (this logs in $NEWUSER without a password)\n" + yesno "Autologin" "$txt" && AUTOLOGIN=true || AUTOLOGIN='' + EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile" } select_config() { - local i=0 + typeset -i i=0 CONFIG_DONE='' until [[ $CONFIG_DONE ]]; do @@ -454,6 +443,7 @@ select_config() /usr/bin/zsh 'A very advanced and programmable command interpreter (shell) for UNIX' \ /bin/bash 'The GNU Bourne Again shell, standard in many GNU/Linux distributions' \ /usr/bin/mksh 'The MirBSD Korn Shell - an enhanced version of the public domain ksh' || return 1 + ;; 1) dlg MYHOST input "Hostname" "$_hostname" "${DIST,,}" limit || { i=0; continue; } ;; 2) dlg MYLOCALE menu "Locale" "$_locale" $LOCALES || { i=1; continue; } ;; @@ -470,10 +460,11 @@ select_config() 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-hardened 'A security-focused linux kernel with hardening patches to mitigate exploits' || { i=3; continue; } + CONFIG_DONE=true ;; esac - (( i++ )) + (( i++ )) # progress through to the next choice done case $MYSHELL in @@ -1108,7 +1099,6 @@ select_menu() select_swap || return 1 select_extra_partitions || return 1 - install_background || return 1 return 0 @@ -1244,7 +1234,7 @@ select_boot_partition() select_root_partition() { - if [[ $AUTO_ROOT_PART && ! $LVM && ! $LUKS ]]; then + if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then ROOT_PART="$AUTO_ROOT_PART" elif (( COUNT == 1 )); then ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$PARTS")" @@ -1264,7 +1254,7 @@ select_extra_partitions() local part while (( COUNT > 0 )); do part='' - dlg part menu 'Mount Boot' "$_expart" 'done' 'finish mounting step' $PARTS || break + 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 @@ -1293,7 +1283,7 @@ install_main() install_boot chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa" install_user - install_login + install_xinit chrun "chown -Rf $NEWUSER:users /home/$NEWUSER" sleep 1 @@ -1323,7 +1313,7 @@ install_main() if [[ $exists ]]; then vim -O $exists else - msg "File Error" "\nFile(s) do not exist.\n" + msg "File Missing" "\nThe file(s) selected do not exist:\n\n${EDIT_FILES[$choice]}\n" fi fi done @@ -1486,15 +1476,11 @@ install_user() return 0 } -install_login() +install_xinit() { SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d" sed -i '/printf/d' $MNT/root/.zshrc - install_${LOGIN_TYPE:-xinit} -} -install_xinit() -{ if [[ -e $MNT/home/$NEWUSER/.xinitrc ]] && grep -q 'exec' $MNT/home/$NEWUSER/.xinitrc; then sed -i "/exec/ c exec ${LOGIN_WM}" $MNT/home/$NEWUSER/.xinitrc else @@ -1518,26 +1504,6 @@ EOF fi } -install_lightdm() -{ - rm -rf $SERVICE - rm -rf $MNT/home/$NEWUSER/.{xinitrc,profile,zprofile,bash_profile} - chrun 'systemctl set-default graphical.target && systemctl enable lightdm.service' 2>$ERR - errshow 1 "systemctl set-default graphical.target && systemctl enable lightdm.service" - cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF -# LightDM GTK+ Configuration - -[greeter] -active-monitor=0 -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 -} - install_packages() { local rmpkg="" @@ -1587,8 +1553,8 @@ install_suckless() mkdir -pv $MNT/home/$NEWUSER/suckless for i in dwm dmenu st; do - if chrun "git clone https://bitbucket.org/natemaia/$i /home/$NEWUSER/suckless/$i"; then - chrun "cd /home/$NEWUSER/suckless/$i; rm -f config.h; make clean install; make clean" + if chrun "git clone https://git.suckless.org/$i /home/$NEWUSER/suckless/$i"; then + chrun "cd /home/$NEWUSER/suckless/$i; make PREFIX=/usr install; make clean; rm config.h" else printf "failed to clone %s repo\n" "$i" fi @@ -1604,7 +1570,11 @@ install_suckless() 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 @@ -1657,7 +1627,7 @@ setup_grub() [[ $BOOT_DEV ]] || { part_device 1 || return 1; } BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_DEV" else - if [[ $ROOT_PART == */dev/mapper/* && ! $LVM && ! $LUKS_PASS ]]; then + 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 @@ -1679,12 +1649,14 @@ prerun_grub() { sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g; s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $MNT/etc/default/grub + if [[ $LUKS_DEV ]]; then sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $MNT/etc/default/grub 2>$ERR errshow 1 "sed -i 's~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g' $MNT/etc/default/grub" fi + if [[ $SYS == 'BIOS' && $LVM && -z $SEP_BOOT ]]; then sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" $MNT/etc/default/grub 2>$ERR errshow 1 "sed -i 's/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g' $MNT/etc/default/grub" @@ -2518,7 +2490,9 @@ elif [[ $1 =~ (-d|--debug) ]]; then debug fi -trap sigint INT # ^C trap cleanup +# trap ^C to perform cleanup +trap sigint INT + system_identify system_devices