From: Dave Reisner <[email protected]>

We haven't had the static binary in nearly 2 years, so simply call this
without a PATH lookup.

Signed-off-by: Dave Reisner <[email protected]>
---
 functions  |   11 -----------
 rc.sysinit |   14 +++++++-------
 2 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/functions b/functions
index 747e42d..129b3d4 100644
--- a/functions
+++ b/functions
@@ -379,17 +379,6 @@ activate_vgs() {
        (( $? == 0 )) && stat_done || stat_fail
 }
 
-# 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
diff --git a/rc.sysinit b/rc.sysinit
index 0876d05..ddac829 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -89,7 +89,7 @@ udevd_modprobe sysinit
 activate_vgs
 
 # Set up non-root encrypted partition mappings
-if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
+if [[ -f /etc/crypttab ]] && type -p cryptsetup >/dev/null; then
        stat_busy "Unlocking encrypted volumes:"
                modprobe -q dm-crypt 2>/dev/null
                do_unlock() {
@@ -102,7 +102,7 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] 
/etc/crypttab; then
                        # Ordering of options is different if you are using 
LUKS vs. not.
                        # Use ugly swizzling to deal with it.
                        # isLuks only gives an exit code but no output to 
stdout or stderr.
-                       if $CS isLuks "$2" 2>/dev/null; then
+                       if cryptsetup isLuks "$2" 2>/dev/null; then
                                open=luksOpen
                                a=$2
                                b=$1
@@ -125,13 +125,13 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] 
/etc/crypttab; then
                                        fi
                                        if (( _overwriteokay == 0 )); then
                                                false
-                                       elif $CS -d /dev/urandom $4 $open "$a" 
"$b" >/dev/null; then
+                                       elif cryptsetup -d /dev/urandom $4 
$open "$a" "$b" >/dev/null; then
                                                stat_append "creating 
swapspace.."
                                                mkswap -f -L $1 /dev/mapper/$1 
>/dev/null
                                        fi;;
                                ASK)
                                        printf "\nOpening '$1' volume:\n"
-                                       $CS $4 $open "$a" "$b" < /dev/console;;
+                                       cryptsetup $4 $open "$a" "$b" < 
/dev/console;;
                                /dev*)
                                        local ckdev=${3%%:*}
                                        local cka=${3#*:}
@@ -153,13 +153,13 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] 
/etc/crypttab; then
                                                        # cka is numeric: 
cka=offset, ckb=length
                                                        dd if=${ckdev} 
of=${ckfile} bs=1 skip=${cka} count=${ckb} >/dev/null 2>&1;;
                                        esac
-                                       $CS -d ${ckfile} $4 $open "$a" "$b" 
>/dev/null
+                                       cryptsetup -d ${ckfile} $4 $open "$a" 
"$b" >/dev/null
                                        dd if=/dev/urandom of=${ckfile} bs=1 
count=$(stat -c %s ${ckfile}) conv=notrunc >/dev/null 2>&1
                                        rm ${ckfile};;
                                /*)
-                                       $CS -d "$3" $4 $open "$a" "$b" 
>/dev/null;;
+                                       cryptsetup -d "$3" $4 $open "$a" "$b" 
>/dev/null;;
                                *)
-                                       echo "$3" | $CS $4 $open "$a" "$b" 
>/dev/null;;
+                                       echo "$3" | cryptsetup $4 $open "$a" 
"$b" >/dev/null;;
                        esac
                        if (( $? )); then
                                failed=1
-- 
1.7.9.4

Reply via email to