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 { # immutable variables {
readonly DIST="ArchLabs" # Linux distributor 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 LIVE="liveuser" # Live session user
readonly MNT="/mnt/install" # Install mountpoint readonly MNT="/mnt/install" # Install mountpoint
readonly ERR="/tmp/errlog" # Built-in error log readonly ERR="/tmp/errlog" # Built-in error log
@ -48,7 +48,7 @@ elif [[ $(grep 'AuthenticAMD' /proc/cpuinfo) ]]; then
fi fi
# create associative array for SUBZONES[zone] # 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 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)" SUBZONES[$zone]="$(awk "/$zone\// {gsub(/$zone\//, \"\"); print \$3 \" \"\$1}" /usr/share/zoneinfo/zone.tab)"
done 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 lv Latvian md Moldavian mao Maori by Belarusian me Montenegrin mk Macedonian kh Khmer
az Azerbaijani" az Azerbaijani"
declare -Ar BMNTS=( declare -Agr BMNTS=(
[UEFI-grub]="/boot/efi" [UEFI-systemd-boot]="/boot" [BIOS-grub]="/boot" [UEFI-grub]="/boot/efi" [UEFI-systemd-boot]="/boot" [BIOS-grub]="/boot"
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/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]}" [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" [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" [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" [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" [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" [jfs]="discard - off errors=continue - off errors=panic - off nointegrity - off"
[reiserfs]="acl - off nolog - off notail - off replayonly - off user_xattr - 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() { init_variables() {
BT="$DIST Installer - (x86_64) - Version $VER" declare -g BT="$DIST Installer - (x86_64) - Version $VER"
ROOT_PART="" declare -g ROOT_PART=""
BOOT_DEVICE="" declare -g BOOT_DEVICE=""
BOOT_PART="" declare -g BOOT_PART=""
BOOTLDR="" declare -g BOOTLDR=""
EXTRA_MNT="" declare -g EXTRA_MNT=""
EXTRA_MNTS="" declare -g EXTRA_MNTS=""
SWAP="none" declare -g SWAP="none"
SWAP_SIZE="${SYS_MEM}M" declare -g SWAP_SIZE="${SYS_MEM}M"
NEWUSER="" declare -g NEWUSER=""
USER_PASS="" declare -g USER_PASS=""
ROOT_PASS="" declare -g ROOT_PASS=""
LOGIN_WM="" declare -g LOGIN_WM=""
LOGIN_TYPE="" declare -g LOGIN_TYPE=""
INSTALL_WMS="" declare -g INSTALL_WMS=""
KERNEL="linux" declare -g KERNEL="linux"
WM_PACKAGES="" declare -g WM_PACKAGES=""
EXTRA_PACKAGES="" declare -g EXTRA_PACKAGES=""
MKINIT_HOOKS="shutdown" declare -g MKINIT_HOOKS="shutdown"
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate" declare -g MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate"
IS_64BIT=false declare -g IS_64BIT=false
AUTOLOGIN=false declare -g AUTOLOGIN=false
CONFIG_DONE=false declare -g CONFIG_DONE=false
SEPERATE_BOOT=false declare -g SEPERATE_BOOT=false
declare -A BCMDS=( declare -gA BCMDS=(
[syslinux]="syslinux-install_update -iam" [syslinux]="syslinux-install_update -iam"
[grub]="grub-install --recheck --force" [grub]="grub-install --recheck --force"
[systemd-boot]="bootctl --path=/boot install" [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" [2]="/etc/X11/xorg.conf.d/00-keyboard.conf /etc/default/keyboard /etc/vconsole.conf"
[3]="/etc/locale.conf /etc/default/locale" [3]="/etc/locale.conf /etc/default/locale"
[4]="/etc/hostname /etc/hosts" [4]="/etc/hostname /etc/hosts"
@ -481,6 +481,7 @@ Boot Partition: $BOOT_PART
Bootloader: $BOOTLDR Bootloader: $BOOTLDR
Boot Mount: ${BMNTS[$SYS-$BOOTLDR]} Boot Mount: ${BMNTS[$SYS-$BOOTLDR]}
Boot Command: ${BCMDS[$BOOTLDR]}
Swap: $SWAP Swap: $SWAP
Extra: $EXTRA_MNTS Extra: $EXTRA_MNTS

View File

@ -20,14 +20,30 @@ select_boot_setup() {
if [[ $BOOTLDR == 'systemd-boot' ]]; then if [[ $BOOTLDR == 'systemd-boot' ]]; then
FILES[9]="/boot/loader/entries/$DIST.conf" FILES[9]="/boot/loader/entries/$DIST.conf"
elif [[ $BOOTLDR == 'syslinux' && $SYS == 'BIOS' ]]; then elif [[ $BOOTLDR == 'syslinux' ]]; then
if [[ $SYS == 'BIOS' ]]; then
FILES[9]="/boot/syslinux/syslinux.cfg"
BCMDS[$BOOTLDR]="$(dialog --cr-wrap --stdout --backtitle "$BT" \ BCMDS[$BOOTLDR]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \ --title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \ "syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
"syslinux-install_update -i" "Install to root partition (/)")" "syslinux-install_update -i" "Install to root partition (/)")"
[[ $? != 0 || ${BCMDS[$BOOTLDR]} == "" ]] && return 1 [[ $? != 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 else
FILES[9]="/etc/default/grub" 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 fi
return 0 return 0
@ -77,16 +93,6 @@ uefi_boot_fallback() {
prep_for_grub() { prep_for_grub() {
local cfg="$MNT/etc/default/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; sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg
@ -113,14 +119,12 @@ default $DIST
timeout 5 timeout 5
editor no editor no
EOF EOF
cat > $MNT/boot/loader/entries/${DIST}.conf << EOF cat > $MNT/boot/loader/entries/${DIST}.conf << EOF
title $DIST Linux title $DIST Linux
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && echo -en "\ninitrd /$UCODE") linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && echo -en "\ninitrd /$UCODE")
initrd /initramfs-$KERNEL.img initrd /initramfs-$KERNEL.img
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && echo -n "$LUKS_DEV")rw options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && echo -n "$LUKS_DEV")rw
EOF EOF
# add pacman hook to update the bootloader when systemd receives an update # add pacman hook to update the bootloader when systemd receives an update
mkdir -p $MNT/pacman.d/hooks mkdir -p $MNT/pacman.d/hooks
cat > $MNT/pacman.d/hooks/systemd-boot.hook << EOF cat > $MNT/pacman.d/hooks/systemd-boot.hook << EOF
@ -140,15 +144,16 @@ EOF
} }
prep_for_syslinux() { prep_for_syslinux() {
if [[ $SYS == 'UEFI' ]]; then
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 cfgdir="$MNT/boot/syslinux"
local cfgsrcdir="/usr/lib/syslinux/bios/" 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/"
fi fi
mkdir -p $cfgdir mkdir -p $cfgdir
@ -190,7 +195,7 @@ install_bootloader() {
[[ $SYS == 'UEFI' ]] && find $MNT${BMNTS[$SYS-$BOOTLDR]}/EFI/ -maxdepth 1 -mindepth 1 \ [[ $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 -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 prep_for_$BOOTLDR
# run the bootloader command # run the bootloader command

View File

@ -13,25 +13,21 @@ install_main() {
genfstab -U $MNT > $MNT/etc/fstab 2>$ERR genfstab -U $MNT > $MNT/etc/fstab 2>$ERR
check_for_errors "genfstab -U $MNT > $MNT/etc/fstab" 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 [[ -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" local cmdtail="--verbose --save $MNT/etc/pacman.d/mirrorlist"
$MIRROR_CMD $cmdtail || reflector --score 100 -l 50 -f 10 --sort rate $cmdtail $MIRROR_CMD $cmdtail || reflector --score 100 -l 50 -f 10 --sort rate $cmdtail
oneshot update_system # MUST be before bootloader and mkinitcpio oneshot update_system # MUST be before bootloader and mkinitcpio
if [[ $LOGIN_TYPE == 'lightdm' ]]; then [[ $LOGIN_TYPE == 'lightdm' ]] && oneshot setup_lightdm
oneshot setup_lightdm run_mkinitcpio
fi install_bootloader
run_mkinitcpio || return 1
install_bootloader || return 1
chroot_cmd "hwclock --systohc --utc" || chroot_cmd "hwclock --systohc --utc --directisa" chroot_cmd "hwclock --systohc --utc" || chroot_cmd "hwclock --systohc --utc --directisa"
oneshot create_user
oneshot create_user || return 1
return 0 return 0
} }
@ -141,7 +137,10 @@ create_user() {
rm -rf $service rm -rf $service
fi fi
sed -i "s/openbox-session/${LOGIN_WM}/g" $_home/.xinitrc 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 fi
sed -i "s/${LIVE}/${NEWUSER}/g" $_home/.config/gtk-3.0/bookmarks $_home/.mozilla/firefox/archlabs.default/{prefs,sessionstore}.js 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 if [[ -d /sys/firmware/efi ]]; then
SYS="UEFI" 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 local bitness
bitness=$(cat /sys/firmware/efi/fw_platform_size) bitness=$(cat /sys/firmware/efi/fw_platform_size)
@ -32,7 +32,12 @@ identify_system() {
SYS="BIOS" SYS="BIOS"
fi fi
if [[ $IS_64BIT == true ]]; then
readonly BT="$DIST Installer - $SYS (i686) - Version $VER"
else
readonly BT="$DIST Installer - $SYS (x86_64) - Version $VER" readonly BT="$DIST Installer - $SYS (x86_64) - Version $VER"
fi
return 0
} }
check_requirements() { check_requirements() {