openrc/init.d/encswap.in
William Hubbs 3470eda3f5 Rename runscript to openrc-run
This was requested by Debian, because the minicom software, which is
available on Debian and other distros, has a binary named runscript. We
are keeping a backward compatibility symlink for now, but this allows
Debian or any other distro to safely remove the symlink.

X-Gentoo-Bug: 494220
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=494220
2013-12-29 22:57:31 -06:00

44 lines
971 B
Plaintext

#!@SBINDIR@/openrc-run
# Copyright 1992-2012 FreeBSD Project
# Released under the 2-clause BSD license
depend() {
before swap
}
start() {
while read device mountpoint type options rest ; do
case ":${device}:${type}:${options}" in
:#*)
;;
*.bde:swap:sw)
passphrase=$(dd if=/dev/random count=1 2>/dev/null | md5 -q)
device="${device%.bde}"
gbde init "${device}" -P "${passphrase}" || return 1
gbde attach "${device}" -p "${passphrase}" || return 1
;;
*.eli:swap:sw)
device="${device%.eli}"
geli onetime ${geli_swap_flags} "${device}" || return 1
;;
esac
done < /etc/fstab
}
stop() {
while read device mountpoint type options rest ; do
case ":${device}:${type}:${options}" in
:#*)
;;
*.bde:swap:sw)
device="${device%.bde}"
gbde detach "${device}"
;;
*.eli:swap:sw)
# Nothing here, because geli swap devices should be
# created with the auto-detach-on-last-close option.
;;
esac
done < /etc/fstab
}