From edb709e702616778d08d6d9348da29e4c3b16a99 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Sun, 25 Apr 2021 21:34:29 +0200 Subject: [PATCH] Improvements and fix to exports printing --- install-zfs.sh | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/install-zfs.sh b/install-zfs.sh index 09699b7..dbf736a 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -460,25 +460,45 @@ function register_exit_hook { function _exit_hook { rm -f "$c_passphrase_named_pipe" + set +x + # Only the meaningful variable(s) are printed. # In order to print the password, the store strategy should be changed, as the pipes may be empty. # - echo "\ -# Currently set exports, for performing an unattended (as possible) installation with the same configuration: -# + echo " +Currently set exports, for performing an unattended (as possible) installation with the same configuration: + export ZFS_USE_PPA=$v_use_ppa export ZFS_SELECTED_DISKS=$(IFS=,; echo -n "${v_selected_disks[*]}") export ZFS_BOOT_PARTITION_SIZE=$v_boot_partition_size -export ZFS_PASSPHRASE=_currently_not_available_ +export ZFS_PASSPHRASE=$(printf %q "$v_passphrase") export ZFS_DEBIAN_ROOT_PASSWORD=$(printf %q "$v_root_password") export ZFS_RPOOL_NAME=$v_rpool_name export ZFS_BPOOL_CREATE_OPTIONS=\"${v_bpool_create_options[*]}\" -export ZFS_RPOOL_CREATE_OPTIONS=\"${v_bpool_create_options[*]}\" +export ZFS_RPOOL_CREATE_OPTIONS=\"${v_rpool_create_options[*]}\" export ZFS_POOLS_RAID_TYPE=${v_pools_raid_type[*]} -export ZFS_NO_INFO_MESSAGES=${ZFS_NO_INFO_MESSAGES:-} +export ZFS_NO_INFO_MESSAGES=1 export ZFS_SWAP_SIZE=$v_swap_size -export ZFS_FREE_TAIL_SPACE=$v_free_tail_space -" +export ZFS_FREE_TAIL_SPACE=$v_free_tail_space" + + # Convenient ready exports (selecting the first two disks): + # + local ready=" +export ZFS_USE_PPA= +export ZFS_SELECTED_DISKS=$(ls -l /dev/disk/by-id/ | perl -ane 'print "/dev/disk/by-id/@F[8]," if ! /\d$/ && ($c += 1) <= 2' | head -c -1) +export ZFS_BOOT_PARTITION_SIZE=2048M +export ZFS_PASSPHRASE=aaaaaaaa +export ZFS_DEBIAN_ROOT_PASSWORD=a +export ZFS_RPOOL_NAME=rpool +export ZFS_BPOOL_CREATE_OPTIONS='-o ashift=12 -o autotrim=on -d -o feature@async_destroy=enabled -o feature@bookmarks=enabled -o feature@embedded_data=enabled -o feature@empty_bpobj=enabled -o feature@enabled_txg=enabled -o feature@extensible_dataset=enabled -o feature@filesystem_limits=enabled -o feature@hole_birth=enabled -o feature@large_blocks=enabled -o feature@lz4_compress=enabled -o feature@spacemap_histogram=enabled -O acltype=posixacl -O compression=lz4 -O devices=off -O normalization=formD -O relatime=on -O xattr=sa' +export ZFS_RPOOL_CREATE_OPTIONS='-o ashift=12 -o autotrim=on -O acltype=posixacl -O compression=lz4 -O dnodesize=auto -O normalization=formD -O relatime=on -O xattr=sa -O devices=off' +export ZFS_POOLS_RAID_TYPE= +export ZFS_NO_INFO_MESSAGES=1 +export ZFS_SWAP_SIZE=2 +export ZFS_FREE_TAIL_SPACE=12 + " + + set -x } trap _exit_hook EXIT }