From eec825e909d4d0f74ee0283a822d365222c3a9e7 Mon Sep 17 00:00:00 2001 From: natemaia Date: Sun, 25 Aug 2019 01:28:30 -0700 Subject: [PATCH] Add ly to login options, remove extra ucode install --- archlabs-installer | 65 +++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index d9dd261..f295543 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.55" # installer version +VER="2.0.56" # installer version DIST="ArchLabs" # linux distributor MNT="/mnt" # install mountpoint 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 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 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+="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" # 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" # extras for window managers @@ -219,6 +219,7 @@ declare -A FS_OPTS=( # packages installed for each login option { declare -A LOGIN_PKGS=( [xinit]='xorg-xinit' +[ly]='archlabs-ly' [lightdm]='lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice' ) # } @@ -424,24 +425,27 @@ 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" \ + "ly" "TUI display manager with a ncurses-like interface" "lightdm" "Lightweight display manager with a gtk greeter" || return 1 fi - if [[ $LOGIN_TYPE == 'lightdm' ]]; then - AUTOLOGIN='' - EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf" - else + if [[ $LOGIN_TYPE == 'xinit' ]]; then + EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile" # define what wm/de to use for xinit if (( $(wc -w <<< "$INSTALL_WMS") > 1 )); then dlg LOGIN_WM menu "Login Management" "$_login" $LOGIN_CHOICES || return 1 LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}" fi [[ -z $LOGIN_WM ]] && LOGIN_WM="${WM_SESSIONS[${INSTALL_WMS%% *}]}" - # autologin yesno "Autologin" "$(sed "s|USER|$NEWUSER|g; s|RC|$LOGINRC|g" <<< "$_autologin")" && AUTOLOGIN=true || AUTOLOGIN='' - - EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile" + else + 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 } @@ -463,7 +467,6 @@ select_config() until [[ $ZONE && $SUBZ ]]; do 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 - yesno "Timezone" "\nConfirm time zone: $ZONE/$SUBZ\n" || unset ZONE done [[ $ZONE && $SUBZ ]] || { i=2; continue; } ;; 4) dlg KERNEL menu "Kernel" "\nChoose which kernel to use." \ @@ -477,11 +480,7 @@ select_config() (( i++ )) # progress through to the next choice done - case $MYSHELL in - '/bin/bash') LOGINRC='.bash_profile' ;; - '/usr/bin/zsh') LOGINRC='.zprofile' ;; - '/usr/bin/mksh') LOGINRC='.profile' ;; - esac + case $MYSHELL in *bash) LOGINRC='.bash_profile' ;; *zsh) LOGINRC='.zprofile' ;; *mksh) LOGINRC='.profile' ;; esac return 0 } @@ -1470,6 +1469,8 @@ install_base() install_boot() { + echo "Installing $BOOTLDR" + if [[ $ROOT_PART == /dev/mapper* ]]; then ROOT_PART_ID="$ROOT_PART" else @@ -1479,17 +1480,11 @@ install_boot() fi 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 - # generic BOOT/ dir find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname 'BOOT' -type d -delete fi - if [[ ! -e $MNT/$BOOTDIR/$UCODE ]]; then - chrun "pacman -S $UCODE --noconfirm" - [[ -e $MNT/$BOOTDIR/$UCODE ]] || UCODE="" - fi - prerun_$BOOTLDR chrun "${BCMDS[$BOOTLDR]}" 2>$ERR errshow 1 "${BCMDS[$BOOTLDR]}" @@ -1519,6 +1514,7 @@ install_boot() install_user() { + echo "Creating new user $NEWUSER and setting password" rm -f $MNT/root/.zshrc # remove welcome message from root zshrc chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR @@ -1549,7 +1545,7 @@ install_user() [[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> $MNT/home/$NEWUSER/.xprofile # 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 '/nitrogen/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 } +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() { + echo "Setting up $LOGIN_TYPE" SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d" install_${LOGIN_TYPE:-xinit} } @@ -1623,7 +1627,7 @@ install_awesome() cp -rT "/mnt/home/$NEWUSER/archlabs-awesome" /mnt/etc/skel rm -rf "/home/$NEWUSER/"{.git,archlabs-awesome,screenshots} printf "You will need to install pamac separately using: 'baph -i pamac-aur'\n" - sleep 3 + sleep 2 else printf "failed to clone awesome config repo\n" fi @@ -1632,7 +1636,7 @@ install_awesome() install_packages() { 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 rmpkg+="archlabs-installer " @@ -1668,7 +1672,7 @@ install_packages() [[ $rmpkg ]] && chrun "pacman -Rns $rmpkg --noconfirm" # 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 chrun "pacman -S $inpkg --needed --noconfirm" 2>$ERR @@ -1732,8 +1736,9 @@ install_mirrorlist() local mfile="$1" # output mirrorlist file 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 + echo "Sorting mirrorlist" 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'])")" 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() { 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 body="$4" # dialog message local n=0 # number of items to display