release 3.0.1-1+grml.1
[live-boot-grml.git] / debian / patches / 103_transform-link-targets.patch
1 commit c6fe296f9a0e309107f6bda14411a70035e56791
2 Author: Evgeni Golov <evgeni@grml.org>
3 Date:   Wed Mar 6 15:21:12 2013 +0100
4
5     Transforming link targets so they work after the mount was moved (Closes: #702421).
6
7 diff --git a/scripts/boot/9990-misc-helpers.sh b/scripts/boot/9990-misc-helpers.sh
8 index f2814ec..cb3940b 100755
9 --- a/scripts/boot/9990-misc-helpers.sh
10 +++ b/scripts/boot/9990-misc-helpers.sh
11 @@ -1140,12 +1140,12 @@ link_files ()
12         # is non-empty, remove mask from all source paths when
13         # creating links (will be necessary if we change root, which
14         # live-boot normally does (into $rootmnt)).
15 -       local src_dir dest_dir src_mask
16 +       local src_dir dest_dir src_transform
17  
18         # remove multiple /:s and ensure ending on /
19         src_dir="$(trim_path ${1})/"
20         dest_dir="$(trim_path ${2})/"
21 -       src_mask="${3}"
22 +       src_transform="${3}"
23  
24         # This check can only trigger on the inital, non-recursive call since
25         # we create the destination before recursive calls
26 @@ -1172,12 +1172,12 @@ link_files ()
27                                 chown_ref "${src}" "${dest}"
28                                 chmod_ref "${src}" "${dest}"
29                         fi
30 -                       link_files "${src}" "${dest}" "${src_mask}"
31 +                       link_files "${src}" "${dest}" "${src_transform}"
32                 else
33                         final_src=${src}
34 -                       if [ -n "${src_mask}" ]
35 +                       if [ -n "${src_transform}" ]
36                         then
37 -                               final_src="$(echo ${final_src} | sed "s|^${src_mask}||")"
38 +                               final_src="$(echo ${final_src} | sed "${src_transform}")"
39                         fi
40                         rm -rf "${dest}" 2> /dev/null
41                         ln -s "${final_src}" "${dest}"
42 @@ -1502,7 +1502,7 @@ activate_custom_mounts ()
43                 local cow_dir links_source
44                 if [ -n "${opt_link}" ] && [ -z "${PERSISTENCE_READONLY}" ]
45                 then
46 -                       link_files ${source} ${dest} ${rootmnt}
47 +                       link_files ${source} ${dest} "s|^/live/|/lib/live/mount/|"
48                 elif [ -n "${opt_link}" ] && [ -n "${PERSISTENCE_READONLY}" ]
49                 then
50                         mkdir -p ${rootmnt}/lib/live/mount/persistence
51 @@ -1519,7 +1519,7 @@ activate_custom_mounts ()
52                         chown_ref "${source}" "${cow_dir}"
53                         chmod_ref "${source}" "${cow_dir}"
54                         do_union ${links_source} ${cow_dir} ${source} ${rootfs_dest_backing}
55 -                       link_files ${links_source} ${dest} ${rootmnt}
56 +                       link_files ${links_source} ${dest} "s|^${rootmnt}||"
57                 elif [ -n "${opt_union}" ] && [ -z "${PERSISTENCE_READONLY}" ]
58                 then
59                         do_union ${dest} ${source} ${rootfs_dest_backing}