aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2007-08-14 13:32:33 +0000
committerHarald Hoyer <harald@redhat.com>2007-08-14 13:32:33 +0000
commit34e5bec0a0a37ecbdf40923c79afaa17cdbcdfce (patch)
tree15c26a89968427a1412775407f4a2754f47dc4d0 /rc.d
parent55979ee4122d9f5d5e5031f2d9b6f14535047171 (diff)
downloadinitscripts-34e5bec0a0a37ecbdf40923c79afaa17cdbcdfce.tar
initscripts-34e5bec0a0a37ecbdf40923c79afaa17cdbcdfce.tar.gz
initscripts-34e5bec0a0a37ecbdf40923c79afaa17cdbcdfce.tar.bz2
initscripts-34e5bec0a0a37ecbdf40923c79afaa17cdbcdfce.tar.xz
initscripts-34e5bec0a0a37ecbdf40923c79afaa17cdbcdfce.zip
- added support for cryptsetup-uuids (bug #242078)
Diffstat (limited to 'rc.d')
-rwxr-xr-xrc.d/init.d/functions21
-rwxr-xr-xrc.d/rc.sysinit16
2 files changed, 33 insertions, 4 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 25b9d1e2..8e76c6d7 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -71,6 +71,27 @@ checkpid() {
return 1
}
+__basename() {
+ echo ${@##*/}
+}
+__dirname() {
+ f=$@
+ b=$(__basename "$f")
+ if [ "$b" = "$f" ]; then
+ echo "."
+ return
+ fi
+ d=${f//\/$b/}
+ echo $d
+}
+
+__readlink() {
+ f=$@
+ l=$(ls -bl "$f"|(read a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 link rest; echo $link))
+ d=$(__dirname "$f")/./$(__dirname $l )
+ (cd "$d" ;echo $(pwd -P)/$(__basename $l ));
+}
+
# __umount_loop awk_program fstab_file first_msg retry_msg umount_args
# awk_program should process fstab_file and return a list of fstab-encoded
# paths; it doesn't have to handle comments in fstab_file.
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index 08d84653..75705747 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -119,10 +119,12 @@ init_crypto() {
fi
if [ -n "$key" -a "x$key" != "xnone" ]; then
if test -e "$key" ; then
- mode=$(ls -l "$key" | cut -c 5-10)
- owner=$(ls -l $key | awk '{ print $3 }')
- if [ "$mode" != "------" ] && ! key_is_random "$key"; then
- echo $"INSECURE MODE FOR $key"
+ owner=$(ls -l $key | (read a b owner rest; echo $owner))
+ if ! key_is_random "$key"; then
+ mode=$(ls -l "$key" | cut -c 5-10)
+ if [ "$mode" != "------" ]; then
+ echo $"INSECURE MODE FOR $key"
+ fi
fi
if [ "$owner" != root ]; then
echo $"INSECURE OWNER FOR $key"
@@ -139,6 +141,12 @@ init_crypto() {
makeswap=""
mke2fs=""
skip=""
+ # Parse the src field for UUID= and convert to real device names
+ if [ "${src%%=*}" == "UUID" ]; then
+ src=`/sbin/blkid -t "$src" -o device|(read oneline;echo $oneline)`
+ elif [ "${src/^\/dev\/disk\/by-uuid\/}" != "$src" ]; then
+ src=$(__readlink $src)
+ fi
# Parse the options field, convert to cryptsetup parameters
# and contruct the command line
while [ -n "$opt" ]; do