Skip to content

Commit cb1ddfc

Browse files
falconindyteg
authored andcommitted
sysinit: remove cryptsetup compat
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>
1 parent 28ec5b7 commit cb1ddfc

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

functions

Lines changed: 0 additions & 11 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -379,17 +379,6 @@ activate_vgs() {
379
(( $? == 0 )) && stat_done || stat_fail
379
(( $? == 0 )) && stat_done || stat_fail
380
}
380
}
381

381

382-
# Arch cryptsetup packages traditionally contained the binaries
383-
# /usr/sbin/cryptsetup
384-
# /sbin/cryptsetup.static
385-
# By default, initscripts used the /sbin/cryptsetup.static.
386-
# Newer packages will only have /sbin/cryptsetup and no static binary
387-
# This ensures maximal compatibility with the old and new layout
388-
for CS in /sbin/cryptsetup /usr/sbin/cryptsetup \
389-
/sbin/cryptsetup.static ''; do
390-
[[ -x $CS ]] && break
391-
done
392-
393
read_crypttab() {
382
read_crypttab() {
394
# $1 = function to call with the split out line from the crypttab
383
# $1 = function to call with the split out line from the crypttab
395
local line nspo failed=0
384
local line nspo failed=0

rc.sysinit

Lines changed: 7 additions & 7 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -89,7 +89,7 @@ udevd_modprobe sysinit
89
activate_vgs
89
activate_vgs
90

90

91
# Set up non-root encrypted partition mappings
91
# Set up non-root encrypted partition mappings
92-
if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
92+
if [[ -f /etc/crypttab ]] && type -p cryptsetup >/dev/null; then
93
stat_busy "Unlocking encrypted volumes:"
93
stat_busy "Unlocking encrypted volumes:"
94
modprobe -q dm-crypt 2>/dev/null
94
modprobe -q dm-crypt 2>/dev/null
95
do_unlock() {
95
do_unlock() {
@@ -102,7 +102,7 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
102
# Ordering of options is different if you are using LUKS vs. not.
102
# Ordering of options is different if you are using LUKS vs. not.
103
# Use ugly swizzling to deal with it.
103
# Use ugly swizzling to deal with it.
104
# isLuks only gives an exit code but no output to stdout or stderr.
104
# isLuks only gives an exit code but no output to stdout or stderr.
105-
if $CS isLuks "$2" 2>/dev/null; then
105+
if cryptsetup isLuks "$2" 2>/dev/null; then
106
open=luksOpen
106
open=luksOpen
107
a=$2
107
a=$2
108
b=$1
108
b=$1
@@ -125,13 +125,13 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
125
fi
125
fi
126
if (( _overwriteokay == 0 )); then
126
if (( _overwriteokay == 0 )); then
127
false
127
false
128-
elif $CS -d /dev/urandom $4 $open "$a" "$b" >/dev/null; then
128+
elif cryptsetup -d /dev/urandom $4 $open "$a" "$b" >/dev/null; then
129
stat_append "creating swapspace.."
129
stat_append "creating swapspace.."
130
mkswap -f -L $1 /dev/mapper/$1 >/dev/null
130
mkswap -f -L $1 /dev/mapper/$1 >/dev/null
131
fi;;
131
fi;;
132
ASK)
132
ASK)
133
printf "\nOpening '$1' volume:\n"
133
printf "\nOpening '$1' volume:\n"
134-
$CS $4 $open "$a" "$b" < /dev/console;;
134+
cryptsetup $4 $open "$a" "$b" < /dev/console;;
135
/dev*)
135
/dev*)
136
local ckdev=${3%%:*}
136
local ckdev=${3%%:*}
137
local cka=${3#*:}
137
local cka=${3#*:}
@@ -153,13 +153,13 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
153
# cka is numeric: cka=offset, ckb=length
153
# cka is numeric: cka=offset, ckb=length
154
dd if=${ckdev} of=${ckfile} bs=1 skip=${cka} count=${ckb} >/dev/null 2>&1;;
154
dd if=${ckdev} of=${ckfile} bs=1 skip=${cka} count=${ckb} >/dev/null 2>&1;;
155
esac
155
esac
156-
$CS -d ${ckfile} $4 $open "$a" "$b" >/dev/null
156+
cryptsetup -d ${ckfile} $4 $open "$a" "$b" >/dev/null
157
dd if=/dev/urandom of=${ckfile} bs=1 count=$(stat -c %s ${ckfile}) conv=notrunc >/dev/null 2>&1
157
dd if=/dev/urandom of=${ckfile} bs=1 count=$(stat -c %s ${ckfile}) conv=notrunc >/dev/null 2>&1
158
rm ${ckfile};;
158
rm ${ckfile};;
159
/*)
159
/*)
160-
$CS -d "$3" $4 $open "$a" "$b" >/dev/null;;
160+
cryptsetup -d "$3" $4 $open "$a" "$b" >/dev/null;;
161
*)
161
*)
162-
echo "$3" | $CS $4 $open "$a" "$b" >/dev/null;;
162+
echo "$3" | cryptsetup $4 $open "$a" "$b" >/dev/null;;
163
esac
163
esac
164
if (( $? )); then
164
if (( $? )); then
165
failed=1
165
failed=1

0 commit comments

Comments
 (0)