#!/bin/sh
-#Copyright (c) 2021 mobinmob <mobinmob@disroot.org>
-#Licenced under the 2-Clause BSD License, available in the root of the repo,
-#SPDX short identifier: BSD-2-Clause
+# Copyright 2021 mobinmob <mobinmob@disroot.org>
+# Use of this source code is governed by the 2-Clause BSD License
+# that can be found in the LICENSE file.
+# SPDX short identifier: BSD-2-Clause
+
+# Variables for 66-yeller
+export PROG="66boot-storage-autoconf"
+export COLOR_ENABLED="1"
+export CLOCK_ENABLED="0"
# Script must run as root.
user=$(id -u)
# ${1} is the variable for the utility, in the form of "$fs_util"
# ${2} is the name of the executable
export "${1}"_exists="$(66-which "${2}" | wc -l)"
-
}
check_and_apply_conf() {
# ${2} is in the form of $fs_name_exists
# ${3} is the name of the configuration variable
# ${4} is the user-friendly name for the configuration option
- # ${5} is the name of the executable
- # ${6} is the name of the package that contains the utility
+ # ${5} name of the utility needed for the block device type
+ # ${6} is the name of the package that contains the program
# ${6} is **distribution-dependent**
if [ "${1}" != "0" ] && [ "${2}" = "1" ]
then
66-env -t boot -r "${3}"=!yes boot@system
- 66-yeller -cz -p 66boot-storage-autoconf %g "${4} detected and enabled!" %n
-elif [ "${1}" != "0" ] && [ "${2}" = "0" ]
+ 66-yeller %g "${4} detected and enabled!" %n
+ elif [ "${1}" != "0" ] && [ "${2}" = "0" ]
then
66-env -t boot -r "${3}"=!no boot@system
- 66-yeller -czW -p 66boot-storage-autoconf %y "${4} detected but cannot be enabled, because the ${5} utility is not installed. Please install the ${6} package and run this script again!" %n
-elif [ "${1}" = "0" ]
+ 66-yeller -W %y "${4} detected but cannot be enabled,\n because the ${5} program is not installed. Please install the ${6} \n package and run this script again!" %n
+ elif [ "${1}" = "0" ]
then
66-env -t boot -r "${3}"=!no boot@system
- 66-yeller -cz -p 66boot-storage-autoconf %b "${4} not detected!" %n
-fi
+ 66-yeller %b "${4} not detected!" %n
+ fi
}
if [ "${1}" != "0" ] && [ "${2}" = "1" ]
then
66-env -t boot -r "ZFS"=!yes boot@system
- if [ -e /etc/zfs/zpool.cache ]; then
- 66-env -t boot -r ZFS_IMPORT=!zpoolcache boot@system
- 66-yeller -cz -p 66boot-storage-autoconf %g "ZFS import method configured as zpoolcache." %n
- else
- 66-env -t boot -r ZFS_IMPORT=!scan boot@system
- 66-yeller -cz -p 66boot-storage-autoconf %g "ZFS import method configured as scan." %n
- fi
+ if [ -e /etc/zfs/zpool.cache ]
+ then
+ 66-env -t boot -r ZFS_IMPORT=!zpoolcache boot@system
+ 66-yeller %g "ZFS import method configured as zpoolcache." %n
+ else
+ 66-env -t boot -r ZFS_IMPORT=!scan boot@system
+ 66-yeller %g "ZFS import method configured as scan." %n
+ fi
fi
}
detect_util dmraid_util dmraid
# Finally detect and apply the configuration
-#SC2154
-check_and_apply_conf "$btrfs_detected" "$btrfs_util_exists" BTRFS BTRFS "$btrfs_util" btrfs_progs
-check_and_apply_conf "$zfs_detected" "$zfs_util_exists" ZFS ZFS "$zfs_util" zfs
+check_and_apply_conf "$btrfs_detected" "$btrfs_util_exists" BTRFS BTRFS btrfs "[btrfs_progs]"
+check_and_apply_conf "$zfs_detected" "$zfs_util_exists" ZFS ZFS zfs "[zfs]"
check_and_apply_conf_zpool "$zfs_detected" "$zfs_util_exists" ZFS
-check_and_apply_conf "$crypto_LUKS_detected" "$luks_util_exists" CRYPTTAB LUKS "$luks_util" cryptsetup
-check_and_apply_conf "$LVM2_member_detected" "$lvm_util_exists" LVM LVM "$lvm_util" lvm2
-check_and_apply_conf "$dmraid_detected" "$dmraid_util_exists" DMRAID DMRAID "$dmraid_util" dmraid
\ No newline at end of file
+check_and_apply_conf "$crypto_LUKS_detected" "$luks_util_exists" CRYPTTAB LUKS cryptsetup "[cryptsetup]"
+check_and_apply_conf "$LVM2_member_detected" "$lvm_util_exists" LVM LVM lvchange "[lvm2]"
+check_and_apply_conf "$dmraid_detected" "$dmraid_util_exists" DMRAID DMRAID dmraid "[dmraid]"