aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/busybox.post-upgrade
diff options
context:
space:
mode:
Diffstat (limited to 'main/busybox/busybox.post-upgrade')
-rw-r--r--main/busybox/busybox.post-upgrade16
1 files changed, 12 insertions, 4 deletions
diff --git a/main/busybox/busybox.post-upgrade b/main/busybox/busybox.post-upgrade
index f5ec35cf8e2..66fd1c49325 100644
--- a/main/busybox/busybox.post-upgrade
+++ b/main/busybox/busybox.post-upgrade
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/busybox sh
# remove links that has been relocated or removed
# - generate a list of all symlinks in bin dirs and a list with all busybox
@@ -7,14 +7,16 @@
# symlinks that does not exist in the busybox applets list.
# - use stat to find the target of those symlinks printed as:
# '/path/to/symlink' -> '/path/to/target'
+# The "2>/dev/null" is used to stop "can't stat" warnings appearing on
+# the console for each new command added by the new version of the
+# busybox package.
# - use awk to print the symlinks that points to '/bin/busybox'
# - use sed to strip the leading and training ' chars
# - finally pass the list to rm for removing the symlinks that points to
# busybox but does not exist in the `busybox --list-all` list
-cd /
( find bin sbin usr/bin usr/sbin -maxdepth 1 -type l; busybox --list-all) \
| sort | uniq -u \
- | xargs -r stat -c "%N" \
+ | xargs -r stat -c "%N" 2>/dev/null \
| awk "\$3 == \"'/bin/busybox'\" {print \$1}" \
| sed "s/^'//; s/'$//" \
| xargs -r rm
@@ -26,4 +28,10 @@ for link in /bin/ping /bin/ping6; do
done
# We need the symlinks early
-exec /bin/busybox --install -s
+/bin/busybox --install -s || exit 1
+
+# can't be in pre-upgrade since adduser/group may not available then
+addgroup -S klogd 2>/dev/null
+adduser -S -D -H -h /dev/null -s /sbin/nologin -G klogd -g klogd klogd 2>/dev/null
+
+exit 0