aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d
diff options
context:
space:
mode:
authorMiloslav Trmac <mitr@volny.cz>2006-08-06 22:27:49 +0000
committerMiloslav Trmac <mitr@volny.cz>2006-08-06 22:27:49 +0000
commit7b45d06d80f498a6ea9630c51c11ca46ac5ad1d7 (patch)
tree9a2d0ecd0b24c9369df4ef5c02877d6ba7c4c70d /rc.d
parent069c1c9f7f5523fdf91e7606a67ff62c213ba86b (diff)
downloadinitscripts-7b45d06d80f498a6ea9630c51c11ca46ac5ad1d7.tar
initscripts-7b45d06d80f498a6ea9630c51c11ca46ac5ad1d7.tar.gz
initscripts-7b45d06d80f498a6ea9630c51c11ca46ac5ad1d7.tar.bz2
initscripts-7b45d06d80f498a6ea9630c51c11ca46ac5ad1d7.tar.xz
initscripts-7b45d06d80f498a6ea9630c51c11ca46ac5ad1d7.zip
Support Debian-like "tmp" option in /etc/crypptab (#201382, based on a patch
by Lars Volker <lv@lekv.de>)
Diffstat (limited to 'rc.d')
-rwxr-xr-xrc.d/rc.sysinit20
1 files changed, 17 insertions, 3 deletions
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index cb07660c..c04a434d 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -105,7 +105,7 @@ key_is_random() {
# encrypted but /var/lib/random-seed is needed to initialize swap.
init_crypto() {
local have_random dst src key opt mode owner params makeswap skip arg opt
- local param value rc ret
+ local param value rc ret mke2fs mdir
ret=0
have_random=$1
@@ -135,6 +135,7 @@ init_crypto() {
fi
params=""
makeswap=""
+ mke2fs=""
skip=""
# Parse the options field, convert to cryptsetup parameters
# and contruct the command line
@@ -172,6 +173,9 @@ init_crypto() {
;;
swap)
makeswap=yes
+ ;;
+ tmp)
+ mke2fs=yes
esac
done
if [ "$skip" = "yes" ]; then
@@ -205,8 +209,18 @@ init_crypto() {
ret=1
continue
fi
- if [ "$makeswap" = "yes" -a -b "/dev/mapper/$dst" ]; then
- mkswap "/dev/mapper/$dst" 2>/dev/null >/dev/null
+ if [ -b "/dev/mapper/$dst" ]; then
+ if [ "$makeswap" = "yes" ]; then
+ mkswap "/dev/mapper/$dst" 2>/dev/null >/dev/null
+ fi
+ if [ "$mke2fs" = "yes" ]; then
+ if mke2fs "/dev/mapper/$dst" 2>/dev/null >/dev/null \
+ && mdir=$(mktemp -d /tmp/mountXXXXXX); then
+ mount "/dev/mapper/$dst" "$mdir" && chmod 1777 "$mdir"
+ umount "$mdir"
+ rmdir "$mdir"
+ fi
+ fi
fi
done < /etc/crypttab
return $ret