Commit 36879e37 authored by Matti Hyttinen's avatar Matti Hyttinen

Merge branch 'fixes-20190209' into 'master'

Fixes 20190209

See merge request !251
parents fd0c4321 4263a5cd
......@@ -399,19 +399,19 @@ install_grub_uefi() {
# grub config changes for zfs root
if [ $(findmnt -ln -o FSTYPE ${MOUNTPOINT}) == "zfs" ]; then
# zfs is considered a sparse filesystem so we can't use SAVEDEFAULT
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i ${MOUNTPOINT}/etc/default/grub
# we need to tell grub where the zfs root is
ZFS_PARAM="zfs=$(findmnt -ln -o SOURCE ${MOUNTPOINT}) rw"
sed -e '/^GRUB_CMDLINE_LINUX_DEFAULT=/s@"$@ '"${ZFS_PARAM}"'"@g' -e '/^GRUB_CMDLINE_LINUX=/s@"$@ '"${ZFS_PARAM}"'"@g' -i ${MOUNTPOINT}/etc/default/grub
# zfs needs ZPOOL_VDEV_NAME_PATH set to properly find the device
echo ZPOOL_VDEV_NAME_PATH=YES >> ${MOUNTPOINT}/etc/environment
export ZPOOL_VDEV_NAME_PATH=YES
# there has to be a better way to do this
echo -e "# "'!'"/bin/bash
ln -s /hostlvm /run/lvm
pacman -S --noconfirm --needed grub efibootmgr dosfstools grub-btrfs
export ZPOOL_VDEV_NAME_PATH=YES
pacman -S --noconfirm --needed grub efibootmgr dosfstools
# zfs is considered a sparse filesystem so we can't use SAVEDEFAULT
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i /etc/default/grub
# we need to tell grub where the zfs root is
zroot=\"zfs=$(findmnt -ln -o SOURCE ${MOUNTPOINT}) rw\"
sed -e '/^GRUB_CMDLINE_LINUX_DEFAULT=/s@\"\$@ '\"\${zroot}\"'\"@g' -e '/^GRUB_CMDLINE_LINUX=/s@\"\$@ '\"\${zroot}\"'\"@g' -i /etc/default/grub
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i /etc/default/grub
grub-install --target=x86_64-efi --efi-directory=${UEFI_MOUNT} --bootloader-id=${bootid} --recheck
pacman -S --noconfirm grub-theme-manjaro" > ${MOUNTPOINT}/usr/bin/grub_installer.sh
else
......@@ -438,7 +438,7 @@ pacman -S --noconfirm grub-theme-manjaro" > ${MOUNTPOINT}/usr/bin/grub_installer
arch_chroot "grub_installer.sh" 2>$ERR
check_for_error "grub-install --target=x86_64-efi" $?
umount /mnt/hostlvm
# the grub_installer is no longer needed - there still needs to be a better way to do this
# the grub_installer is no longer needed
[[ -f ${MOUNTPOINT}/usr/bin/grub_installer.sh ]] && rm ${MOUNTPOINT}/usr/bin/grub_installer.sh
# Ask if user wishes to set Grub as the default bootloader and act accordingly
......@@ -610,8 +610,8 @@ bios_bootloader() {
# zfs is considered a sparse filesystem so we can't use SAVEDEFAULT
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i ${MOUNTPOINT}/etc/default/grub
# we need to tell grub where the zfs root is
ZFS_PARAM="zfs=$(findmnt -ln -o SOURCE ${MOUNTPOINT}) rw"
sed -e '/^GRUB_CMDLINE_LINUX_DEFAULT=/s@"$@ '"${ZFS_PARAM}"'"@g' -e '/^GRUB_CMDLINE_LINUX=/s@"$@ '"${ZFS_PARAM}"'"@g' -i ${MOUNTPOINT}/etc/default/grub
zroot="zfs=$(findmnt -ln -o SOURCE ${MOUNTPOINT}) rw"
sed -e '/^GRUB_CMDLINE_LINUX_DEFAULT=/s@"$@ '"${zroot}"'"@g' -e '/^GRUB_CMDLINE_LINUX=/s@"$@ '"${zroot}"'"@g' -i ${MOUNTPOINT}/etc/default/grub
# zfs needs ZPOOL_VDEV_NAME_PATH set to properly find the device
echo ZPOOL_VDEV_NAME_PATH=YES >> ${MOUNTPOINT}/etc/environment
export ZPOOL_VDEV_NAME_PATH=YES
......
......@@ -442,8 +442,12 @@ mount_current_partition() {
}
make_swap() {
# Ask user to select partition or create swapfile
DIALOG " $_PrepMntPart " --menu "\n$_SelSwpBody\n " 0 0 12 "$_SelSwpNone" $"-" "$_SelSwpFile" $"-" ${PARTITIONS} 2>${ANSWER} || return 0
# Ask user to select partition or create swapfile if swapfiles are valid for the root filesystem
if [[ $(findmnt -ln -o FSTYPE ${MOUNTPOINT}) == "zfs" || $(findmnt -ln -o FSTYPE ${MOUNTPOINT}) == "btrfs" ]]; then
DIALOG " $_PrepMntPart " --menu "\n$_SelSwpBody\n " 0 0 12 "$_SelSwpNone" $"-" ${PARTITIONS} 2>${ANSWER} || return 0
else
DIALOG " $_PrepMntPart " --menu "\n$_SelSwpBody\n " 0 0 12 "$_SelSwpNone" $"-" "$_SelSwpFile" $"-" ${PARTITIONS} 2>${ANSWER} || return 0
fi
if [[ $(cat ${ANSWER}) != "$_SelSwpNone" ]]; then
PARTITION=$(cat ${ANSWER})
......@@ -1048,7 +1052,7 @@ zfs_new_ds() {
DIALOG " $_zfsDSMenuNameTitle " --inputbox "\n$zfsmenubody\n " 0 0 "" 2>${ANSWER} || return 1
# validation
[[ ! $(cat ${ANSWER}) =~ ^[a-zA-Z][a-zA-Z0-9.:_-]*$ ]] && zfsmenubody=$_zfsZpoolCValidation1 || loopmenu=0
[[ ! $(cat ${ANSWER}) =~ ^[a-zA-Z][a-zA-Z0-9.:/_-]*$ ]] && zfsmenubody=$_zfsZpoolCValidation1 || loopmenu=0
done
local zname=$(cat ${ANSWER})
......@@ -1081,7 +1085,7 @@ zfs_new_ds() {
# validation
[[ $(findmnt -n ${MOUNTPOINT}/${zmount}) ]] && zfsmenubody=$_zfsMountMenuInUse
[[ ! $zmount =~ ^/ ]] && zfsmenubody=$_zfsMountMenuNotValid
[[ ! ($zmount =~ ^/ || $zmount == none) ]] && zfsmenubody=$_zfsMountMenuNotValid
[[ $zfsmenubody == $_zfsMountMenuBody ]] && loopmenu=0
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment