Skip to contentSkip to conversation

Cryptroot-ask.sh: Remove duplicate code

PATCH In review Till Maas 2 participants 3 messages Feb 9, 2014 – Feb 10, 2014 2 messages not in the archive

lore
Share & tools
lore

Till Maas

author
#0 lore raw

PATCH 1/1 Cryptroot-ask.sh: Remove duplicate code

Remove duplicate code introduced with commit
9b5e2e8574577cd4ec1e3645255060f749490537.

---
 modules.d/90crypt/cryptroot-ask.sh | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)
modules.d/90crypt/cryptroot-ask.sh +2 -19
index 1c3e792..2c8bba0 100755
@@ -10,24 +10,6 @@ NEWROOT=${NEWROOT:-"/sysroot"}
 
 . /lib/dracut-lib.sh
 
-# default luksname - luks-UUID
-luksname=$2
-
-# check if destination already exists
-[ -b /dev/mapper/luksname ] && exit 0
-
-# we already asked for this device
-asked_file=/tmp/cryptroot-asked-$luksname
-[ -f $asked_file ] && exit 0
-
-# load dm_crypt if it is not already loaded
-[ -d /sys/module/dm_crypt ] || modprobe dm_crypt
-
-. /lib/dracut-crypt-lib.sh
-
-# fallback to passphrase
-ask_passphrase=1
-
 # if device name is /dev/dm-X, convert to /dev/mapper/name
 if [ "${1##/dev/dm-}" != "$1" ]; then
     device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
@@ -73,7 +55,8 @@ fi
 [ -b /dev/mapper/$luksname ] && exit 0
 
 # we already asked for this device
-[ -f /tmp/cryptroot-asked-$luksname ] && exit 0
+asked_file=/tmp/cryptroot-asked-$luksname
+[ -f $asked_file ] && exit 0
 
 # load dm_crypt if it is not already loaded
 [ -d /sys/module/dm_crypt ] || modprobe dm_crypt
Signature · 1 line
1.8.3.1

A message that is not in the archive (sent off-list or not yet received): 1391959023-8840-1-git-send-email-opensource-44rtNO6TQJOzQB+pC5nmwQ@public.gmane.org

#2 lore raw
Quoted 46 lines · Till Maas

Remove duplicate code introduced with commit
9b5e2e8574577cd4ec1e3645255060f749490537.

---
 modules.d/90crypt/cryptroot-ask.sh | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)
modules.d/90crypt/cryptroot-ask.sh +2 -19
index 1c3e792..2c8bba0 100755
@@ -10,24 +10,6 @@ NEWROOT=${NEWROOT:-"/sysroot"}
 
 . /lib/dracut-lib.sh
 
-# default luksname - luks-UUID
-luksname=$2
-
-# check if destination already exists
-[ -b /dev/mapper/luksname ] && exit 0
-
-# we already asked for this device
-asked_file=/tmp/cryptroot-asked-$luksname
-[ -f $asked_file ] && exit 0
-
-# load dm_crypt if it is not already loaded
-[ -d /sys/module/dm_crypt ] || modprobe dm_crypt
-
-. /lib/dracut-crypt-lib.sh
-
-# fallback to passphrase
-ask_passphrase=1
-
 # if device name is /dev/dm-X, convert to /dev/mapper/name
 if [ "${1##/dev/dm-}" != "$1" ]; then
     device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
@@ -73,7 +55,8 @@ fi
 [ -b /dev/mapper/$luksname ] && exit 0
 
 # we already asked for this device
-[ -f /tmp/cryptroot-asked-$luksname ] && exit 0
+asked_file=/tmp/cryptroot-asked-$luksname
+[ -f $asked_file ] && exit 0
 
 # load dm_crypt if it is not already loaded
 [ -d /sys/module/dm_crypt ] || modprobe dm_crypt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 7 lines · Harald Hoyer
Quoted 6 lines · Till Maas

Remove duplicate code introduced with commit
9b5e2e8574577cd4ec1e3645255060f749490537.

---
 modules.d/90crypt/cryptroot-ask.sh | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

What I meant is: Thanks! Pushed.