set zfs properties and general cleanup

merge-requests/273/head
Evan James 5 years ago
parent 1fe28a9442
commit 4485424e46

@ -63,8 +63,8 @@ enable_services() {
sleep 2
fi
# if we are using a zfs root we should enable the zfs services
if [ $(findmnt -ln -o FSTYPE ${MOUNTPOINT}) == "zfs" ]; then
# if we are using a zfs we should enable the zfs services
if [ $ZFS == 1 ]; then
arch_chroot "systemctl enable zfs.target" 2>$ERR
check_for_error "enable zfs.target" "$?"
arch_chroot "systemctl enable zfs-import-cache" 2>$ERR
@ -305,7 +305,7 @@ install_base() {
# if we are using a zfs root we should enable the zfs services
if [ $(findmnt -ln -o FSTYPE ${MOUNTPOINT}) == "zfs" ]; then
if [ $ZFS == 1 ]; then
arch_chroot "systemctl enable zfs.target" 2>$ERR
check_for_error "enable zfs.target" "$?"
arch_chroot "systemctl enable zfs-import-cache" 2>$ERR
@ -315,7 +315,7 @@ install_base() {
arch_chroot "systemctl enable zfs-import.target" 2>$ERR
check_for_error "enable zfs-import.target" "$?"
# we also need create the cachefile
zpool set cachefile=/etc/zfs/zpool.cache zpmain 2>$ERR
zpool set cachefile=/etc/zfs/zpool.cache $(findmnt ${MOUNTPOINT} -lno SOURCE | awk -F / '{print $1}') 2>$ERR
check_for_error "create zpool cache" "$?"
cp /etc/zfs/zpool.cache ${MOUNTPOINT}/etc/zfs/zpool.cache 2>$ERR
check_for_error "copy cache file" "$?"
@ -407,15 +407,13 @@ install_grub_uefi() {
# 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
# temporary - we can remove this once we add support for mounting zfs
UEFI_MOUNT=/boot/efi
# there has to be a better way to do this
echo -e "# "'!'"/bin/bash\nexport ZPOOL_VDEV_NAME_PATH=YES\ngrub-install --target=x86_64-efi --efi-directory=${UEFI_MOUNT} --bootloader-id=${bootid} --recheck" > ${MOUNTPOINT}/usr/bin/grub_installer.sh
else
echo -e "# "'!'"/bin/bash\ngrub-install --target=x86_64-efi --efi-directory=${UEFI_MOUNT} --bootloader-id=${bootid} --recheck" > ${MOUNTPOINT}/usr/bin/grub_installer.sh
fi
chmod a+x ${MOUNTPOINT}/usr/bin/grub_installer.sh
[[ -f ${MOUNTPOINT}/usr/bin/grub_installer.sh ]] && chmod a+x ${MOUNTPOINT}/usr/bin/grub_installer.sh
# if the device is removable append removable to the grub-install
if [[ "$(cat /sys/block/${root_device}/removable)" == 1 ]]; then
@ -427,7 +425,7 @@ install_grub_uefi() {
check_for_error "grub-install --target=x86_64-efi" $?
# the grub_installer is no longer needed - there still needs to be a better way to do this
rm ${MOUNTPOINT}/usr/bin/grub_installer.sh
[[ -f ${MOUNTPOINT}/usr/bin/grub_installer.sh ]] && rm ${MOUNTPOINT}/usr/bin/grub_installer.sh
# If root is on btrfs volume, amend grub
[[ -e /tmp/.btrfsroot ]] && \
@ -448,8 +446,8 @@ install_grub_uefi() {
fi
}
install_refind()
install_refind()
{
DIALOG " $_InstUefiBtTitle " --yesno "\n$_InstRefindBody\n " 0 0 || return 0
clear
@ -517,9 +515,6 @@ install_systemd_boot() {
DIALOG " $_InstUefiBtTitle " --yesno "\n$_InstSystdBBody\n " 0 0 || return 0
clear
# temporary - we can remove this once we add support for mounting zfs
UEFI_MOUNT=/boot
# Check if already installed. If so, just add entries
if $(arch_chroot "bootctl status" 2>&1 >/dev/null | grep -q "systemd-boot not installed"); then
arch_chroot "bootctl --path=${UEFI_MOUNT} install" 2>$ERR
@ -636,7 +631,7 @@ bios_bootloader() {
echo -e "# "'!'"/bin/bash\ngrub-install --target=i386-pc --recheck $DEVICE" > ${MOUNTPOINT}/usr/bin/grub_installer.sh
fi
chmod a+x ${MOUNTPOINT}/usr/bin/grub_installer.sh
[[ -f ${MOUNTPOINT}/usr/bin/grub_installer.sh ]] && chmod a+x ${MOUNTPOINT}/usr/bin/grub_installer.sh
DIALOG " $_InstGrub " --infobox "\n$_PlsWaitBody\n " 0 0
dd if=/dev/zero of=$DEVICE seek=1 count=2047
@ -644,7 +639,7 @@ bios_bootloader() {
check_for_error "grub-install --target=i386-pc" $?
# the grub_installer is no longer needed - there still needs to be a better way to do this
rm ${MOUNTPOINT}/usr/bin/grub_installer.sh
[[ -f ${MOUNTPOINT}/usr/bin/grub_installer.sh ]] && rm ${MOUNTPOINT}/usr/bin/grub_installer.sh
#grub_mkconfig

@ -1037,6 +1037,7 @@ zfs_new_ds() {
else
# no imported zpools
DIALOG " $_zfsSelectZpoolMenuTitle " --infobox "\n$_zfsZpoolNoPool\n " 0 0
sleep 3
return 0
fi
@ -1106,6 +1107,7 @@ zfs_destroy_dataset() {
else
# no available datasets
DIALOG " $_zfsDestroyMenuTitle " --infobox "\n$_zfsDatasetNotFound\n " 0 0
sleep 3
return 0
fi
@ -1117,15 +1119,53 @@ zfs_destroy_dataset() {
fi
}
zfs_set_property () {
local zlist
# get dataset list and format for the menu
local zds
for zds in $(zfs_list_datasets); do
zlist="${zlist} ${zds} -"
done
# select the dataset
if [[ ${zlist} ]]; then
DIALOG " $_zfsSetMenuTitle " --menu "\n$_zfsSetMenuBody\n " 0 0 12 ${zlist} 2>${ANSWER} || return 0
local zdataset=$(cat ${ANSWER})
else
# no available datasets
DIALOG " $_zfsSetMenuTitle " --infobox "\n$_zfsDatasetNotFound\n " 0 0
sleep 3
return 0
fi
# get property/value input
local -i loopmenu=1
zfsmenubody=$_zfsSetMenuBody
local zsetstmt
while ((loopmenu)); do
DIALOG " $_zfsSetMenuTitle " --inputbox "\n$zfsmenubody\n " 0 0 "" 2>${ANSWER} || return 0
zsetstmt=$(cat ${ANSWER})
# validation
[[ ! $zsetstmt =~ ^[a-zA-Z@]*=[a-zA-Z0-9@-]*$ ]] && zfsmenubody=$_zfsMountMenuNotValid || loopmenu=0
done
#set the property
zfs set ${zsetstmt} ${zdataset} 2>$ERR
check_for_error "zfs set ${zsetstmt} on ${zdataset}"
}
zfs_menu_manual() {
local -i loopmenu=1
while ((loopmenu)); do
DIALOG " $_zfsManualMenuTitle " --menu "\n$_zfsManualMenuBody\n " 22 60 7 \
DIALOG " $_zfsManualMenuTitle " --menu "\n$_zfsManualMenuBody\n " 22 60 8 \
"$_zfsManualMenuOptCreate" "" \
"$_zfsManualMenuOptImport" "" \
"$_zfsManualMenuOptNewFile" "" \
"$_zfsManualMenuOptNewLegacy" "" \
"$_zfsManualMenuOptNewZvol" "" \
"$_zfsManualMenuOptSet" "" \
"$_zfsManualMenuOptDestroy" "" \
"$_Back" "" 2>${ANSWER}
@ -1140,6 +1180,8 @@ zfs_menu_manual() {
;;
"$_zfsManualMenuOptNewZvol") zfs_new_ds "zvol"
;;
"$_zfsManualMenuOptSet") zfs_set_property
;;
"$_zfsManualMenuOptDestroy") zfs_destroy_dataset
;;
*) loopmenu=0

Loading…
Cancel
Save