More regression fixes

This commit is contained in:
natemaia 2018-09-01 13:39:24 -07:00
parent fe1749bed5
commit 989a952751
4 changed files with 84 additions and 74 deletions

View File

@ -12,7 +12,7 @@
# immutable variables {
readonly DIST="ArchLabs" # Linux distributor
readonly VER="1.6.70" # Installer version
readonly VER="1.6.73" # Installer version
readonly LIVE="liveuser" # Live session user
readonly MNT="/mnt/install" # Install mountpoint
readonly ERR="/tmp/errlog" # Built-in error log
@ -48,7 +48,7 @@ elif [[ $(grep 'AuthenticAMD' /proc/cpuinfo) ]]; then
fi
# create associative array for SUBZONES[zone]
declare -A SUBZONES
declare -gA SUBZONES
for zone in America Australia Asia Atlantic Africa Europe Indian Pacific Arctic Antarctica; do
SUBZONES[$zone]="$(awk "/$zone\// {gsub(/$zone\//, \"\"); print \$3 \" \"\$1}" /usr/share/zoneinfo/zone.tab)"
done
@ -76,22 +76,22 @@ tz Swahili ke Swahili bw Tswana ph Filipino id Indonesian my Malay tm Turkmen bt
lv Latvian md Moldavian mao Maori by Belarusian me Montenegrin mk Macedonian kh Khmer
az Azerbaijani"
declare -Ar BMNTS=(
declare -Agr BMNTS=(
[UEFI-grub]="/boot/efi" [UEFI-systemd-boot]="/boot" [BIOS-grub]="/boot"
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/boot"
)
declare -Ar BOOTLDRS=([BIOS]="grub ${BMNTS[BIOS-grub]} syslinux ${BMNTS[BIOS-syslinux]}"
declare -Agr BOOTLDRS=([BIOS]="grub ${BMNTS[BIOS-grub]} syslinux ${BMNTS[BIOS-syslinux]}"
[UEFI]="grub ${BMNTS[UEFI-grub]} systemd-boot ${BMNTS[UEFI-systemd-boot]} syslinux ${BMNTS[UEFI-syslinux]}"
)
declare -Ar FS_CMDS=(
declare -Agr FS_CMDS=(
[ext2]="mkfs.ext2 -q" [ext3]="mkfs.ext3 -q" [ext4]="mkfs.ext4 -q"
[f2fs]="mkfs.f2fs" [jfs]="mkfs.jfs -q" [xfs]="mkfs.xfs -f" [nilfs2]="mkfs.nilfs2 -q"
[ntfs]="mkfs.ntfs -q" [reiserfs]="mkfs.reiserfs -q" [vfat]="mkfs.vfat -F32"
)
declare -Ar FS_OPTS=([vfat]="" [ntfs]="" [ext2]="" [ext3]=""
declare -Agr FS_OPTS=([vfat]="" [ntfs]="" [ext2]="" [ext3]=""
[ext4]="dealloc - off discard - off nofail - off noacl - off relatime - off noatime - off nobarrier - off nodelalloc - off"
[jfs]="discard - off errors=continue - off errors=panic - off nointegrity - off"
[reiserfs]="acl - off nolog - off notail - off replayonly - off user_xattr - off"
@ -103,39 +103,39 @@ declare -Ar FS_OPTS=([vfat]="" [ntfs]="" [ext2]="" [ext3]=""
# }
init_variables() {
BT="$DIST Installer - (x86_64) - Version $VER"
ROOT_PART=""
BOOT_DEVICE=""
BOOT_PART=""
BOOTLDR=""
EXTRA_MNT=""
EXTRA_MNTS=""
SWAP="none"
SWAP_SIZE="${SYS_MEM}M"
NEWUSER=""
USER_PASS=""
ROOT_PASS=""
LOGIN_WM=""
LOGIN_TYPE=""
INSTALL_WMS=""
KERNEL="linux"
WM_PACKAGES=""
EXTRA_PACKAGES=""
MKINIT_HOOKS="shutdown"
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate"
declare -g BT="$DIST Installer - (x86_64) - Version $VER"
declare -g ROOT_PART=""
declare -g BOOT_DEVICE=""
declare -g BOOT_PART=""
declare -g BOOTLDR=""
declare -g EXTRA_MNT=""
declare -g EXTRA_MNTS=""
declare -g SWAP="none"
declare -g SWAP_SIZE="${SYS_MEM}M"
declare -g NEWUSER=""
declare -g USER_PASS=""
declare -g ROOT_PASS=""
declare -g LOGIN_WM=""
declare -g LOGIN_TYPE=""
declare -g INSTALL_WMS=""
declare -g KERNEL="linux"
declare -g WM_PACKAGES=""
declare -g EXTRA_PACKAGES=""
declare -g MKINIT_HOOKS="shutdown"
declare -g MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate"
IS_64BIT=false
AUTOLOGIN=false
CONFIG_DONE=false
SEPERATE_BOOT=false
declare -g IS_64BIT=false
declare -g AUTOLOGIN=false
declare -g CONFIG_DONE=false
declare -g SEPERATE_BOOT=false
declare -A BCMDS=(
declare -gA BCMDS=(
[syslinux]="syslinux-install_update -iam"
[grub]="grub-install --recheck --force"
[systemd-boot]="bootctl --path=/boot install"
)
declare -A FILES=(
declare -gA FILES=(
[2]="/etc/X11/xorg.conf.d/00-keyboard.conf /etc/default/keyboard /etc/vconsole.conf"
[3]="/etc/locale.conf /etc/default/locale"
[4]="/etc/hostname /etc/hosts"
@ -481,6 +481,7 @@ Boot Partition: $BOOT_PART
Bootloader: $BOOTLDR
Boot Mount: ${BMNTS[$SYS-$BOOTLDR]}
Boot Command: ${BCMDS[$BOOTLDR]}
Swap: $SWAP
Extra: $EXTRA_MNTS

View File

@ -20,14 +20,30 @@ select_boot_setup() {
if [[ $BOOTLDR == 'systemd-boot' ]]; then
FILES[9]="/boot/loader/entries/$DIST.conf"
elif [[ $BOOTLDR == 'syslinux' && $SYS == 'BIOS' ]]; then
BCMDS[$BOOTLDR]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
"syslinux-install_update -i" "Install to root partition (/)")"
[[ $? != 0 || ${BCMDS[$BOOTLDR]} == "" ]] && return 1
elif [[ $BOOTLDR == 'syslinux' ]]; then
if [[ $SYS == 'BIOS' ]]; then
FILES[9]="/boot/syslinux/syslinux.cfg"
BCMDS[$BOOTLDR]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
"syslinux-install_update -i" "Install to root partition (/)")"
[[ $? != 0 || ${BCMDS[$BOOTLDR]} == "" ]] && return 1
else
FILES[9]="/boot/EFI/syslinux/syslinux.cfg"
BCMDS[syslinux]="efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST"
fi
else
FILES[9]="/etc/default/grub"
if [[ $SYS == 'UEFI' ]]; then
local ttype
[[ $IS_64BIT != true ]] && ttype='i386-efi' || ttype='x86_64-efi'
BCMDS[grub]="${BCMDS[grub]} --target=$ttype --bootloader-id=$DIST"
else
BCMDS[grub]="${BCMDS[grub]} --target=i386-pc $BOOT_DEVICE"
fi
BCMDS[grub]="${BCMDS[grub]} && grub-mkconfig -o /boot/grub/grub.cfg"
fi
return 0
@ -77,16 +93,6 @@ uefi_boot_fallback() {
prep_for_grub() {
local cfg="$MNT/etc/default/grub"
if [[ $SYS == 'UEFI' ]]; then
local ttype
[[ $IS_64BIT != true ]] && ttype='i386-efi' || ttype='x86_64-efi'
BCMDS[grub]="${BCMDS[grub]} --target=$ttype --bootloader-id=$DIST"
else
BCMDS[grub]="${BCMDS[grub]} --target=i386-pc $BOOT_DEVICE"
fi
BCMDS[grub]="${BCMDS[grub]} && grub-mkconfig -o /boot/grub/grub.cfg"
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg
@ -113,14 +119,12 @@ default $DIST
timeout 5
editor no
EOF
cat > $MNT/boot/loader/entries/${DIST}.conf << EOF
title $DIST Linux
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && echo -en "\ninitrd /$UCODE")
initrd /initramfs-$KERNEL.img
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && echo -n "$LUKS_DEV")rw
EOF
# add pacman hook to update the bootloader when systemd receives an update
mkdir -p $MNT/pacman.d/hooks
cat > $MNT/pacman.d/hooks/systemd-boot.hook << EOF
@ -140,15 +144,16 @@ EOF
}
prep_for_syslinux() {
local cfgdir="$MNT/boot/syslinux"
local cfgsrcdir="/usr/lib/syslinux/bios/"
FILES[9]="/boot/syslinux/syslinux.cfg"
if [[ $SYS == 'UEFI' ]]; then
FILES[9]="/boot/EFI/syslinux/syslinux.cfg"
BCMDS[syslinux]="efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST"
cfgdir="$MNT/boot/EFI/syslinux"
cfgsrcdir="/usr/lib/syslinux/efi64/"
local cfgdir="$MNT/boot/EFI/syslinux"
if [[ $IS_64BIT == true ]]; then
local cfgsrcdir="/usr/lib/syslinux/efi64/"
else
local cfgsrcdir="/usr/lib/syslinux/efi32/"
fi
else
local cfgdir="$MNT/boot/syslinux"
local cfgsrcdir="/usr/lib/syslinux/bios/"
fi
mkdir -p $cfgdir
@ -190,7 +195,7 @@ install_bootloader() {
[[ $SYS == 'UEFI' ]] && find $MNT${BMNTS[$SYS-$BOOTLDR]}/EFI/ -maxdepth 1 -mindepth 1 \
-name '[aA][rR][cC][hH][lL]abs' -type d -exec rm -rf '{}' \; >/dev/null 2>&1
# sets up the bootloader config(s) and ${BCMDS[$BOOTLDR]}
# sets up the bootloader configs
prep_for_$BOOTLDR
# run the bootloader command

View File

@ -13,25 +13,21 @@ install_main() {
genfstab -U $MNT > $MNT/etc/fstab 2>$ERR
check_for_errors "genfstab -U $MNT > $MNT/etc/fstab"
# touch up fstab if we used a swapfile
# touch up /etc/fstab if we used a swapfile
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
# update the mirrorlist, if this isn't done before updating or it may be slow
# update the mirrorlist
# MUST be done before updating or it may be slow
local cmdtail="--verbose --save $MNT/etc/pacman.d/mirrorlist"
$MIRROR_CMD $cmdtail || reflector --score 100 -l 50 -f 10 --sort rate $cmdtail
oneshot update_system # MUST be before bootloader and mkinitcpio
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
oneshot setup_lightdm
fi
run_mkinitcpio || return 1
install_bootloader || return 1
oneshot update_system # MUST be before bootloader and mkinitcpio
[[ $LOGIN_TYPE == 'lightdm' ]] && oneshot setup_lightdm
run_mkinitcpio
install_bootloader
chroot_cmd "hwclock --systohc --utc" || chroot_cmd "hwclock --systohc --utc --directisa"
oneshot create_user || return 1
oneshot create_user
return 0
}
@ -141,7 +137,10 @@ create_user() {
rm -rf $service
fi
sed -i "s/openbox-session/${LOGIN_WM}/g" $_home/.xinitrc
sed -i 's|exec sudo archlabs-installer|exec startx -- vt1 &>/dev/null|' $_home/.zprofile
sed -i '/archlabs-installer/d' $_home/.zprofile
cat >> $_home/.zprofile << EOF
[[ -z \$DISPLAY && \$XDG_VTNR -eq 1 ]] && exec startx -- vt1 &>/dev/null
EOF
fi
sed -i "s/${LIVE}/${NEWUSER}/g" $_home/.config/gtk-3.0/bookmarks $_home/.mozilla/firefox/archlabs.default/{prefs,sessionstore}.js

View File

@ -19,7 +19,7 @@ identify_system() {
if [[ -d /sys/firmware/efi ]]; then
SYS="UEFI"
[[ $(mount) =~ $EFI ]] && mount -t efivarfs efivarfs $EFI >/dev/null 2>&1
# [[ $(mount) =~ $EFI ]] && mount -t efivarfs efivarfs $EFI >/dev/null 2>&1
local bitness
bitness=$(cat /sys/firmware/efi/fw_platform_size)
@ -32,7 +32,12 @@ identify_system() {
SYS="BIOS"
fi
readonly BT="$DIST Installer - $SYS (x86_64) - Version $VER"
if [[ $IS_64BIT == true ]]; then
readonly BT="$DIST Installer - $SYS (i686) - Version $VER"
else
readonly BT="$DIST Installer - $SYS (x86_64) - Version $VER"
fi
return 0
}
check_requirements() {