Update changelog.
[live-initramfs-grml.git] / debian / patches / 07_support_findiso.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 07_support_findiso.dpatch by Michael Schierl <schierlm@gmx.de>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: support for findoiso bootoption
6 # When booting with findiso=/grml_2010.05.iso, it will look for
7 # that .iso file on all disks where it usually looks for the .squashfs
8 # file. When it is found, the disk containing the iso is read-only mounted
9 # as /live/findiso (and exposed there after boot completed). The squashfs
10 # file is searched inside that ISO file then.
11
12 @DPATCH@
13 diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' live-initramfs-grml~/grml/05mountpoints live-initramfs-grml/grml/05mountpoints
14 --- live-initramfs-grml~/grml/05mountpoints     2010-05-11 11:00:21.000000000 +0200
15 +++ live-initramfs-grml/grml/05mountpoints      2010-05-11 11:03:07.087928541 +0200
16 @@ -44,4 +44,21 @@
17  # example when booting FAI, this simple workaround solves it
18  ls /root/* >/dev/null 2>&1
19  
20 +# Move findiso directory to the new root filesystem so that programs there can get at it.
21 +if [ -d /live/findiso -a ! -d /root/live/findiso ]
22 +then
23 +       mkdir -p /root/live/findiso
24 +       mount -n --move /live/findiso /root/live/findiso
25 +fi
26 +
27 +# if we do not unmount the ISO we can't run "fsck /dev/ice" later on
28 +# because the mountpoint is left behind in /proc/mounts, so let's get
29 +# rid of it when running from RAM
30 +if [ -n "$FINDISO" ] && [ "${TORAM}" ]
31 +then
32 +  losetup -d /dev/loop0
33 +  grep -q /live/findiso /proc/mounts && umount /root/live/findiso
34 +fi
35 +
36 +
37  log_end_msg
38 diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' live-initramfs-grml~/scripts/live live-initramfs-grml/scripts/live
39 --- live-initramfs-grml~/scripts/live   2010-05-11 11:00:21.000000000 +0200
40 +++ live-initramfs-grml/scripts/live    2010-05-11 11:03:37.210427405 +0200
41 @@ -143,6 +143,11 @@
42                                 export HOSTNAME LIVECONF
43                                 ;;
44  
45 +                       findiso=*)
46 +                               FINDISO="${ARGUMENT#findiso=}"
47 +                               export FINDISO
48 +                               ;;
49 +
50                         isofrom=*|fromiso=*)
51                                 FROMISO="${ARGUMENT#*=}"
52                                 export FROMISO
53 @@ -1593,6 +1598,18 @@
54                 mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
55                 [ -n "$devuid" ] && echo "$devuid" >> $tried
56  
57 +               if [ -n "${FINDISO}" ]
58 +               then
59 +                       if [ -f ${mountpoint}/${FINDISO} ]; then
60 +                               umount ${mountpoint}
61 +                               mkdir /live/findiso -p
62 +                               mount -t ${fstype} -o ro,noatime "${devname}" /live/findiso
63 +                               loopdevname=$(setup_loop "/live/findiso/${FINDISO}" "loop" "/sys/block/loop*" "" '')
64 +                               devname="${loopdevname}"
65 +                               mount -t iso9660 -o ro,noatime "${devname}" ${mountpoint}
66 +                       fi
67 +               fi
68 +
69                 if is_live_path ${mountpoint} && \
70                         ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
71                 then