diff options
-rw-r--r-- | meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch | 53 | ||||
-rw-r--r-- | meta/recipes-core/update-rc.d/update-rc.d_0.7.bb | 6 |
2 files changed, 57 insertions, 2 deletions
diff --git a/meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch b/meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch new file mode 100644 index 0000000000..4476e9101d --- /dev/null +++ b/meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | Check if symlinks are valid | ||
2 | |||
3 | When using root option and $initd/$bn is a symlink, the script would fail because | ||
4 | the symlink points to a path on target. For example: | ||
5 | |||
6 | /path/to/target/rootfs/etc/init.d/syslog -> /etc/init.d/syslog.busybox | ||
7 | |||
8 | Hence, [ -f /path/to/target/rootfs/etc/init.d/syslog ] condition would return | ||
9 | false. | ||
10 | |||
11 | This patch adds the posibility to check whether the file the symlink points to | ||
12 | actually exists in rootfs path and then continue. | ||
13 | |||
14 | Upstream-Status: Pending | ||
15 | |||
16 | Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> | ||
17 | |||
18 | Index: git/update-rc.d | ||
19 | =================================================================== | ||
20 | --- git.orig/update-rc.d 2013-01-16 12:12:58.349814356 +0200 | ||
21 | +++ git/update-rc.d 2013-01-16 13:02:42.490864939 +0200 | ||
22 | @@ -147,13 +147,29 @@ | ||
23 | bn=$1 | ||
24 | shift | ||
25 | |||
26 | +sn=$initd/$bn | ||
27 | +if [ -L "$sn" -a -n $root ]; then | ||
28 | + readlink=$(which readlink) | ||
29 | + | ||
30 | + if [ -n $readlink ]; then | ||
31 | + sn=$($readlink "$sn") | ||
32 | + case "$sn" in | ||
33 | + /*) sn=${root}${sn} ;; | ||
34 | + *) sn=$initd/$sn ;; | ||
35 | + esac | ||
36 | + else | ||
37 | + echo "update-rc.d: readlink tool not present, cannot check whether \ | ||
38 | + $sn symlink points to a valid file." >&2 | ||
39 | + fi | ||
40 | +fi | ||
41 | + | ||
42 | if [ $1 != "remove" ]; then | ||
43 | - if [ ! -f "$initd/$bn" ]; then | ||
44 | + if [ ! -f "$sn" ]; then | ||
45 | echo "update-rc.d: $initd/$bn: file does not exist" >&2 | ||
46 | exit 1 | ||
47 | fi | ||
48 | else | ||
49 | - if [ -f "$initd/$bn" ]; then | ||
50 | + if [ -f "$sn" ]; then | ||
51 | if [ $force -eq 1 ]; then | ||
52 | echo "update-rc.d: $initd/$bn exists during rc.d purge (continuing)" >&2 | ||
53 | else | ||
diff --git a/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb b/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb index 0aac5fa013..bfcbd97bcd 100644 --- a/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb +++ b/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb | |||
@@ -5,13 +5,15 @@ SECTION = "base" | |||
5 | LICENSE = "GPLv2+" | 5 | LICENSE = "GPLv2+" |
6 | LIC_FILES_CHKSUM = "file://update-rc.d;beginline=5;endline=15;md5=148a48321b10eb37c1fa3ee02b940a75" | 6 | LIC_FILES_CHKSUM = "file://update-rc.d;beginline=5;endline=15;md5=148a48321b10eb37c1fa3ee02b940a75" |
7 | 7 | ||
8 | PR = "r4" | 8 | PR = "r5" |
9 | 9 | ||
10 | # Revision corresponding to tag update-rc.d_0.7 | 10 | # Revision corresponding to tag update-rc.d_0.7 |
11 | SRCREV = "eca680ddf28d024954895f59a241a622dd575c11" | 11 | SRCREV = "eca680ddf28d024954895f59a241a622dd575c11" |
12 | 12 | ||
13 | SRC_URI = "git://github.com/philb/update-rc.d.git;protocol=git \ | 13 | SRC_URI = "git://github.com/philb/update-rc.d.git;protocol=git \ |
14 | file://add-verbose.patch;" | 14 | file://add-verbose.patch \ |
15 | file://check-if-symlinks-are-valid.patch \ | ||
16 | " | ||
15 | 17 | ||
16 | S = "${WORKDIR}/git" | 18 | S = "${WORKDIR}/git" |
17 | 19 | ||