Add wm and login setup dialogs
This commit is contained in:
parent
01c58d6dd4
commit
dd36a8bb67
320
src/installer
320
src/installer
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/bash
|
||||
|
||||
# vim:ft=sh:fdm=marker:fmr={,}
|
||||
|
||||
@ -14,12 +14,12 @@
|
||||
|
||||
# immutable variables {
|
||||
|
||||
readonly DIST="Archlabs" # Linux distributor
|
||||
readonly VER="1.6.19" # Installer version
|
||||
readonly LIVE="liveuser" # Live session user
|
||||
readonly TRN="/installer" # Translation path
|
||||
readonly MNT="/mnt/install" # Install mountpoint
|
||||
readonly ERR="/tmp/errlog" # Built-in error log
|
||||
readonly DIST="Archlabs" # Linux distributor
|
||||
readonly VER="1.6.26" # Installer version
|
||||
readonly LIVE="liveuser" # Live session user
|
||||
readonly TRN="/usr/share/archlabs-installer" # Translation path
|
||||
readonly MNT="/mnt/install" # Install mountpoint
|
||||
readonly ERR="/tmp/errlog" # Built-in error log
|
||||
|
||||
readonly KBD="$(find /usr/share/kbd/keymaps -name '*.map.gz')"
|
||||
readonly SYS_MEM=$(grep 'MemTotal' /proc/meminfo | awk '{print int($2 / 1024)}')
|
||||
@ -75,10 +75,10 @@ declare -Agr BOOTLOADERS=(
|
||||
)
|
||||
# static mkfs commands for each filesystem offered
|
||||
declare -Agr FS_CMDS=(
|
||||
[btrfs]="mkfs.btrfs -f" [ext2]="mkfs.ext2 -q" [ext3]="mkfs.ext3 -q"
|
||||
[ext4]="mkfs.ext4 -q" [f2fs]="mkfs.f2fs" [jfs]="mkfs.jfs -q"
|
||||
[xfs]="mkfs.xfs -f" [ntfs]="mkfs.ntfs -q" [reiserfs]="mkfs.reiserfs -q"
|
||||
[vfat]="mkfs.vfat -F32" [nilfs2]="mkfs.nilfs2 -q"
|
||||
[ext2]="mkfs.ext2 -q" [ext3]="mkfs.ext3 -q" [ext4]="mkfs.ext4 -q"
|
||||
[f2fs]="mkfs.f2fs" [jfs]="mkfs.jfs -q" [xfs]="mkfs.xfs -f"
|
||||
[ntfs]="mkfs.ntfs -q" [reiserfs]="mkfs.reiserfs -q" [vfat]="mkfs.vfat -F32"
|
||||
[nilfs2]="mkfs.nilfs2 -q"
|
||||
)
|
||||
# static filesystem mount options
|
||||
declare -Agr FS_OPTS=(
|
||||
@ -88,10 +88,6 @@ declare -Agr FS_OPTS=(
|
||||
[reiserfs]="acl - off nolog - off notail - off replayonly - off user_xattr - off"
|
||||
[xfs]="discard - off filestreams - off ikeep - off largeio - off noalign - off nobarrier - off norecovery - off noquota - off wsync - off"
|
||||
[nilfs2]="discard - off nobarrier - off errors=continue - off errors=panic - off order=relaxed - off order=strict - off norecovery - off"
|
||||
[btrfs]="autodefrag - off compress=zlib - off compress=lzo - off compress=no - off
|
||||
compress-force=zlib - off compress-force=lzo - off discard - off noacl - off noatime - off
|
||||
nodatasum - off nospace_cache - off recovery - off skip_balance - off space_cache - off
|
||||
ssd - off ssd_spread - off"
|
||||
[f2fs]="data_flush - off disable_roll_forward - off disable_ext_identify - off
|
||||
discard - off fastboot - off flush_merge - off inline_xattr - off inline_data - off
|
||||
inline_dentry - off no_heap - off noacl - off nobarrier - off noextent_cache - off
|
||||
@ -130,12 +126,19 @@ initialize_variables() {
|
||||
declare -g USER_PASS=""
|
||||
declare -g ROOT_PASS=""
|
||||
|
||||
declare -g LOGIN_WM=""
|
||||
declare -g LOGIN_TYPE=""
|
||||
declare -g INSTALL_WMS=""
|
||||
declare -g WM_PACKAGES=""
|
||||
declare -g EXTRA_PACKAGES=""
|
||||
|
||||
declare -g CURRENT_MENU="main"
|
||||
declare -g MENU_HIGHLIGHT=0
|
||||
declare -g EDITOR_CHOICE=""
|
||||
declare -g MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate"
|
||||
|
||||
# boolean checks
|
||||
declare -g AUTOLOGIN=false
|
||||
declare -g FIRST_PREP=false
|
||||
declare -g FIRST_CONFIG=false
|
||||
declare -g UNPACKED_BASE=false
|
||||
@ -157,15 +160,15 @@ initialize_variables() {
|
||||
# files able to be reviewed when finishing install
|
||||
# item index [8] can change depending on which bootloader is selected
|
||||
declare -Ag EDIT_FILES=(
|
||||
[1]="/etc/X11/xorg.conf.d/00-keyboard.conf /etc/vconsole.conf /etc/default/keyboard"
|
||||
[2]="/etc/locale.conf /etc/default/locale"
|
||||
[3]="/etc/hostname /etc/hosts"
|
||||
[4]="/etc/sudoers"
|
||||
[5]="/etc/mkinitcpio.conf"
|
||||
[6]="/etc/fstab"
|
||||
[7]="/etc/crypttab"
|
||||
[8]="/etc/default/grub"
|
||||
[9]="/etc/pacman.conf"
|
||||
[2]="/etc/X11/xorg.conf.d/00-keyboard.conf /etc/vconsole.conf /etc/default/keyboard"
|
||||
[3]="/etc/locale.conf /etc/default/locale"
|
||||
[4]="/etc/hostname /etc/hosts"
|
||||
[5]="/etc/sudoers"
|
||||
[6]="/etc/mkinitcpio.conf"
|
||||
[7]="/etc/fstab"
|
||||
[8]="/etc/crypttab"
|
||||
[9]="/etc/default/grub"
|
||||
[10]="/etc/pacman.conf"
|
||||
)
|
||||
}
|
||||
|
||||
@ -194,7 +197,13 @@ set_debug() {
|
||||
exec 3>| /tmp/debug-log
|
||||
BASH_XTRACEFD=3
|
||||
|
||||
[[ $DISPLAY ]] && { $TERM_CMD -e "tail -f /tmp/debug-log" & }
|
||||
if [[ $DISPLAY ]]; then
|
||||
if [[ $TERM_CMD == 'st' ]]; then
|
||||
$TERM_CMD -e tail -f /tmp/debug-log &
|
||||
else
|
||||
$TERM_CMD -e "tail -f /tmp/debug-log" &
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
select_language() {
|
||||
@ -210,6 +219,7 @@ select_language() {
|
||||
"9" "Magyar (hu_HU)" "10" "Chinese (zh_CN)")
|
||||
|
||||
source $TRN/english.trans 2>/dev/null
|
||||
FONT="ter-i16n"
|
||||
|
||||
case $lang in
|
||||
1) LOC="en_US.UTF-8" ;;
|
||||
@ -217,19 +227,20 @@ select_language() {
|
||||
3) source $TRN/p_brasil.trans 2>/dev/null && LOC="pt_BR.UTF-8" ;;
|
||||
4) source $TRN/portuguese.trans 2>/dev/null && LOC="pt_PT.UTF-8" ;;
|
||||
5) source $TRN/french.trans 2>/dev/null && LOC="fr_FR.UTF-8" ;;
|
||||
6) source $TRN/russian.trans 2>/dev/null && LOC="ru_RU.UTF-8" ;;
|
||||
6) source $TRN/russian.trans 2>/dev/null && LOC="ru_RU.UTF-8" FONT="LatKaCyrHeb-14" ;;
|
||||
7) source $TRN/italian.trans 2>/dev/null && LOC="it_IT.UTF-8" ;;
|
||||
8) source $TRN/dutch.trans 2>/dev/null && LOC="nl_NL.UTF-8" ;;
|
||||
9) source $TRN/hungarian.trans 2>/dev/null && LOC="hu_HU.UTF-8" ;;
|
||||
9) source $TRN/hungarian.trans 2>/dev/null && LOC="hu_HU.UTF-8" FONT="lat2-16" ;;
|
||||
10) source $TRN/chinese.trans 2>/dev/null && LOC="zh_CN.UTF-8" ;;
|
||||
*) clear; tput cnorm; exit 0
|
||||
*) clear; tput cnorm
|
||||
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
||||
exit 0
|
||||
esac
|
||||
|
||||
sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen
|
||||
|
||||
[[ $LOC != "en_US.UTF-8" ]] && sed -i "s/#${LOC}/${LOC}/" /etc/locale.gen
|
||||
|
||||
locale-gen >/dev/null 2>&1
|
||||
setfont $FONT >/dev/null 2>&1
|
||||
|
||||
export LANG="$LOC"
|
||||
}
|
||||
@ -254,24 +265,14 @@ identify_system() {
|
||||
check_requirements() {
|
||||
declare -g HAS_NETWORK=false
|
||||
|
||||
# I use some bashisms such as associative arrays, string manipulation, [[]], etc..
|
||||
# these require a more up to date version of bash
|
||||
[[ ${BASH_VERSION:0:1} -lt 4 ]] && { clear; echo "[ERROR]: Requires bash version >= 4.0"; tput cnorm; exit 1; }
|
||||
|
||||
# check for each command used in the script to ensure no problems
|
||||
local miss=""
|
||||
for cmd in awk sed grep uniq sort find ping rsync dialog arch-chroot reflector chpasswd parted mkfs lsblk; do
|
||||
! hash $cmd >/dev/null 2>&1 && miss="${miss}$cmd "
|
||||
done
|
||||
[[ $miss != "" ]] && { clear; echo "[ERROR]: Missing dependencies: $miss"; tput cnorm; exit 1; }
|
||||
|
||||
if [[ $(whoami) != "root" ]]; then
|
||||
infobox "$_ErrTitle" "$_NotRoot\n$_Exit" ; clear; tput cnorm; exit 1
|
||||
infobox "$_ErrTitle" "$_NotRoot\n$_Exit"; clear; tput cnorm
|
||||
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
||||
exit 1
|
||||
elif ! (ping -c 1 archlabslinux.com || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) >/dev/null 2>&1; then
|
||||
|
||||
if [[ $(systemctl is-active NetworkManager) == "active" ]] && hash nmtui >/dev/null 2>&1;then
|
||||
tput civis
|
||||
nmtui
|
||||
tput civis; nmtui
|
||||
fi
|
||||
|
||||
if (ping -c 1 archlabslinux.com || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) >/dev/null 2>&1; then
|
||||
@ -424,7 +425,8 @@ EOF
|
||||
[[ $? != 0 || $map == "" ]] && return 1
|
||||
fi
|
||||
|
||||
echo "KEYMAP=$map" > /tmp/vconsole.conf
|
||||
setxkbmap $XKBMAP >/dev/null 2>&1
|
||||
echo -e "KEYMAP=$map\nFONT=$FONT" >/tmp/vconsole.conf
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -566,7 +568,12 @@ user_input_values() {
|
||||
}
|
||||
|
||||
create_user() {
|
||||
local groups="rfkill,wheel,autologin,network,lp,storage,power,video,audio,lp"
|
||||
if [[ $AUTOLOGIN == true && $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
local groups="rfkill,wheel,autologin,nopasswdlogin,network,lp,storage,power,video,audio,lp"
|
||||
else
|
||||
local groups="rfkill,wheel,autologin,network,lp,storage,power,video,audio,lp"
|
||||
fi
|
||||
|
||||
NEWUSER=""
|
||||
user_input_values "$NEWUSER" || return 1
|
||||
|
||||
@ -582,27 +589,27 @@ create_user() {
|
||||
if [[ -e $MNT/home/$LIVE ]]; then
|
||||
# for first user created, swap the live user account
|
||||
swap_livuser
|
||||
|
||||
chroot_cmd "mv -f /home/$LIVE /home/$NEWUSER" 2>$ERR
|
||||
check_for_errors "mv -f /home/$LIVE /home/$NEWUSER" || return 1
|
||||
|
||||
chroot_cmd "usermod -aG $groups $NEWUSER" 2>$ERR
|
||||
check_for_errors "usermod -aG $groups $NEWUSER" || return 1
|
||||
else
|
||||
# create new user account
|
||||
chroot_cmd "useradd $NEWUSER -m -g users -G $groups -s /bin/zsh" 2>$ERR
|
||||
check_for_errors "useradd $NEWUSER -m -g users -G $groups -s /bin/zsh" || return 1
|
||||
|
||||
chroot_cmd "cp -rf /etc/skel/ /home/$NEWUSER" 2>$ERR
|
||||
check_for_errors "cp -rf /etc/skel/ /home/$NEWUSER" || return 1
|
||||
fi
|
||||
|
||||
chroot_cmd "echo '$NEWUSER:$USER_PASS' | chpasswd" 2>$ERR
|
||||
check_for_errors "chpasswd $NEWUSER" || return 1
|
||||
|
||||
chroot_cmd "chown -Rf $NEWUSER:users /home/$NEWUSER" 2>$ERR
|
||||
check_for_errors "chown -Rf $NEWUSER:users /home/$NEWUSER" || return 1
|
||||
|
||||
if [[ $AUTOLOGIN == true && $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
|
||||
fi
|
||||
|
||||
fix_home_files
|
||||
|
||||
if [[ $UNPACKED_BASE == true && $TIMEZONE_SET == true ]]; then
|
||||
@ -613,50 +620,86 @@ create_user() {
|
||||
}
|
||||
|
||||
swap_livuser() {
|
||||
local openbx="$MNT/home/$LIVE/.config/openbox"
|
||||
# edit the required files in /etc/ to swap the liveuser account name
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow}
|
||||
|
||||
# due to changes in systemd and arch the recommended file override location has changed
|
||||
# check for each location used in recent versions
|
||||
local tty_autologin
|
||||
if [[ -e $MNT/etc/systemd/system/autologin@.service ]]; then
|
||||
tty_autologin="systemd/system/autologin@.service"
|
||||
elif [[ -e $MNT/etc/systemd/system/getty@tty1.service.d/override.conf ]]; then
|
||||
tty_autologin="systemd/system/getty@tty1.service.d/override.conf"
|
||||
elif [[ -e $MNT/etc/systemd/system/getty@tty1.service.d/autologin.conf ]]; then
|
||||
tty_autologin="systemd/system/getty@tty1.service.d/autologin.conf"
|
||||
if [[ $AUTOLOGIN != true || $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
rm -rf $MNT/etc/systemd/system/getty@tty1.service.d >/dev/null 2>&1
|
||||
elif [[ $AUTOLOGIN == true && $LOGIN_TYPE != 'lightdm' ]]; then
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
fi
|
||||
|
||||
# edit all the required files in /etc/ and swap the liveuser
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow,$tty_autologin}
|
||||
|
||||
# remove welcome script and installer/welcome menu entries
|
||||
# also removes the setting to make the installer open maximized
|
||||
rm -f $MNT/home/$LIVE/bin/welcome.sh
|
||||
sed -i '/welcome.sh/d' $openbx/autostart
|
||||
sed -i '/installer/ { N; N; d; }' $openbx/rc.xml
|
||||
sed -i '/item label="Welcome Screen"/ i\ <separator label="A r c h L a b s"/>' $openbx/menu.xml
|
||||
sed -i '/item label="Welcome Screen"/ { N; N; N; N; N; N; N; N; N; N; N; d; }' $openbx/menu.xml
|
||||
return 0
|
||||
}
|
||||
|
||||
fix_home_files() {
|
||||
local user_home="$MNT/home/$NEWUSER"
|
||||
local files=(".config/polybar/config"
|
||||
".config/polybar/sessions/i3-sessionfile"
|
||||
".config/polybar/sessions/bspwm-sessionfile"
|
||||
".config/polybar/sessions/openbox-sessionfile"
|
||||
".config/openbox/autostart" ".config/gtk-3.0/bookmarks"
|
||||
".mozilla/firefox/archlabs.default/prefs.js"
|
||||
".mozilla/firefox/archlabs.default/sessionstore.js")
|
||||
for file in "${files[@]}"; do
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $user_home/$file
|
||||
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $user_home/.config/{openbox/autostart,gtk-3.0/bookmarks} \
|
||||
$user_home/.mozilla/firefox/{archlabs.default/prefs.js,archlabs.default/sessionstore.js}
|
||||
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
rm -rf $user_home/.{zprofile,xinitrc}
|
||||
else
|
||||
sed -i "s/:-openbox/:-${LOGIN_WM}/g" $user_home/.xinitrc
|
||||
sed -i '/archlabs-installer/d' $user_home/.zprofile
|
||||
echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx -- vt1 &>/dev/null' >> $user_home/.zprofile
|
||||
fi
|
||||
else
|
||||
rm -rf $user_home/.zprofile
|
||||
sed -i "s/:-openbox/:-${LOGIN_WM}/g" $user_home/.xinitrc
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
choose_window_manager() {
|
||||
LOGIN_WM=""
|
||||
LOGIN_TYPE=""
|
||||
WM_PACKAGES=""
|
||||
|
||||
INSTALL_WMS="$(dialog --cr-wrap --stdout --backtitle "$BT" --no-cancel \
|
||||
--title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 0 \
|
||||
"openbox" "A lightweight, powerful, and highly configurable stacking window manager" off \
|
||||
"bspwm" "A tiling window manager that represents windows as the leaves of a binary tree" off \
|
||||
"i3-gaps" "A fork of i3 window manager with more features including gaps" off \
|
||||
"xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"
|
||||
|
||||
INSTALL_WMS="${INSTALL_WMS:-openbox}"
|
||||
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
|
||||
|
||||
for wm in $INSTALL_WMS; do
|
||||
WM_LOGIN_CHOICES="${WM_LOGIN_CHOICES}$wm - "
|
||||
case $wm in
|
||||
openbox) WM_PACKAGES="$WM_PACKAGES $wm obconf archlabs-ob-autostart archlabs-obkey archlabs-kickshaw" ;;
|
||||
bspwm) WM_PACKAGES="$WM_PACKAGES $wm sxhkd lxappearance" ;;
|
||||
i3-gaps) WM_PACKAGES="$WM_PACKAGES $wm i3status perl-anyevent-i3 lxappearance" ;;
|
||||
xfce4) WM_PACKAGES="$WM_PACKAGES $wm xfce4-goodies xfce4-pulseaudio-plugin" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
rm -f $user_home/.config/keypack
|
||||
sed -i '/keypack/d' $user_home/.config/openbox/autostart
|
||||
|
||||
if hash al-hello >/dev/null 2>&1; then
|
||||
echo "sleep 10; $TERM_CMD -e al-hello &" >> $user_home/.config/openbox/autostart
|
||||
if yesno "$_WMLogin" "$_LoginTypeBody\n" "xinit" "lightdm"; then
|
||||
LOGIN_TYPE="xinit"
|
||||
else
|
||||
LOGIN_TYPE="lightdm"
|
||||
fi
|
||||
|
||||
if yesno "$_WMLogin" "$_AutoLoginBody\n"; then
|
||||
AUTOLOGIN=true
|
||||
else
|
||||
AUTOLOGIN=false
|
||||
fi
|
||||
|
||||
if [[ $WM_NUM -eq 1 ]]; then
|
||||
LOGIN_WM="$INSTALL_WMS"
|
||||
else
|
||||
LOGIN_WM="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
|
||||
--title " $_WMLogin " --menu "$_WMLoginBody" 0 0 0 $WM_LOGIN_CHOICES)"
|
||||
[[ $LOGIN_WM == "" ]] && LOGIN_WM="$(awk '{print $1}' <<< "$INSTALL_WMS")"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
######################################################################
|
||||
@ -667,8 +710,7 @@ wipe_device() {
|
||||
local device="$1"
|
||||
if yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2"; then
|
||||
tput civis
|
||||
wipe -Ifre "$device" |
|
||||
dialog --cr-wrap --backtitle "$BT" --title " $_PartWipe " \
|
||||
wipe -Ifre "$device" | dialog --cr-wrap --backtitle "$BT" --title " $_PartWipe " \
|
||||
--progressbox "\nSecure wiping $device\n" 18 70
|
||||
else
|
||||
create_partitions "$device"
|
||||
@ -829,17 +871,19 @@ create_partitions() {
|
||||
local device="$1"
|
||||
local choice
|
||||
tput civis
|
||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
|
||||
--menu "$_PartBody" 0 0 0 "$_PartAuto" "BIOS & UEFI" \
|
||||
"gparted" "BIOS & UEFI" "cfdisk" "BIOS & UEFI" "parted" "BIOS & UEFI" "$_PartWipe" "BIOS & UEFI")"
|
||||
if hash gparted >/dev/null 2>&1 && [[ $DISPLAY ]]; then
|
||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
|
||||
--menu "$_PartBody" 0 0 0 "$_PartAuto" "BIOS & UEFI" \
|
||||
"gparted" "BIOS & UEFI" "cfdisk" "BIOS & UEFI" "parted" "BIOS & UEFI" "$_PartWipe" "BIOS & UEFI")"
|
||||
else
|
||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
|
||||
--menu "$_PartBody" 0 0 0 "$_PartAuto" "BIOS & UEFI" \
|
||||
"cfdisk" "BIOS & UEFI" "parted" "BIOS & UEFI" "$_PartWipe" "BIOS & UEFI")"
|
||||
fi
|
||||
[[ $? != 0 || $choice == "" ]] && return 1 || clear
|
||||
|
||||
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" ]]; then
|
||||
if [[ $choice == "gparted" ]] && ! [[ $DISPLAY ]]; then
|
||||
cfdisk $device
|
||||
else
|
||||
$choice $device
|
||||
fi
|
||||
$choice $device
|
||||
elif [[ $choice == "$_PartWipe" ]]; then
|
||||
wipe_device $device && create_partitions $device
|
||||
else
|
||||
@ -935,12 +979,11 @@ select_filesystem() {
|
||||
local choice
|
||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part" \
|
||||
--menu "\nPartition: ${part}$([[ $cur_fs != "" ]] && echo -n "\nCurrent: ${cur_fs}")\n$_FSBody" 0 0 0 $([[ $cur_fs != "" ]] && echo -n "$_Skip -") \
|
||||
"ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \
|
||||
"ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \
|
||||
"btrfs" "${FS_CMDS[btrfs]}" "ntfs" "${FS_CMDS[ntfs]}" \
|
||||
"f2fs" "${FS_CMDS[f2fs]}" "jfs" "${FS_CMDS[jfs]}" \
|
||||
"nilfs2" "${FS_CMDS[nilfs2]}" "reiserfs" "${FS_CMDS[reiserfs]}" \
|
||||
"xfs" "${FS_CMDS[xfs]}")"
|
||||
"ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \
|
||||
"ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \
|
||||
"ntfs" "${FS_CMDS[ntfs]}" "f2fs" "${FS_CMDS[f2fs]}" \
|
||||
"jfs" "${FS_CMDS[jfs]}" "nilfs2" "${FS_CMDS[nilfs2]}" \
|
||||
"reiserfs" "${FS_CMDS[reiserfs]}" "xfs" "${FS_CMDS[xfs]}")"
|
||||
if [[ $choice == "$_Skip" ]]; then
|
||||
return 0
|
||||
elif [[ $choice == "" ]]; then
|
||||
@ -1667,6 +1710,8 @@ install_main() {
|
||||
# whether to use a custom mirror sorting command later
|
||||
update_mirrorlist_cmd || MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate"
|
||||
|
||||
choose_window_manager || return 1
|
||||
|
||||
# user can choose to bail at this point
|
||||
unpack_base_system || { initialize_variables; return 1; }
|
||||
UNPACKED_BASE=true
|
||||
@ -1688,11 +1733,7 @@ install_main() {
|
||||
update_system
|
||||
DONE_UPDATE=true
|
||||
else
|
||||
if pacman -Qsq archlabs-installer >/dev/null 2>&1; then
|
||||
chroot_cmd "pacman -Rs archlabs-installer --noconfirm" >/dev/null 2>&1
|
||||
elif [[ -d $MNT/installer ]]; then
|
||||
rm -rf $MNT/installer
|
||||
fi
|
||||
chroot_cmd "pacman -Rs archlabs-installer --noconfirm" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# these also only should need to be run once, when done jump to the config edit menu
|
||||
@ -1746,7 +1787,7 @@ EOF
|
||||
|
||||
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -exec rm '{}' \;
|
||||
rm -rf $MNT/etc/{mkinitcpio-archiso.conf,sudoers.d/g_wheel,polkit-1/rules.d/49-nopasswd_global.rules}
|
||||
rm -rf $MNT/usr/bin/{install-al,al-installer}
|
||||
# rm -rf $MNT/usr/bin/{install-al,al-installer}
|
||||
sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf
|
||||
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers
|
||||
cp -rf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
|
||||
@ -1761,26 +1802,52 @@ EOF
|
||||
return 0
|
||||
}
|
||||
|
||||
install_packages() {
|
||||
tput civis
|
||||
local pkgs="$WM_PACKAGES"
|
||||
[[ $LOGIN_TYPE == 'lightdm' ]] && pkgs="$pkgs lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||
|
||||
chroot_cmd "pacman -S $pkgs --needed --noconfirm" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" \
|
||||
--title " Install Packages " --progressbox "\nInstalling packages chosen during install setup.\n\n$pkgs" 30 90
|
||||
|
||||
[[ $LOGIN_TYPE == 'lightdm' ]] && setup_lightdm
|
||||
return 0
|
||||
}
|
||||
|
||||
setup_lightdm() {
|
||||
chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target' >/dev/null 2>&1
|
||||
|
||||
local cfg="$MNT/etc/lightdm/lightdm-gtk-greeter.conf"
|
||||
sed -i '/#background=/ c background=/usr/share/backgrounds/archlabs/archlabs.jpg' $cfg
|
||||
sed -i '/#theme-name=/ c theme-name=ArchLabs-dARK' $cfg
|
||||
sed -i '/#icon-theme-name=/ c icon-theme-name=ArchLabs-Light' $cfg
|
||||
sed -i '/#position=/ c position=34%,end 66%,end' $cfg
|
||||
sed -i '/#font-name=/ c font-name=DejaVu Sans Mono 11' $cfg
|
||||
sed -i '/\[greeter]/ a default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png' $cfg
|
||||
sed -i '/\[greeter]/ a active-monitor=0' $cfg
|
||||
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
chroot_cmd 'groupadd -r nopasswdlogin' >/dev/null 2>&1
|
||||
sed -i '/#%PAM-1.0/ a auth sufficient pam_succeed_if.so user ingroup nopasswdlogin' $MNT/etc/pam.d/lightdm
|
||||
sed -i "/#autologin-session=/ c autologin-session=${LOGIN_WM}" $MNT/etc/lightdm/lightdm.conf
|
||||
fi
|
||||
}
|
||||
|
||||
update_system() {
|
||||
local pkgcmd
|
||||
local upd="pacman -Syyu --noconfirm"
|
||||
local net="pacman -S iputils --noconfirm"
|
||||
local dev="pacman -S base-devel git --needed --noconfirm"
|
||||
pkgcmd="pacman -Syyu --noconfirm; pacman -S iputils --noconfirm; pacman -S base-devel git --needed --noconfirm"
|
||||
pkgcmd="pacman -Rs archlabs-installer --noconfirm; $pkgcmd"
|
||||
tput civis
|
||||
|
||||
if pacman -Qsq archlabs-installer >/dev/null 2>&1; then
|
||||
pkgcmd="pacman -Rs archlabs-installer --noconfirm ; $upd ; $net ; $dev"
|
||||
else
|
||||
pkgcmd="$upd ; $net ; $dev"
|
||||
fi
|
||||
|
||||
chroot_cmd "$pkgcmd" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" \
|
||||
--title " $_UpdSysTitle " --progressbox "$_UpdSysBody\n" 30 90
|
||||
|
||||
install_packages
|
||||
return 0
|
||||
}
|
||||
|
||||
update_mirrorlist_cmd() {
|
||||
if ! yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic Sort" "Customize Sort"; then
|
||||
|
||||
infobox "$_MirrorTitle" "\nGathering mirror countries..\n"
|
||||
local countries
|
||||
countries="$(reflector --list-countries | awk 'NF > 1 {print $1 " -"}')"
|
||||
@ -1788,9 +1855,8 @@ update_mirrorlist_cmd() {
|
||||
if [[ $countries != "" ]]; then
|
||||
tput civis
|
||||
local country
|
||||
country="$(dialog --cr-wrap --stdout --backtitle "$BT" --title "$_MirrorTitle" \
|
||||
--menu "$_MirrorCountry" 22 70 10 $countries)"
|
||||
[[ $? != 0 || $country == "" ]] && return 1
|
||||
country="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
|
||||
--title "$_MirrorTitle" --menu "$_MirrorCountry" 22 70 10 $countries)"
|
||||
MIRROR_CMD="reflector --country $country --score 80 --latest 40 --fastest 10 --sort rate"
|
||||
fi
|
||||
|
||||
@ -1803,9 +1869,8 @@ update_mirrorlist_cmd() {
|
||||
'delay': MirrorStatus delay."
|
||||
|
||||
tput cnorm
|
||||
MIRROR_CMD="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_MirrorTitle " \
|
||||
--inputbox "$_MirrorCmd\n\n$ref\n" 0 0 "$cmd")"
|
||||
[[ $? != 0 || $MIRROR_CMD == "" ]] && return 1
|
||||
MIRROR_CMD="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
|
||||
--title " $_MirrorTitle " --inputbox "$_MirrorCmd\n\n$ref\n" 0 0 "$cmd")"
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -2143,10 +2208,9 @@ edit_config_menu() {
|
||||
tput civis
|
||||
MENU_HIGHLIGHT=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_EditTitle " \
|
||||
--default-item $MENU_HIGHLIGHT --menu "$msg" 0 0 0 \
|
||||
"1" "keymaps" "2" "locale" "3" "hostname" "4" "sudoers" "5" "mkinitcpio.conf" \
|
||||
"6" "fstab" "7" "crypttab" "8" "$BOOTLOADER" "9" "pacman.conf" "10" "$_Done")
|
||||
|
||||
if [[ $MENU_HIGHLIGHT == "" || $MENU_HIGHLIGHT == 10 ]]; then
|
||||
"1" "$_Done" "2" "keymaps" "3" "locale" "4" "hostname" "5" "sudoers" \
|
||||
"6" "mkinitcpio.conf" "7" "fstab" "8" "crypttab" "9" "$BOOTLOADER" "10" "pacman.conf")
|
||||
if [[ $MENU_HIGHLIGHT == "" || $MENU_HIGHLIGHT == 1 ]]; then
|
||||
if [[ $FULL_DONE == true && $CONFIRM_DONE != true ]]; then
|
||||
CONFIRM_DONE=true
|
||||
wrap_up "$_InstFinBody" 'Exit & Reboot' 'Go Back' 'reboot'
|
||||
@ -2160,7 +2224,7 @@ edit_config_menu() {
|
||||
done
|
||||
|
||||
if [[ $existing_files != "" ]]; then
|
||||
if ! [[ $EDITOR_CHOICE ]] && [[ $DISPLAY ]] && hash geany >/dev/null 2>&1; then
|
||||
if [[ $EDITOR_CHOICE == "" && $DISPLAY ]] && hash geany >/dev/null 2>&1; then
|
||||
if yesno "$_EditTitle" "\nOpen file(s) in Geany or Vim?\n" "Geany" "Vim"; then
|
||||
EDITOR_CHOICE="geany -i"
|
||||
geany -i $existing_files
|
||||
@ -2168,7 +2232,7 @@ edit_config_menu() {
|
||||
EDITOR_CHOICE="vim -O"
|
||||
vim -O $existing_files
|
||||
fi
|
||||
elif [[ $EDITOR_CHOICE != "" ]]; then
|
||||
elif [[ $EDITOR_CHOICE ]]; then
|
||||
$EDITOR_CHOICE $existing_files
|
||||
else
|
||||
vim -O $existing_files
|
||||
|
@ -105,6 +105,17 @@ _MirrorSort="\nSorting the mirrorlist.\n\nThis will take a minute.\n"
|
||||
_MirrorCountry="\nSelect a country to use when sorting mirrors, the full command can be changed manually after\n\nNote: Your country may not have the fastest mirrors for your location.\n"
|
||||
_MirrorCmd="\nThe command below will be used to sort the mirrorlist, a short description of each option is provided, edit the command if needed.\n"
|
||||
|
||||
# window managers and packages
|
||||
_WMChoice="Select Window Managers or Desktop Environments"
|
||||
_WMChoiceBody="\nUse [Space] to select/deselect window manager(s) or desktop environment(s) to install.\n\nDepending on the choice additional packages may be installed to improve the experience."
|
||||
|
||||
_WMLogin="Select Login"
|
||||
_LoginTypeBody="\nUse console login (xinit) or a display manager (lightdm)?"
|
||||
_WMLoginBody="\nSelect which window manager or desktop to use for login."
|
||||
_AutoLoginBody="\nDo you want to automatically log in when the computer starts?"
|
||||
|
||||
_PackageChoice="Additional Packages"
|
||||
_PackageChoiceBody="\nUse [Space] to select/deselect additional packages to install."
|
||||
|
||||
## END NEW
|
||||
|
||||
|
Reference in New Issue
Block a user