export "${1}"_detected="$(blkid --match-token=TYPE="${1}" | wc -l )"
}
+detect_swapfile() {
+ # Finds swap references in /etc/fstab.
+ export swapfile_detected="$(awk '!/^(#)/' /etc/fstab | awk '$3=="swap" ' | wc -l )"
+}
+
detect_util() {
# Uses 66-which to determine if a utility exists.
# Output is $fs_util_exitst=0 (or 1)
+hpt45x_raid_member_detected+adaptec_raid_member_detected\
+jmicron_raid_member_detected))
+# swap can be detected by blkid if it is a partition or it can be a swapfile
+# declared in fstab
+detect_fs swap
+detect_swapfile
+swap_detected=$((swap_detected+swapfile_detected))
+
# Use detect_util for all utilities
detect_util btrfs_util btrfs
detect_util zfs_util zfs
detect_util luks_util cryptsetup
detect_util lvm_util lvchange
detect_util dmraid_util dmraid
+detect_util swap_util swapon
# Finally detect and apply the configuration
check_and_apply_conf "$btrfs_detected" "$btrfs_util_exists" BTRFS BTRFS btrfs "[btrfs_progs]"
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]"
+check_and_apply_conf "$swap_detected" "$swap_util_exists" SWAP SWAP swapon "[util-linux]"
+
66-yeller %g "Please re-enable the boot@system service
for the changes to take effect by running (as root):