aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
Diffstat (limited to 'functions')
-rw-r--r--functions34
1 files changed, 34 insertions, 0 deletions
diff --git a/functions b/functions
index 84fed85..b9ba718 100644
--- a/functions
+++ b/functions
@@ -233,6 +233,40 @@ kill_everything() {
run_hook "$1_postkillall"
}
+activate_vgs() {
+ [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]] || return
+ # Kernel 2.6.x, LVM2 groups
+ /sbin/modprobe -q dm-mod 2>/dev/null
+ stat_busy "Activating LVM2 groups"
+ if /sbin/lvm vgchange --ignorelockingfailure -a y >/dev/null; then
+ stat_done
+ else
+ stat_fail
+ fi
+}
+
+# Arch cryptsetup packages traditionally contained the binaries
+# /usr/sbin/cryptsetup
+# /sbin/cryptsetup.static
+# By default, initscripts used the /sbin/cryptsetup.static.
+# Newer packages will only have /sbin/cryptsetup and no static binary
+# This ensures maximal compatibility with the old and new layout
+for CS in /sbin/cryptsetup /usr/sbin/cryptsetup \
+ /sbin/cryptsetup.static ''; do
+ [[ -x $CS ]] && break
+done
+
+read_crypttab() {
+ # $1 = function to call with the split out line from the crypttab
+ local line nspo failed=0
+ while read line; do
+ [[ $line && ${line:0:1} != '#' ]] || continue
+ eval nspo=("${line%#*}")
+ $1 "${nspo[0]}" "${nspo[1]}" "${nspo[2]}" "${nspo[@]:3}" || failed=1
+ done < /etc/crypttab
+ return $failed
+}
+
###############################
# Custom hooks in initscripts #
###############################