Test: tmpfs for /run and mount efivarfs in chroot for grub

This commit is contained in:
natemaia 2019-01-18 15:40:05 -08:00
parent 94054f9ada
commit 9c9c845271
2 changed files with 23 additions and 33 deletions

View File

@ -134,7 +134,7 @@ _PartBody="\nWhole device auto partitioning is available for beginners.\n\nUEFI
_PartBody1="\nWARNING:\n\nALL data on"
_PartBody2="will be destroyed and the following partitions will be created\n\n- A 512M vfat/fat32 boot partition with boot flags enabled.\n- An ext4 partition using all remaining space"
_PartBody3="\n\nDo you want to continue?\n"
_PartWipeBody2="will be destroyed using 'wipe -Ifre'.\n\nThis process can take a long time depending on the size of the drive.\n\nDo you want to continue?\n"
_PartWipeBody="will be destroyed using 'wipe -Ifre'.\n\nThis process can take a long time depending on the size of the drive.\n\nDo you want to continue?\n"
# bootloader
_InstSysTitle="Install Syslinux"

View File

@ -892,7 +892,7 @@ partition()
msgbox "$_PrepShowDev" "\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT "$device")\n"
partition "$device"
elif [[ $choice == "$_PartWipe" ]]; then
yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2" && wipe -Ifrev $device
yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody" && wipe -Ifrev $device
partition "$device"
else
local root_size msg ret table boot_fs
@ -1239,9 +1239,7 @@ select_swap()
select_mountpoint()
{
tput cnorm
if ! EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/" nolimit)"; then
return 1
fi
EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/" nolimit)" || return 1
# bad mountpoint
if [[ ${EXTRA_MNT:0:1} != "/" || ${#EXTRA_MNT} -le 1 || $EXTRA_MNT =~ \ |\' || $EXTRA_MNTS == *"$EXTRA_MNT"* ]]; then
@ -1258,16 +1256,10 @@ select_mount_opts()
local title="${fs^} Mount Options"
local opts="${FS_OPTS[$fs]}"
# check for ssd
ssd "$part" >/dev/null 2>&1 && opts=$(sed 's/discard - off/discard - on/' <<< "$opts")
tput civis
if ! MNT_OPTS="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --checklist "$_MntBody" 0 0 0 $opts)" || [[ $MNT_OPTS == "" ]]
then
return 1
fi
MNT_OPTS="$(sed 's/ /,/g; $s/,$//' <<< "$MNT_OPTS" )"
is_ssd "$part" >/dev/null 2>&1 && opts=$(sed 's/discard - off/discard - on/' <<< "$opts")
MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$_MntBody" 0 0 0 $opts)"
[[ $MNT_OPTS ]] && MNT_OPTS="$(sed 's/ /,/g; $s/,$//' <<< "$MNT_OPTS" )" || return 1
yesno "$title" "$_MntConfBody $MNT_OPTS\n" || { select_mount_opts "$part" "$fs" || return 1; }
return 0
@ -1278,12 +1270,11 @@ select_filesystem()
local part="$1"
local fs cur_fs
cur_fs="$(lsblk -lno FSTYPE "$part" 2>/dev/null)"
local msg="\nSelect which filesystem you want to use for $part\n\nPartition Name: "
local msg="\nSelect which filesystem to use for: $part\n\nCurrent: ${cur_fs:-None}\nDefault: ext4"
tput civis
if [[ $cur_fs && $part != "$ROOT_PART" ]]; then
fs="$(menubox "$_FSTitle: $part" \
"${msg}${part}\nExisting Filesystem: ${cur_fs}$_FSBody" \
fs="$(menubox "$_FSTitle: $part" "$msg" \
"$_Skip" "-" \
"ext4" "${FS_CMDS[ext4]}" \
"ext3" "${FS_CMDS[ext3]}" \
@ -1292,27 +1283,26 @@ select_filesystem()
"ntfs" "${FS_CMDS[ntfs]}" \
"f2fs" "${FS_CMDS[f2fs]}" \
"jfs" "${FS_CMDS[jfs]}" \
"xfs" "${FS_CMDS[xfs]}"\
"nilfs2" "${FS_CMDS[nilfs2]}" \
"reiserfs" "${FS_CMDS[reiserfs]}" \
"xfs" "${FS_CMDS[xfs]}")"
"reiserfs" "${FS_CMDS[reiserfs]}")"
[[ $fs == "$_Skip" ]] && return 0
else
fs="$(menubox "$_FSTitle: $part" "${msg}${part}$_FSBody" \
fs="$(menubox "$_FSTitle: $part" "$msg" \
"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]}" \
"xfs" "${FS_CMDS[xfs]}" \
"nilfs2" "${FS_CMDS[nilfs2]}" \
"reiserfs" "${FS_CMDS[reiserfs]}" \
"xfs" "${FS_CMDS[xfs]}")"
"reiserfs" "${FS_CMDS[reiserfs]}")"
fi
[[ $fs ]] || return 1
if yesno "$_FSTitle" "\nFormat $part as $fs?\n" "Format" "Go Back"; then
format "$part" "$fs"
format "$part" "$fs" || return 1
else
select_filesystem "$part" || return 1
fi
@ -1401,7 +1391,7 @@ select_extra_partitions()
return 1
fi
EXTRA_MNTS="$EXTRA_MNTS $part: $EXTRA_MNT"
[[ $EXTRA_MNT == "/usr" && $HOOKS != *usr* ]] && HOOKS="usr $HOOKS"
[[ $EXTRA_MNT == '/usr' && $HOOKS != *usr* ]] && HOOKS="usr $HOOKS"
done
return 0
@ -1777,19 +1767,19 @@ setup_grub()
if [[ $ROOT_PART == */dev/mapper/* && ! $LVM && ! $LUKS_PASS ]]; then
luks_pass "$_LuksOpen" "" || return 1
fi
BCMDS[grub]="mount -t efivarfs efivarfs $efidir/efivars; \
BCMDS[grub]="mount -t efivarfs efivarfs $efidir/efivars || true &&
${BCMDS[grub]} --bootloader-id=$DIST"
grep -q $efidir/efivars <<< "$(mount)" || mount -t efivarfs efivarfs $efidir/efivars
fi
grep -q $efidir/efivars <<< "$(mount)" ||
mount -t efivarfs efivarfs $efidir/efivars
BCMDS[grub]="mkdir -p /run/udev && mkdir -p /run/lvm &&
BCMDS[grub]="mkdir -p /run/udev /run/lvm &&
mount -t tmpfs tmpfs /run &&
mount --bind /hostrun/udev /run/udev &&
mount --bind /hostrun/lvm /run/lvm &&
${BCMDS[grub]} &&
grub-mkconfig -o /boot/grub/grub.cfg &&
sleep 1 && umount /run/udev && umount /run/lvm"
sleep 1 && umount -R /run"
return 0
}
@ -2414,7 +2404,7 @@ src()
return 0
}
ssd()
is_ssd()
{ # returns 0 (true) when the device passed ($1) is NOT a rotational device
local i dev=$1