Add ly to login options, remove extra ucode install

This commit is contained in:
natemaia 2019-08-25 01:28:30 -07:00
parent 185c31c9d1
commit eec825e909

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.55" # installer version VER="2.0.56" # 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
@ -53,7 +53,7 @@ EXMNTS='' # when an extra partition is mounted append it's info
FONT="ter-i16n" # font used for 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
LOGIN_TYPE='' # login manager can be: lightdm, xinit LOGIN_TYPE='' # login manager can be: lightdm, xinit, ly
LOGIN_WM='' # default login session to be placed in ~/.xinitrc LOGIN_WM='' # default login session to be placed in ~/.xinitrc
LOGINRC='' # login shell rc file, eg. .zprofile, .bash_profile, .profile LOGINRC='' # login shell rc file, eg. .zprofile, .bash_profile, .profile
@ -95,11 +95,11 @@ ISO_BASE+="pacman-contrib parted rsync sdparm smartmontools wget wireless_tools
ISO_BASE+="alsa-firmware alsa-lib alsa-plugins pulseaudio pulseaudio-alsa networkmanager w3m htop wireless-regdb " ISO_BASE+="alsa-firmware alsa-lib alsa-plugins pulseaudio pulseaudio-alsa networkmanager w3m htop wireless-regdb "
ISO_BASE+="lm_sensors lsb-release p7zip pamixer reflector unrar ranger terminus-font ttf-dejavu archlabs-keyring" ISO_BASE+="lm_sensors lsb-release p7zip pamixer reflector unrar ranger terminus-font ttf-dejavu archlabs-keyring"
# archlabs base packages # archlabs base
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 xorg-xinit sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler " BASE_PKGS="base-devel xorg xorg-drivers 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
@ -219,6 +219,7 @@ declare -A FS_OPTS=(
# packages installed for each login option { # packages installed for each login option {
declare -A LOGIN_PKGS=( declare -A LOGIN_PKGS=(
[xinit]='xorg-xinit' [xinit]='xorg-xinit'
[ly]='archlabs-ly'
[lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice' [lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice'
) # } ) # }
@ -424,24 +425,27 @@ select_login()
if [[ -z $LOGIN_TYPE ]]; then 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"
"lightdm" "Lightweight display manager with a gtk greeter" || return 1 "lightdm" "Lightweight display manager with a gtk greeter" || return 1
fi fi
if [[ $LOGIN_TYPE == 'lightdm' ]]; then if [[ $LOGIN_TYPE == 'xinit' ]]; then
AUTOLOGIN='' EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
else
# define what wm/de to use for xinit # define what wm/de to use for xinit
if (( $(wc -w <<< "$INSTALL_WMS") > 1 )); then if (( $(wc -w <<< "$INSTALL_WMS") > 1 )); then
dlg LOGIN_WM menu "Login Management" "$_login" $LOGIN_CHOICES || return 1 dlg LOGIN_WM menu "Login Management" "$_login" $LOGIN_CHOICES || return 1
LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}" LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}"
fi fi
[[ -z $LOGIN_WM ]] && LOGIN_WM="${WM_SESSIONS[${INSTALL_WMS%% *}]}" [[ -z $LOGIN_WM ]] && LOGIN_WM="${WM_SESSIONS[${INSTALL_WMS%% *}]}"
# autologin # autologin
yesno "Autologin" "$(sed "s|USER|$NEWUSER|g; s|RC|$LOGINRC|g" <<< "$_autologin")" && AUTOLOGIN=true || AUTOLOGIN='' yesno "Autologin" "$(sed "s|USER|$NEWUSER|g; s|RC|$LOGINRC|g" <<< "$_autologin")" && AUTOLOGIN=true || AUTOLOGIN=''
else
EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile" AUTOLOGIN='' # no autologin for DMs
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
elif [[ $LOGIN_TYPE == 'ly' ]]; then
EDIT_FILES[login]="/etc/ly/config.ini"
fi
fi fi
} }
@ -463,7 +467,6 @@ select_config()
until [[ $ZONE && $SUBZ ]]; do until [[ $ZONE && $SUBZ ]]; do
dlg ZONE menu "Timezone" "$_timez" America - Australia - Asia - Atlantic - Africa - Europe - Indian - Pacific - Arctic - Antarctica - || break dlg ZONE menu "Timezone" "$_timez" America - Australia - Asia - Atlantic - Africa - Europe - Indian - Pacific - Arctic - Antarctica - || break
dlg SUBZ menu "Timezone" "$_timesubz" $(awk '/'"$ZONE"'\// {gsub(/'"$ZONE"'\//, ""); print $3 " - "}' /usr/share/zoneinfo/zone.tab | sort) || continue dlg SUBZ menu "Timezone" "$_timesubz" $(awk '/'"$ZONE"'\// {gsub(/'"$ZONE"'\//, ""); print $3 " - "}' /usr/share/zoneinfo/zone.tab | sort) || continue
yesno "Timezone" "\nConfirm time zone: $ZONE/$SUBZ\n" || unset ZONE
done done
[[ $ZONE && $SUBZ ]] || { i=2; continue; } ;; [[ $ZONE && $SUBZ ]] || { i=2; continue; } ;;
4) dlg KERNEL menu "Kernel" "\nChoose which kernel to use." \ 4) dlg KERNEL menu "Kernel" "\nChoose which kernel to use." \
@ -477,11 +480,7 @@ select_config()
(( i++ )) # progress through to the next choice (( i++ )) # progress through to the next choice
done done
case $MYSHELL in case $MYSHELL in *bash) LOGINRC='.bash_profile' ;; *zsh) LOGINRC='.zprofile' ;; *mksh) LOGINRC='.profile' ;; esac
'/bin/bash') LOGINRC='.bash_profile' ;;
'/usr/bin/zsh') LOGINRC='.zprofile' ;;
'/usr/bin/mksh') LOGINRC='.profile' ;;
esac
return 0 return 0
} }
@ -1470,6 +1469,8 @@ install_base()
install_boot() install_boot()
{ {
echo "Installing $BOOTLDR"
if [[ $ROOT_PART == /dev/mapper* ]]; then if [[ $ROOT_PART == /dev/mapper* ]]; then
ROOT_PART_ID="$ROOT_PART" ROOT_PART_ID="$ROOT_PART"
else else
@ -1479,17 +1480,11 @@ install_boot()
fi fi
if [[ $SYS == 'UEFI' ]]; then if [[ $SYS == 'UEFI' ]]; then
# our old installs # remove our old install and generic BOOT/ dir
find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname "$DIST" -type d -delete find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname "$DIST" -type d -delete
# generic BOOT/ dir
find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname 'BOOT' -type d -delete find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname 'BOOT' -type d -delete
fi fi
if [[ ! -e $MNT/$BOOTDIR/$UCODE ]]; then
chrun "pacman -S $UCODE --noconfirm"
[[ -e $MNT/$BOOTDIR/$UCODE ]] || UCODE=""
fi
prerun_$BOOTLDR prerun_$BOOTLDR
chrun "${BCMDS[$BOOTLDR]}" 2>$ERR chrun "${BCMDS[$BOOTLDR]}" 2>$ERR
errshow 1 "${BCMDS[$BOOTLDR]}" errshow 1 "${BCMDS[$BOOTLDR]}"
@ -1519,6 +1514,7 @@ 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
@ -1549,7 +1545,7 @@ install_user()
[[ $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
if [[ $LOGIN_WM =~ (startkde|gnome-session) || ($LOGIN_TYPE == 'lightdm' && $WM_PKGS =~ (plasma|gnome)) ]]; then if [[ $LOGIN_WM =~ (startkde|gnome-session) || ($LOGIN_TYPE =~ (lightdm|ly) && $WM_PKGS =~ (plasma|gnome)) ]]; then
sed -i '/super/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile sed -i '/super/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile
sed -i '/nitrogen/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile sed -i '/nitrogen/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile
sed -i '/compton/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile sed -i '/compton/d' $MNT/home/$NEWUSER/.xprofile $MNT/root/.xprofile
@ -1591,8 +1587,16 @@ install_xinit()
fi fi
} }
install_ly()
{
rm -rf "$SERVICE" "$MNT/home/$NEWUSER"/.{xinitrc,profile,zprofile,bash_profile}
chrun 'systemctl enable ly.service' 2>$ERR
errshow 1 "systemctl enable ly.service"
}
install_login() install_login()
{ {
echo "Setting up $LOGIN_TYPE"
SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d" SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
install_${LOGIN_TYPE:-xinit} install_${LOGIN_TYPE:-xinit}
} }
@ -1623,7 +1627,7 @@ install_awesome()
cp -rT "/mnt/home/$NEWUSER/archlabs-awesome" /mnt/etc/skel cp -rT "/mnt/home/$NEWUSER/archlabs-awesome" /mnt/etc/skel
rm -rf "/home/$NEWUSER/"{.git,archlabs-awesome,screenshots} rm -rf "/home/$NEWUSER/"{.git,archlabs-awesome,screenshots}
printf "You will need to install pamac separately using: 'baph -i pamac-aur'\n" printf "You will need to install pamac separately using: 'baph -i pamac-aur'\n"
sleep 3 sleep 2
else else
printf "failed to clone awesome config repo\n" printf "failed to clone awesome config repo\n"
fi fi
@ -1632,7 +1636,7 @@ install_awesome()
install_packages() install_packages()
{ {
local rmpkg="" local rmpkg=""
local inpkg="$BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $PACKAGES $USER_PKGS $UCODE " local inpkg="$BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $PACKAGES $USER_PKGS "
if pacman -Qsq 'archlabs-installer' >/dev/null 2>&1; then if pacman -Qsq 'archlabs-installer' >/dev/null 2>&1; then
rmpkg+="archlabs-installer " rmpkg+="archlabs-installer "
@ -1668,7 +1672,7 @@ install_packages()
[[ $rmpkg ]] && chrun "pacman -Rns $rmpkg --noconfirm" [[ $rmpkg ]] && chrun "pacman -Rns $rmpkg --noconfirm"
# reinstalling iputils fixes the network issue for non-root users # reinstalling iputils fixes the network issue for non-root users
chrun "pacman -S iputils --noconfirm" chrun "pacman -S iputils $UCODE --noconfirm"
# install the packages chosen throughout the install # install the packages chosen throughout the install
chrun "pacman -S $inpkg --needed --noconfirm" 2>$ERR chrun "pacman -S $inpkg --needed --noconfirm" 2>$ERR
@ -1732,8 +1736,9 @@ install_mirrorlist()
local mfile="$1" # output mirrorlist file local mfile="$1" # output mirrorlist file
if hash reflector >/dev/null 2>&1; then if hash reflector >/dev/null 2>&1; then
reflector --score 80 -l 40 -f 5 --sort rate --save "$mfile" reflector --verbose --score 80 -l 40 -f 5 --sort rate --save "$mfile"
elif hash rankmirrors >/dev/null 2>&1; then elif hash rankmirrors >/dev/null 2>&1; then
echo "Sorting mirrorlist"
local key="access_key=5f29642060ab983b31fdf4c2935d8c56" local key="access_key=5f29642060ab983b31fdf4c2935d8c56"
ip_add="$(curl -fsSL "http://api.ipstack.com/check&?$key&fields=ip" | python -c "import sys, json; print(json.load(sys.stdin)['ip'])")" ip_add="$(curl -fsSL "http://api.ipstack.com/check&?$key&fields=ip" | python -c "import sys, json; print(json.load(sys.stdin)['ip'])")"
country="$(curl -fsSL "http://api.ipstack.com/$ip_add?$key&fields=country_code" | python -c "import sys, json; print(json.load(sys.stdin)['country_code'])")" country="$(curl -fsSL "http://api.ipstack.com/$ip_add?$key&fields=country_code" | python -c "import sys, json; print(json.load(sys.stdin)['country_code'])")"
@ -2380,7 +2385,7 @@ die()
dlg() dlg()
{ {
local var="$1" # assign output from dialog to var local var="$1" # assign output from dialog to var
local dlg_t="$2" # display a dialog of type dlg_t (menu, check, input) local dlg_t="$2" # dialog type (menu, check, input)
local title="$3" # dialog title local title="$3" # dialog title
local body="$4" # dialog message local body="$4" # dialog message
local n=0 # number of items to display local n=0 # number of items to display