Skip to content

Commit

Permalink
sysinit: remove cryptsetup compat
Browse files Browse the repository at this point in the history
We haven't had the static binary in nearly 2 years, so simply call this
without a PATH lookup.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
  • Loading branch information
falconindy authored and teg committed Mar 17, 2012
1 parent 28ec5b7 commit cb1ddfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
11 changes: 0 additions & 11 deletions functions
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -379,17 +379,6 @@ activate_vgs() {
(( $? == 0 )) && stat_done || stat_fail (( $? == 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() { read_crypttab() {
# $1 = function to call with the split out line from the crypttab # $1 = function to call with the split out line from the crypttab
local line nspo failed=0 local line nspo failed=0
Expand Down
14 changes: 7 additions & 7 deletions rc.sysinit
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ udevd_modprobe sysinit
activate_vgs activate_vgs


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

0 comments on commit cb1ddfc

Please sign in to comment.