Fix various issues

This commit is contained in:
natemaia 2020-05-03 12:47:39 -07:00
parent 87ffbdcb42
commit 2208c3afba

View File

@ -7,7 +7,7 @@
# shellcheck disable=SC2086,SC2046,SC2254 # shellcheck disable=SC2086,SC2046,SC2254
VER=2.1.40 VER=2.1.41
# default values { # default values {
@ -1039,7 +1039,7 @@ part_format()
local delay="$3" local delay="$3"
shift 3 shift 3
msg "Format" "\nFormatting $(part_pretty "$part") as $fs\n" 0 msg "File System Format" "\nFormatting\n\npart: $(part_pretty "$part")\n\nfs: $fs\n" 0
mkfs.$fs ${FS_CMD_FLAGS[$fs]} "$part" > /dev/null 2> "$ERR" mkfs.$fs ${FS_CMD_FLAGS[$fs]} "$part" > /dev/null 2> "$ERR"
errshow 0 "mkfs.$fs ${FS_CMD_FLAGS[$fs]} '$part' > /dev/null" || return 1 errshow 0 "mkfs.$fs ${FS_CMD_FLAGS[$fs]} '$part' > /dev/null" || return 1
sleep "$delay" sleep "$delay"
@ -1386,42 +1386,31 @@ select_filesystem()
{ {
local part="$1" local part="$1"
local fs='' local fs=''
local cur txt local cur txt pt
pt="$(part_pretty "$part")"
cur="$(lsblk -lno FSTYPE "$part" 2> /dev/null)" cur="$(lsblk -lno FSTYPE "$part" 2> /dev/null)"
txt="\nSelect which filesystem to use for: $(part_pretty "$part")\n\nDefault: ext4" txt="\nSelect which file system to use\n\npart: $pt\n\nfs default: ext4"
if [[ $cur ]]; then
# bail early if the partition was created in part_auto() # bail early if the partition was created in part_auto()
[[ $cur && $part == "$AUTO_ROOT" ]] && return 0 [[ $part == "$AUTO_ROOT" ]] && return 0
[[ $part != "$ROOT" ]] && txt+="\nCurrent: $cur"
fi
until [[ $fs ]]; do until [[ $fs ]]; do
if [[ $cur && $part != "$ROOT" ]]; then dlg fs menu "File System" "$txt" $([[ $cur && $part != "$ROOT" ]] && printf "skip -") \
dlg fs menu "Filesystem" "$txt\nCurrent: $cur" \
skip - \
ext4 "The evolution of the most used Linux file system, successor to Ext3" \ ext4 "The evolution of the most used Linux file system, successor to Ext3" \
ext3 "3rd extended file system, successor to Ext2" \ ext3 "Third extended file system, successor to Ext2" \
ext2 "2nd extended filesystem, unlike 3/4 it is not journaled and largely obsolete" \ ext2 "Second extended file system, unlike 3/4 it is not journaled and obsolete" \
vfat "A legacy file system which is simple and robust" \ vfat "File allocation table, a legacy file system which is simple and robust" \
ntfs "Windows NT file system" \ ntfs "NT file system, a journaling file system created by Microsoft" \
f2fs "Flash-friendly file system, intended for NAND-based flash memory" \ f2fs "Flash-friendly file system, intended for NAND-based flash memory" \
jfs "Journaled file system created by IBM" \ jfs "Journaled file system created by IBM and open-sourced in 1999" \
xfs "Journaling file system created by Silicon Graphics (SGI)" \ xfs "Journaled file system created by Silicon Graphics Inc. (SGI)" \
nilfs2 "A log-structured file system implementation for the Linux kernel" \ nilfs2 "A log-structured file system implementation for the Linux kernel" \
reiserfs "Journaled file system initially created by a team at Namesys led by Hans Reiser" || return 1 reiserfs "Journaled file system created by a team at Namesys led by Hans Reiser" || return 1
else
dlg fs menu "Filesystem" "$txt" \
ext4 "The evolution of the most used Linux filesystem, successor to Ext3" \
ext3 "3rd extended file system, successor to Ext2" \
ext2 "2nd extended filesystem, unlike 3/4 it is not journaled and largely obsolete" \
vfat "A legacy file system which is simple and robust" \
ntfs "Windows NT file system" \
f2fs "Flash-friendly file system, intended for NAND-based flash memory" \
jfs "Journaled file system created by IBM" \
xfs "Journaling file system created by Silicon Graphics (SGI)" \
nilfs2 "A log-structured file system implementation for the Linux kernel" \
reiserfs "Journaled file system initially created by a team at Namesys led by Hans Reiser" || return 1
fi
[[ $fs == 'skip' ]] && return 0 [[ $fs == 'skip' ]] && return 0
yesno "Filesystem" "\nFormat $(part_pretty "$part") as $fs?\n" || fs='' yesno "File System" "\nConfirm Format\n\npart: $pt\n\nfs: $fs\n" || fs=''
done done
part_format "$part" "$fs" 0 part_format "$part" "$fs" 0
} }
@ -1457,7 +1446,12 @@ install_main()
chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa" chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa"
install_user install_user
install_login install_login
# allow members of the wheel group to run commands as root
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" "$MNT/etc/sudoers"
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER" chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
if [[ "$USER_CMD" ]]; then if [[ "$USER_CMD" ]]; then
chrun "$USER_CMD" 2> "$ERR" 2>&1 chrun "$USER_CMD" 2> "$ERR" 2>&1
errshow 0 "chrun '$USER_CMD'" errshow 0 "chrun '$USER_CMD'"
@ -1506,7 +1500,10 @@ install_base()
unset BG_PID unset BG_PID
fi fi
if (( PACSTRAP )); then mkdir -pv "$MNT/etc/default"
mkdir -pv "$MNT/etc/X11/xorg.conf.d/"
if [[ $PACSTRAP == 1 ]]; then
cp -vf /etc/modprobe.d/* "$MNT/etc/modprobe.d/" cp -vf /etc/modprobe.d/* "$MNT/etc/modprobe.d/"
cp -vf /etc/X11/xorg.conf.d/* "$MNT/etc/X11/xorg.conf.d/" cp -vf /etc/X11/xorg.conf.d/* "$MNT/etc/X11/xorg.conf.d/"
# we have some customizations in /etc on the iso we want to preserve # we have some customizations in /etc on the iso we want to preserve
@ -1547,14 +1544,12 @@ install_base()
# allow members of the wheel group to run commands as root # allow members of the wheel group to run commands as root
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" "$MNT/etc/sudoers" sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" "$MNT/etc/sudoers"
mkdir -pv "$MNT/etc/default"
echo "LANG=$LOCALE" > "$MNT/etc/locale.conf" echo "LANG=$LOCALE" > "$MNT/etc/locale.conf"
cp -fv "$MNT/etc/locale.conf" "$MNT/etc/default/locale" cp -fv "$MNT/etc/locale.conf" "$MNT/etc/default/locale"
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" "$MNT/etc/locale.gen" sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" "$MNT/etc/locale.gen"
chrun "locale-gen" chrun "locale-gen"
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime" chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime"
mkdir -pv "$MNT/etc/X11/xorg.conf.d"
cat > "$MNT/etc/X11/xorg.conf.d/00-keyboard.conf" <<- EOF cat > "$MNT/etc/X11/xorg.conf.d/00-keyboard.conf" <<- EOF
# Use localectl(1) to instruct systemd-localed to update it. # Use localectl(1) to instruct systemd-localed to update it.
Section "InputClass" Section "InputClass"
@ -1965,7 +1960,7 @@ install_background()
( (
install_mirrorlist "/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1 install_mirrorlist "/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1
if (( PACSTRAP )); then if [[ $PACSTRAP == 1 ]]; then
pacstrap /mnt >> /tmp/bgout 2>&1 pacstrap /mnt >> /tmp/bgout 2>&1
else else
rsync -avh /run/archiso/sfs/airootfs/ "$MNT/" >> /tmp/bgout 2>&1 rsync -avh /run/archiso/sfs/airootfs/ "$MNT/" >> /tmp/bgout 2>&1
@ -1976,7 +1971,7 @@ install_background()
cp /etc/pacman.d/mirrorlist "$MNT/etc/pacman.d/mirrorlist" cp /etc/pacman.d/mirrorlist "$MNT/etc/pacman.d/mirrorlist"
al_repo "$MNT/etc/pacman.conf" al_repo "$MNT/etc/pacman.conf"
if (( PACSTRAP )); then if [[ $PACSTRAP == 1 ]]; then
chrun "pacman -S ${ISO_PKGS[*]} $net $luks --noconfirm --needed" >> /tmp/bgout 2>&1 chrun "pacman -S ${ISO_PKGS[*]} $net $luks --noconfirm --needed" >> /tmp/bgout 2>&1
else else
chrun "pacman -Syyu $net --noconfirm --needed" >> /tmp/bgout 2>&1 chrun "pacman -Syyu $net --noconfirm --needed" >> /tmp/bgout 2>&1
@ -2228,7 +2223,7 @@ prerun_systemd-boot()
mkdir -pv "$MNT/boot/loader/entries" mkdir -pv "$MNT/boot/loader/entries"
cat > "$MNT/boot/loader/loader.conf" <<- EOF cat > "$MNT/boot/loader/loader.conf" <<- EOF
default $DIST default $DIST.conf
timeout 5 timeout 5
editor no editor no
EOF EOF