Remove lightdm, clean up a few spots

This commit is contained in:
natemaia 2019-04-17 18:24:09 -07:00
parent ae86ae676c
commit 3647d2956e

View File

@ -5,7 +5,7 @@
# Some ideas and code reworked from other resources # Some ideas and code reworked from other resources
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due # 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 DIST="ArchLabs" # linux distributor
MNT="/mnt" # install mountpoint MNT="/mnt" # install mountpoint
ANS="/tmp/ans" # dialog answer file ANS="/tmp/ans" # dialog answer file
@ -47,13 +47,12 @@ SWAP_SIZE=''
EXMNT='' # holder for additional partitions while mounting EXMNT='' # holder for additional partitions while mounting
EXMNTS='' # when an extra partition is mounted append it's info 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 HOOKS="shutdown" # list of additional HOOKS to add in /etc/mkinitcpio.conf
LOGINRC='' # login shell rc file, eg. .zprofile, .bash_profile, .profile LOGINRC='' # login shell rc file, eg. .zprofile, .bash_profile, .profile
LOGIN_WM='' # default login session, used only for xinit LOGIN_WM='' # default login session to be placed in ~/.xinitrc
LOGIN_TYPE='' # login manager can be: lightdm, xinit INSTALL_WMS='' # space separated list of chosen wm/de
INSTALL_WMS='' # space separated list of chosen wm and de
UCODE='' # cpu microcode (if any), eg. amd-ucode, intel-ucode UCODE='' # cpu microcode (if any), eg. amd-ucode, intel-ucode
KERNEL='' # can be linux, linux-lts, linux-zen, or linux-hardened 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 PACKAGES='' # list of all packages to install including WM_PKGS
USER_PKGS='' # packages selected by the user during install USER_PKGS='' # packages selected by the user during install
NEWUSER='' # username for the primary user NEWUSER='' # username for the new user
USER_PASS='' # password for the primary user USER_PASS='' # new user's password
ROOT_PASS='' # root 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_DEV='' # boot parameter string for LUKS
LUKS_PART='' # partition used for encryption LUKS_PART='' # partition used for encryption
LUKS_PASS='' # encryption password LUKS_PASS='' # encryption password
@ -75,8 +74,8 @@ LUKS_UUID='' # encrypted partition UUID
LUKS_NAME='' # name used for encryption LUKS_NAME='' # name used for encryption
LVM='' # empty when not using lvm LVM='' # empty when not using lvm
VGROUP_MB=0 # available space in volume group
LVM_PARTS='' # partitions used for volume group LVM_PARTS='' # partitions used for volume group
VGROUP_MB=0 # available space in volume group
WARN='' # issued mounting/partitioning warning WARN='' # issued mounting/partitioning warning
SEP_BOOT='' # separate boot partition for BIOS 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" AL_BASE_PKGS="archlabs-skel-base archlabs-fonts archlabs-themes archlabs-dARK archlabs-icons archlabs-wallpapers archlabs-scripts"
# 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 " 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" 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 xdg-user-dirs nitrogen polkit-gnome volumeicon xclip exo " 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" WM_BASE_PKGS+="xdotool compton wmctrl gnome-keyring dunst feh gsimplecal xfce4-power-manager xfce4-settings laptop-detect"
SEL=0 # currently selected menu item SEL=0 # currently selected menu item
ERR="/tmp/errlog" # error log used internally ERR="/tmp/errlog" # error log used internally
DBG="/tmp/debuglog" # debug log when passed -d DBG="/tmp/debuglog" # debug log when passed -d
@ -171,6 +171,7 @@ declare -A WM_SESSIONS=(
# packages installed for each wm/de { # packages installed for each wm/de {
declare -A WM_EXT=( declare -A WM_EXT=(
[dwm]=''
[gnome]='' [gnome]=''
[plasma]='kdebase-meta' [plasma]='kdebase-meta'
[bspwm]='sxhkd archlabs-skel-bspwm rofi archlabs-polybar' [bspwm]='sxhkd archlabs-skel-bspwm rofi archlabs-polybar'
@ -418,33 +419,21 @@ select_show()
select_login() select_login()
{ {
dlg LOGIN_TYPE menu "Login Management" "\nSelect which login management to use." \ if (( WM_NUM == 1 )); then
"xinit" "Console login without a display manager" \ LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
"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=''
else else
if (( WM_NUM == 1 )); then dlg LOGIN_WM menu "Login Session" "$_login" $LOGIN_CHOICES || return 1
LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}" LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}"
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"
fi 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() select_config()
{ {
local i=0 typeset -i i=0
CONFIG_DONE='' CONFIG_DONE=''
until [[ $CONFIG_DONE ]]; do until [[ $CONFIG_DONE ]]; do
@ -454,6 +443,7 @@ select_config()
/usr/bin/zsh 'A very advanced and programmable command interpreter (shell) for UNIX' \ /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' \ /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 /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; } ;; 1) dlg MYHOST input "Hostname" "$_hostname" "${DIST,,}" limit || { i=0; continue; } ;;
2) dlg MYLOCALE menu "Locale" "$_locale" $LOCALES || { i=1; 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-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-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; } linux-hardened 'A security-focused linux kernel with hardening patches to mitigate exploits' || { i=3; continue; }
CONFIG_DONE=true CONFIG_DONE=true
;; ;;
esac esac
(( i++ )) (( i++ )) # progress through to the next choice
done done
case $MYSHELL in case $MYSHELL in
@ -1108,7 +1099,6 @@ select_menu()
select_swap || return 1 select_swap || return 1
select_extra_partitions || return 1 select_extra_partitions || return 1
install_background || return 1 install_background || return 1
return 0 return 0
@ -1244,7 +1234,7 @@ select_boot_partition()
select_root_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" ROOT_PART="$AUTO_ROOT_PART"
elif (( COUNT == 1 )); then elif (( COUNT == 1 )); then
ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$PARTS")" ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$PARTS")"
@ -1264,7 +1254,7 @@ select_extra_partitions()
local part local part
while (( COUNT > 0 )); do while (( COUNT > 0 )); do
part='' 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 if [[ $part == 'done' ]]; then
break break
elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then
@ -1293,7 +1283,7 @@ install_main()
install_boot install_boot
chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa" chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa"
install_user install_user
install_login install_xinit
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER" chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
sleep 1 sleep 1
@ -1323,7 +1313,7 @@ install_main()
if [[ $exists ]]; then if [[ $exists ]]; then
vim -O $exists vim -O $exists
else 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
fi fi
done done
@ -1486,15 +1476,11 @@ install_user()
return 0 return 0
} }
install_login() install_xinit()
{ {
SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d" SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
sed -i '/printf/d' $MNT/root/.zshrc 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 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 sed -i "/exec/ c exec ${LOGIN_WM}" $MNT/home/$NEWUSER/.xinitrc
else else
@ -1518,26 +1504,6 @@ EOF
fi 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() install_packages()
{ {
local rmpkg="" local rmpkg=""
@ -1587,8 +1553,8 @@ install_suckless()
mkdir -pv $MNT/home/$NEWUSER/suckless mkdir -pv $MNT/home/$NEWUSER/suckless
for i in dwm dmenu st; do for i in dwm dmenu st; do
if chrun "git clone https://bitbucket.org/natemaia/$i /home/$NEWUSER/suckless/$i"; then if chrun "git clone https://git.suckless.org/$i /home/$NEWUSER/suckless/$i"; then
chrun "cd /home/$NEWUSER/suckless/$i; rm -f config.h; make clean install; make clean" chrun "cd /home/$NEWUSER/suckless/$i; make PREFIX=/usr install; make clean; rm config.h"
else else
printf "failed to clone %s repo\n" "$i" printf "failed to clone %s repo\n" "$i"
fi fi
@ -1604,7 +1570,11 @@ install_suckless()
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_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
@ -1657,7 +1627,7 @@ 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
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 luks_pass "$_luksopen" 1 || return 1
fi 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
@ -1679,12 +1649,14 @@ prerun_grub()
{ {
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g; sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $MNT/etc/default/grub s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $MNT/etc/default/grub
if [[ $LUKS_DEV ]]; then if [[ $LUKS_DEV ]]; then
sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; 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 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; 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" s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g' $MNT/etc/default/grub"
fi fi
if [[ $SYS == 'BIOS' && $LVM && -z $SEP_BOOT ]]; then 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 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" 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 debug
fi fi
trap sigint INT # ^C trap cleanup # trap ^C to perform cleanup
trap sigint INT
system_identify system_identify
system_devices system_devices