aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-05-16 04:25:01 +0300
committerCem Keylan <cem@ckyln.com>2020-05-16 04:25:01 +0300
commit40053f90c54d26141f4e9aeae2fe8a93d80693c2 (patch)
treec366a7be8c96d450dad38f7c8b0619f1284c06a3
parentb957059464e514ce8eebd2c7c215cf20839c2673 (diff)
downloadinit-40053f90c54d26141f4e9aeae2fe8a93d80693c2.tar.gz
init: remove crypttab parsing
-rwxr-xr-xrc.boot3
-rw-r--r--rc.lib41
2 files changed, 0 insertions, 44 deletions
diff --git a/rc.boot b/rc.boot
index 1e9aded..66ad355 100755
--- a/rc.boot
+++ b/rc.boot
@@ -58,9 +58,6 @@ out "Remounting rootfs as ro..."; {
mount -o remount,ro / || emergency_shell
}
-[ -e /etc/crypttab ] && [ -x /bin/cryptsetup ] && {
- out "Activating encrypted devices..."
- parse_crypttab
}
out "Checking filesystems..."; {
diff --git a/rc.lib b/rc.lib
index bf04ce9..1843304 100644
--- a/rc.lib
+++ b/rc.lib
@@ -14,45 +14,4 @@ emergency_shell() {
/bin/sh -l
}
-parse_crypttab() {
- # This is a pure shell crypttab parser which supports
- # a subset of the format.
-
- # Function by Dylan Araps
- exec 3<&0
-
- # shellcheck disable=2086
- while read -r name dev pass opts err; do
- # Skip comments.
- [ "${name##\#*}" ] || continue
-
- # Break on invalid crypttab (> 5 columns).
- [ "$err" ] && break
-
- # Turn 'UUID=*' lines into device names.
- [ "${dev##UUID*}" ] || dev=$(blkid -l -o device -t "$dev")
-
- # Parse options by turning the list into a pseudo array.
- { old_ifs=$IFS; IFS=,; set -f; set +f -- $opts; IFS=$old_ifs; }
-
- # Create an argument list (no other way to do this in sh).
- for opt; do case $opt in
- discard) copts="$copts --allow-discards" ;;
- readonly|read-only) copts="$copts -r" ;;
- tries=*) copts="$copts -T ${opt##*=}" ;;
- esac; done
-
- # If password is 'none', '-' or empty ask for it.
- case $pass in
- none|-|"") cryptsetup luksOpen $copts "$dev" "$name" <&3 ;;
- *) cryptsetup luksOpen $copts -d "$pass" "$dev" "$name" ;;
- esac
- done < /etc/crypttab
-
- exec 3>&-
-
- [ "$copts" ] && [ -x /bin/vgchange ] && {
- out "Activating LVM devices for dm-crypt..."
- vgchange --sysinit -a y || emergency_shell
- }
}