Fix: wm/de count error
This commit is contained in:
parent
cbb298fbaf
commit
f87b340059
@ -267,6 +267,7 @@ _timez="\nThe time zone is used to set the system clock.\n\nSelect your country
|
||||
_timesubz="\nSelect the nearest city to you or one with the same time zone.\n\nTIP: Pressing the first letter of the city name repeatedly will navigate between entries beggining with that letter."
|
||||
_sessions="\nUse [Space] to toggle available sessions, use [Enter] to accept the selection and continue.\n\nA basic package set will be installed for compatibility and functionality."
|
||||
_login="\nSelect which of your session choices to use for the initial login.\n\nYou can be change this later by editing your ~/.xinitrc"
|
||||
_autologin="\nDo you want autologin enabled for USER?\n\nIf so the following two files will be created (disable autologin by removing them):\n\n - /home/USER/RC (run startx when logging in on tty1)\n - /etc/systemd/system/getty@tty1.service.d/autologin.conf (login USER without password)\n"
|
||||
_packages="\nUse [Space] to move a package into the selected area and press [Enter] to accept the selection.\n\nPackages may be installed by your DE/WM (if any), or for the packages you select."
|
||||
_edit="\nBefore exiting you can select configuration files to review/change.\n\nIf you need to make other changes with the drives still mounted, use Ctrl-z to pause the installer, when finished type 'fg' and [Enter] or Ctrl-z again to resume the installer, if you want to avoid the automatic reboot using Ctrl-c will cleanly exit."
|
||||
|
||||
@ -418,6 +419,8 @@ select_show()
|
||||
|
||||
select_login()
|
||||
{
|
||||
[[ $INSTALL_WMS ]] || return 0
|
||||
|
||||
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" \
|
||||
@ -428,18 +431,16 @@ select_login()
|
||||
AUTOLOGIN=''
|
||||
EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
||||
else
|
||||
if (( WM_NUM == 1 )); then
|
||||
LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
|
||||
else
|
||||
# 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=''
|
||||
|
||||
local txt="\nDo you want autologin enabled for $NEWUSER?\n\n"
|
||||
txt+="If so the following two files will be created (disable autologin by removing them):\n\n"
|
||||
txt+="- /home/$NEWUSER/$LOGINRC (run startx when logging in on tty1)\n"
|
||||
txt+="- /etc/systemd/system/getty@tty1.service.d/autologin.conf (login $NEWUSER without password)\n"
|
||||
yesno "Autologin" "$txt" && AUTOLOGIN=true || AUTOLOGIN=''
|
||||
EDIT_FILES[login]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
|
||||
fi
|
||||
}
|
||||
@ -451,12 +452,10 @@ select_config()
|
||||
|
||||
until [[ $CONFIG_DONE ]]; do
|
||||
case $i in
|
||||
0)
|
||||
dlg MYSHELL menu "Shell" "\nChoose which shell to use." \
|
||||
0) dlg MYSHELL menu "Shell" "\nChoose which shell to use." \
|
||||
/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; } ;;
|
||||
@ -467,13 +466,11 @@ select_config()
|
||||
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." \
|
||||
4) dlg KERNEL menu "Kernel" "\nChoose which kernel to use." \
|
||||
linux 'Vanilla linux kernel and modules, with a few patches applied' \
|
||||
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
|
||||
@ -506,13 +503,7 @@ select_mkuser()
|
||||
"Password2:" 9 1 '' 9 12 "$COLUMNS" 0 1 2>"$ANS" || return 1
|
||||
|
||||
while read -r line; do
|
||||
case $i in
|
||||
0) u="$line" ;;
|
||||
1) p="$line" ;;
|
||||
2) p2="$line" ;;
|
||||
3) rp="$line" ;;
|
||||
4) rp2="$line" ;;
|
||||
esac
|
||||
case $i in 0) u="$line" ;; 1) p="$line" ;; 2) p2="$line" ;; 3) rp="$line" ;; 4) rp2="$line" ;; esac
|
||||
(( i++ ))
|
||||
done < "$ANS"
|
||||
|
||||
@ -590,13 +581,9 @@ select_sessions()
|
||||
gnome "A desktop environment that aims to be simple and easy to use" "$(ofn gnome "${INSTALL_WMS[*]}")" \
|
||||
cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "${INSTALL_WMS[*]}")" \
|
||||
plasma "A kde software project currently comprising a full desktop environment" "$(ofn plasma "${INSTALL_WMS[*]}")" \
|
||||
xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "${INSTALL_WMS[*]}")" || return 1
|
||||
|
||||
WM_NUM=0
|
||||
while IFS=' ' read -r i; do
|
||||
(( WM_NUM++ ))
|
||||
done <<< "$INSTALL_WMS"
|
||||
xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "${INSTALL_WMS[*]}")"
|
||||
|
||||
[[ $INSTALL_WMS ]] || return 0
|
||||
|
||||
WM_PKGS="${INSTALL_WMS/dwm/}" # remove dwm from package list
|
||||
WM_PKGS="${WM_PKGS// / }" # remove double spaces
|
||||
@ -1002,7 +989,8 @@ part_device()
|
||||
fi
|
||||
[[ $DEVICE ]] || return 1
|
||||
elif [[ $DEV_COUNT -lt 1 && ! $1 ]]; then
|
||||
msg "Device Error" "\nNo available devices.\n\nExiting..\n" 2; die 1
|
||||
msg "Device Error" "\nNo available devices.\n\nExiting..\n" 2
|
||||
die 1
|
||||
fi
|
||||
|
||||
[[ $1 ]] && BOOT_DEV="$DEVICE"
|
||||
@ -1226,7 +1214,7 @@ select_efi_partition()
|
||||
done <<< "$PARTS"
|
||||
|
||||
if (( ptcount == 1 )); then
|
||||
msg "EFI Boot Partition" "\nOnly one partition that meets size requirements available.\n" 1
|
||||
msg "EFI Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1
|
||||
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
|
||||
else
|
||||
dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts
|
||||
@ -1302,7 +1290,7 @@ select_root_partition()
|
||||
done <<< "$PARTS"
|
||||
|
||||
if (( ptcount == 1 )); then # only one available device
|
||||
msg "Select Root Partition (/)" "\nOnly one partition that meets size requirements available.\n" 1
|
||||
msg "Select Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 1
|
||||
ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$pts")"
|
||||
else
|
||||
dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $pts
|
||||
@ -1568,10 +1556,19 @@ install_user()
|
||||
|
||||
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
|
||||
printf "exec %s\n" "$LOGIN_WM" >> "$MNT/home/$NEWUSER/.xinitrc"
|
||||
|
||||
if [[ $INSTALL_WMS ]]; 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"
|
||||
elif [[ $INSTALL_WMS ]]; then
|
||||
printf "exec %s\n" "$LOGIN_WM" >> "$MNT/home/$NEWUSER/.xinitrc"
|
||||
else
|
||||
printf "exec %s\n" "$LOGIN_WM" >> "$MNT/home/$NEWUSER/.xinitrc"
|
||||
fi
|
||||
elif [[ -e $MNT/home/$NEWUSER/.xinitrc ]]; then
|
||||
# no sessions available so remove the exec from ~/.xinitrc and return
|
||||
sed -i '/exec/d' "$MNT/home/$NEWUSER/.xinitrc"
|
||||
return 0
|
||||
fi
|
||||
|
||||
[[ ${EDIT_FILES[login]} == *"$LOGINRC"* ]] || EDIT_FILES[login]+=" /home/$NEWUSER/$LOGINRC"
|
||||
@ -1599,8 +1596,8 @@ install_login()
|
||||
install_lightdm()
|
||||
{
|
||||
rm -rf "$SERVICE" "$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"
|
||||
chrun 'systemctl enable lightdm.service' 2>$ERR
|
||||
errshow 1 "systemctl enable lightdm.service"
|
||||
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf <<- EOF
|
||||
# LightDM GTK+ Configuration
|
||||
|
||||
@ -1805,14 +1802,11 @@ setup_grub()
|
||||
|
||||
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
|
||||
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"
|
||||
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
|
||||
@ -1940,27 +1934,23 @@ setup_systemd-boot()
|
||||
prerun_systemd-boot()
|
||||
{
|
||||
mkdir -p $MNT/boot/loader/entries
|
||||
|
||||
cat > $MNT/boot/loader/loader.conf <<- EOF
|
||||
default $DIST
|
||||
timeout 5
|
||||
editor no
|
||||
EOF
|
||||
|
||||
cat > $MNT/boot/loader/entries/$DIST.conf <<- EOF
|
||||
title $DIST Linux
|
||||
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
|
||||
initrd /initramfs-$KERNEL.img
|
||||
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
||||
EOF
|
||||
|
||||
cat > $MNT/boot/loader/entries/$DIST-fallback.conf <<- EOF
|
||||
title $DIST Linux Fallback
|
||||
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
|
||||
initrd /initramfs-$KERNEL-fallback.img
|
||||
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
||||
EOF
|
||||
|
||||
mkdir -p $MNT/etc/pacman.d/hooks
|
||||
cat > $MNT/etc/pacman.d/hooks/systemd-boot.hook <<- EOF
|
||||
[Trigger]
|
||||
@ -1973,7 +1963,6 @@ prerun_systemd-boot()
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/bootctl update
|
||||
EOF
|
||||
|
||||
systemd-machine-id-setup --root="$MNT"
|
||||
return 0
|
||||
}
|
||||
@ -2360,11 +2349,14 @@ luks_advanced()
|
||||
|
||||
ofn()
|
||||
{
|
||||
# does $2 contain $1
|
||||
[[ "$2" == *"$1"* ]] && printf "on" || printf "off"
|
||||
}
|
||||
|
||||
die()
|
||||
{
|
||||
# cleanup and exit the installer cleanly with exit code $1
|
||||
# when ecode is 127 unmount /run/archiso/bootmnt and reboot
|
||||
local ecode="$1"
|
||||
|
||||
trap - INT
|
||||
@ -2383,17 +2375,24 @@ die()
|
||||
|
||||
dlg()
|
||||
{
|
||||
local var="$1" dialog_type="$2" title="$3" body="$4" n=0
|
||||
shift 4
|
||||
local var="$1" # assign output from dialog to var
|
||||
local dlg_t="$2" # display a dialog of type dlg_t (menu, check, input)
|
||||
local title="$3" # dialog title
|
||||
local body="$4" # dialog message
|
||||
local n=0 # number of items to display
|
||||
|
||||
shift 4 # shift off args assigned above
|
||||
|
||||
# when passed a large amount of arguments (menu list) adjust menu height
|
||||
(( ($# / 2) > SHL )) && n=$SHL
|
||||
|
||||
tput civis
|
||||
case "$dialog_type" in
|
||||
case "$dlg_t" in
|
||||
menu) dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " $title " --menu "$body" 0 0 $n "$@" 2>"$ANS" || return 1 ;;
|
||||
check) dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " $title " --checklist "$body" 0 0 $n "$@" 2>"$ANS" || return 1 ;;
|
||||
input)
|
||||
tput cnorm
|
||||
local def="$1"
|
||||
local def="$1" # assign default value for input
|
||||
shift
|
||||
if [[ $1 == 'limit' ]]; then
|
||||
dialog --backtitle "$DIST Installer - $SYS - v$VER" --max-input 63 --title " $title " --inputbox "$body" 0 0 "$def" 2>"$ANS" || return 1
|
||||
@ -2402,15 +2401,20 @@ dlg()
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# if answer file isn't empty read from it into $var
|
||||
[[ -s "$ANS" ]] && printf -v "$var" "%s" "$(< "$ANS")"
|
||||
}
|
||||
|
||||
msg()
|
||||
{
|
||||
local title="$1" body="$2"
|
||||
# displays a message dialog
|
||||
# when more than 2 args the message will disappear after sleep time ($3)
|
||||
local title="$1"
|
||||
local body="$2"
|
||||
shift 2
|
||||
tput civis
|
||||
if (( $# == 3 )); then
|
||||
dialog --backtitle "$DIST Installer - $SYS - v$VER" --sleep "$3" --title " $title " --infobox "$body\n" 0 0
|
||||
if (( $# )); then
|
||||
dialog --backtitle "$DIST Installer - $SYS - v$VER" --sleep "$1" --title " $title " --infobox "$body\n" 0 0
|
||||
else
|
||||
dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " $title " --msgbox "$body\n" 0 0
|
||||
fi
|
||||
|
Reference in New Issue
Block a user