Update, another attempted fix for hanging on shutdown

This commit is contained in:
natemaia
2018-11-08 00:25:02 -08:00
parent 7426259dc5
commit 3d41c04f36
14 changed files with 74 additions and 49 deletions

View File

@ -9,12 +9,12 @@
# set -n
# shellcheck disable=2154
# shellcheck disable=2154,2034
# globals {
# immutable values
readonly VER="1.7.12" # Installer version
readonly VER="1.7.13" # Installer version
readonly DIST="ArchLabs" # Linux distributor
readonly LIVE="liveuser" # Live session user
readonly MNT="/mnt/install" # Install mountpoint
@ -24,7 +24,8 @@ readonly ERR="/tmp/errlog" # Built-in error log
declare -g WARN=false
declare -g AUTOLOGIN=false
declare -g CONFIG_DONE=false
declare -gx SEPERATE_BOOT=false
declare -g SEPERATE_BOOT=false
declare -g HAS_NETWORK=false
declare -g BT="$DIST Installer - (x86_64) - Version $VER"
declare -g ROOT_PART=""
@ -299,7 +300,7 @@ select_login_method() {
if ! LOGIN_TYPE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_WMLogin " --menu "$_LoginTypeBody" 0 0 0 \
"xinit" "Console login without a display manager" \
"lightdm" "Lightweight display manager with the gtk greeter")"; then
"lightdm" "Lightweight display manager with a gtk greeter")"; then
return 1
fi
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
@ -503,20 +504,35 @@ configure_system_settings() {
tput civis
# shellcheck disable=SC2153
if ! LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"; then
if ! LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"; then
return 1
fi
select_timezone || return 1
select_mirrorlist_command || return 1
user_creation || return 1
select_wm_or_de || return 1
user_creation || return 1
tput civis
if ! KERNEL="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_KernelTitle " --menu "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then
return 1
if [[ $HAS_NETWORK == true ]]; then
if ! KERNEL="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_KernelTitle " --menu "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then
return 1
fi
select_wm_or_de || return 1
select_extra_packages || return 1
select_mirrorlist_command || return 1
else
# defaults for when there is no network connection
KERNEL='linux'
AUTOLOGIN=true
LOGIN_TYPE='xinit'
INSTALL_WMS='openbox'
LOGIN_WM='openbox-session'
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate --verbose"
EDIT_FILES[11]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.zprofile /home/$NEWUSER/.xprofile"
fi
select_extra_packages || return 1
export CONFIG_DONE=true
return 0
}

View File

@ -24,14 +24,18 @@ install() {
echeck "genfstab -U $MNT > $MNT/etc/fstab"
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
# update the mirrorlist.. MUST be done before updating or it may be slow
oneshot mirrorlist_sort
if [[ $HAS_NETWORK == true ]]; then
# update the mirrorlist.. MUST be done before updating or it may be slow
oneshot mirrorlist_sort
# MUST be before bootloader and mkinitcpio
oneshot package_operations
# MUST be before bootloader and mkinitcpio
oneshot package_operations
# set up user login.. MUST be done after package operation
oneshot login_manager
# set up user login.. MUST be done after package operation
oneshot login_manager
else
chrun 'pacman -Rns archlabs-installer --noconfirm'
fi
# mkinitcpio and bootloader install should only be done after installing the packages
# and updating the mirrorlist, otherwise the chosen kernel may not be fully set up
@ -178,12 +182,6 @@ icon-theme-name=Adwaita
font-name=DejaVu Sans Mono 11
position=30%,end 50%,end
EOF
# if [[ $AUTOLOGIN == true ]]; then
# chrun "groupadd -r nopasswdlogin && usermod -aG nopasswdlogin $LIVE"
# 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
# sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
# fi
else # xinit login
sed -i "s/openbox-session/${LOGIN_WM}/g" $MNT/home/$LIVE/.xinitrc
if grep -q '#exec' $MNT/home/$LIVE/.zprofile; then

View File

@ -42,7 +42,9 @@ mount_install_partitions() {
unmount_install_partitions() {
swapoff -a
umount -R $MNT # >/dev/null 2>&1
if [[ -d $MNT ]]; then
umount -R $MNT # >/dev/null 2>&1
fi
}
select_swap() {
@ -178,7 +180,7 @@ select_filesystem() {
"reiserfs" "${FS_CMDS[reiserfs]}" "xfs" "${FS_CMDS[xfs]}")"
[[ $fs == "$_Skip" ]] && return 0 || { [[ $fs == "" ]] && return 1; }
if yesno "$_FSTitle" "\nFormat $part as $fs?\n"; then
if yesno "$_FSTitle" "\nFormat $part as $fs?\n" "Format" "Go Back"; then
format $part $fs
else
select_filesystem $part || return 1

View File

@ -30,8 +30,14 @@ ssd() {
die() {
tput cnorm
fuser -km $MNT # >/dev/null 2>&1
unmount_install_partitions
if [[ -d $MNT ]] && cd; then
fuser -km $MNT
unmount_install_partitions
if ! [[ $1 =~ [0-9] ]]; then
fuser -km /run/archiso/bootmnt
umount -l /run/archiso/bootmnt
fi
fi
[[ $1 =~ [0-9] ]] && exit $1 || $1
}
@ -141,10 +147,13 @@ checks() {
if ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then
if [[ $(systemctl is-active NetworkManager) == "active" ]] && hash nmtui >/dev/null 2>&1; then
tput civis; nmtui
tput civis; nmtui-connect
if curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then
export HAS_NETWORK=true
else
infobox "$_ErrTitle" "$_NoNetwork" 3
fi
fi
curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200' ||
infobox "$_ErrTitle" "$_NoNetwork\n"
fi
return 0
}