Revert removal of lightdm

This commit is contained in:
natemaia 2019-04-21 12:32:42 -07:00
parent 40d1078af0
commit fde57308e3

View File

@ -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.41" # installer version
VER="2.0.42" # installer version
DIST="ArchLabs" # linux distributor
MNT="/mnt" # install mountpoint
ANS="/tmp/ans" # dialog answer file
@ -52,6 +52,7 @@ 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 to be placed in ~/.xinitrc
LOGIN_TYPE='' # login manager can be: lightdm, xinit
INSTALL_WMS='' # space separated list of chosen wm/de
UCODE='' # cpu microcode (if any), eg. amd-ucode, intel-ucode
@ -368,6 +369,7 @@ select_show()
local pkgs="${USER_PKGS// / } ${PACKAGES// / }"
[[ $BOOT_PART ]] && mnt="/$BOOTDIR"
[[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs"
pkgs="${pkgs// / }"
msg "Show Configuration" "
---------- PARTITION CONFIGURATION ------------
@ -419,16 +421,29 @@ select_show()
select_login()
{
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" \
"lightdm" "Lightweight display manager with a gtk greeter" || return 1
fi
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
LOGIN_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
if (( WM_NUM == 1 )); then
LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
else
dlg LOGIN_WM menu "Login Session" "$_login" $LOGIN_CHOICES || return 1
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\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"
local txt="\nDo you want autologin enabled for $NEWUSER?\n\nIf so the following two files will be created (disable autologin by removing 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=''
LOGIN_PKGS="xorg-xinit"
EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
fi
}
select_config()
@ -597,6 +612,7 @@ select_sessions()
done
select_login || return 1
[[ $WM_PKGS != *"$LOGIN_PKGS"* ]] && WM_PKGS+=" $LOGIN_PKGS"
while IFS=' ' read -r pkg; do
[[ $PACKAGES != *"$pkg"* ]] && PACKAGES+=" $pkg"
@ -928,12 +944,15 @@ part_shrink()
# minimum in KiB (2^10)
case "$fs" in
ext[2-4]) min=$(dumpe2fs -h "$part" |& awk '/Block count/{count=$NF} /Block size/{size=$NF} END{print int((count * size) / 1024)}') ;;
ntfs) min=$(ntfsresize -f -m "$part" | awk 'NR == 2 {print int(($NF * 1000 * 1000) / 1024)}') ;;
ext[2-4])
mount "$part" $MNT >/dev/null 2>&1; sleep 0.5
min=$(df --output=used --block-size=KiB "$part" | awk 'NR == 2 {print int($1)}')
umount $MNT >/dev/null 2>&1
ntfs) min=$(ntfsresize -f -m "$part" | awk 'NR == 2 {print int(($NF * 1000 * 1000) / 1024)}') >/dev/null 2>&1 ;;
esac
# KiB -> MiB
mbmin=$((min / 1024))
mbmin=$(((min / 1024) + 200))
mbend=$((end / 1024))
# get new size from user
@ -1295,7 +1314,7 @@ install_main()
install_boot
chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa"
install_user
install_xinit
install_login
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
sleep 1
@ -1490,9 +1509,6 @@ install_user()
install_xinit()
{
SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
sed -i '/printf/d' $MNT/root/.zshrc
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
@ -1516,6 +1532,32 @@ EOF
fi
}
install_login()
{
SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
sed -i '/printf/d' $MNT/root/.zshrc
install_${LOGIN_TYPE:-xinit}
}
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]
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=""