521ec566b6ad8b13e316766a699e79a82180472a
[live-initramfs-grml.git] / debian / patches / 06_support_fromiso_isofrom.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 06_support_fromiso_isofrom.dpatch <mika@grml.org>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Support isofrom / fromiso bootoption
6
7 @DPATCH@
8
9 --- a/scripts/live
10 +++ b/scripts/live
11 @@ -92,6 +92,11 @@ Arguments ()
12                                 export HOSTNAME LIVECONF
13                                 ;;
14  
15 +                       isofrom=*|fromiso=*)
16 +                               FROMISO="${ARGUMENT#*=}"
17 +                               export FROMISO
18 +                               ;;
19 +
20                         username=*)
21                                 USERNAME="${ARGUMENT#username=}"
22                                 LIVECONF="changed"
23 @@ -1300,6 +1305,17 @@ check_dev ()
24         devname="${2}"
25         skip_uuid_check="${3}"
26  
27 +       # support for fromiso=.../isofrom=....
28 +       if [ -n "$FROMISO" ]
29 +       then
30 +               mkdir /isofrom
31 +               ISO_DEVICE="$(echo $FROMISO | sed 's|\(/dev/[a-z]*[0-9]*\).*|\1|')"
32 +               mount "$ISO_DEVICE" /isofrom
33 +               ISO_NAME="$(echo $FROMISO | sed 's|/dev/[a-z]*[0-9]*/||')"
34 +               loopdevname=$(setup_loop "/isofrom/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
35 +               devname="${loopdevname}"
36 +       fi
37 +
38         if [ -z "${devname}" ]
39         then
40                 devname=$(sys2dev "${sysdev}")