restore support for old persistence media
[live-boot-grml.git] / debian / patches / reverts / restore_support_for_old_persistence.patch
1 From: Evgeni Golov <evgeni@debian.org>
2 Subject: restore support for old persistence media
3
4 Index: live-boot-grml/components/9990-aaa-fixme.sh
5 ===================================================================
6 --- live-boot-grml.orig/components/9990-aaa-fixme.sh    2014-03-08 13:43:19.172121783 +0100
7 +++ live-boot-grml/components/9990-aaa-fixme.sh 2014-03-08 13:43:19.164122722 +0100
8 @@ -26,5 +26,8 @@
9         export PATH
10  fi
11  
12 +old_root_overlay_label="live-rw"
13 +old_home_overlay_label="home-rw"
14  custom_overlay_label="persistence"
15 +old_custom_overlay_label="custom-ov"
16  persistence_list="persistence.conf"
17 Index: live-boot-grml/components/9990-misc-helpers.sh
18 ===================================================================
19 --- live-boot-grml.orig/components/9990-misc-helpers.sh 2014-03-08 13:43:19.172121783 +0100
20 +++ live-boot-grml/components/9990-misc-helpers.sh      2014-03-08 13:43:19.168122252 +0100
21 @@ -1632,6 +1632,32 @@
22         echo ${used_devices}
23  }
24  
25 +fix_backwards_compatibility ()
26 +{
27 +       local device dir opt backing include_list
28 +       device=${1}
29 +       dir=${2}
30 +       opt=${3}
31 +
32 +       if [ -n "${PERSISTENCE_READONLY}" ]
33 +       then
34 +               return
35 +       fi
36 +
37 +       backing="$(mount_persistence_media ${device})"
38 +       if [ -z "${backing}" ]
39 +       then
40 +               return
41 +       fi
42 +
43 +       include_list="${backing}/${persistence_list}"
44 +       if [ ! -r "${include_list}" ] && [ ! -r "${backing}/${old_persistence_list}" ]
45 +       then
46 +               echo "# persistence backwards compatibility:
47 +${dir} ${opt},source=." > "${include_list}"
48 +       fi
49 +}
50 +
51  is_mountpoint ()
52  {
53         directory="$1"
54 Index: live-boot-grml/components/9990-overlay.sh
55 ===================================================================
56 --- live-boot-grml.orig/components/9990-overlay.sh      2014-03-08 13:43:19.172121783 +0100
57 +++ live-boot-grml/components/9990-overlay.sh   2014-03-08 13:43:19.168122252 +0100
58 @@ -210,7 +210,7 @@
59  
60                 if is_in_comma_sep_list overlay ${PERSISTENCE_METHOD}
61                 then
62 -                       overlays="${custom_overlay_label}"
63 +                       overlays="${old_root_overlay_label} ${old_home_overlay_label} ${custom_overlay_label} ${old_custom_overlay_label}"
64                 fi
65  
66                 local overlay_devices
67 @@ -222,10 +222,27 @@
68                                 media="$(echo ${media} | tr ":" " ")"
69  
70                                 case ${media} in
71 +                                       ${old_root_overlay_label}=*)
72 +                                               device="${media#*=}"
73 +                                               fix_backwards_compatibility ${device} / union
74 +                                               overlay_devices="${overlay_devices} ${device}"
75 +                                               ;;
76 +
77 +                                       ${old_home_overlay_label}=*)
78 +                                               device="${media#*=}"
79 +                                               fix_backwards_compatibility ${device} /home bind
80 +                                               overlay_devices="${overlay_devices} ${device}"
81 +                                               ;;
82 +
83                                         ${custom_overlay_label}=*)
84                                                 device="${media#*=}"
85                                                 overlay_devices="${overlay_devices} ${device}"
86                                                 ;;
87 +
88 +                                       ${old_custom_overlay_label}=*)
89 +                                               device="${media#*=}"
90 +                                               overlay_devices="${overlay_devices} ${device}"
91 +                                               ;;
92                                  esac
93                         done
94                 fi