[PATCH] Allow /tmp to be a symlink to /run/tmp
Serge Belyshev
belyshev at depni.sinp.msu.ru
Sat Dec 1 15:21:23 GMT 2018
Hi! This patch fixes two small issues:
In /usr/share/doc/initscripts/README.Debian it is documented that /tmp
could be a symlink to a non-existent directory, which will be created.
However, this fails because bootclean.sh runs before mountall.sh and
clean_tmp() chokes on a broken link.
Shortly thereafter, mount_tmp() fails to create the directory with the
proper mode. Fixed thus.
---
debian/src/initscripts/lib/init/bootclean.sh | 2 ++
debian/src/initscripts/lib/init/mount-functions.sh | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/debian/src/initscripts/lib/init/bootclean.sh b/debian/src/initscripts/lib/init/bootclean.sh
index 67e15a66..55f1c8b2 100644
--- a/debian/src/initscripts/lib/init/bootclean.sh
+++ b/debian/src/initscripts/lib/init/bootclean.sh
@@ -52,6 +52,8 @@ checkflagfile()
}
clean_tmp() {
+ # Will be created by mount_tmp()
+ [ -L /tmp ] && [ -d /tmp ] || return 0
# Does not exist
[ -d /tmp ] || return 1
# tmpfs does not require cleaning
diff --git a/debian/src/initscripts/lib/init/mount-functions.sh b/debian/src/initscripts/lib/init/mount-functions.sh
index e453f6a8..cd09883f 100644
--- a/debian/src/initscripts/lib/init/mount-functions.sh
+++ b/debian/src/initscripts/lib/init/mount-functions.sh
@@ -627,7 +627,7 @@ mount_tmp ()
# If /tmp is a symlink, make sure the linked-to directory exists.
if [ -L /tmp ] && [ ! -d /tmp ]; then
TMPPATH="$(readlink /tmp)"
- mkdir -p --mode=755 "$TMPPATH"
+ mkdir -p --mode="$TMP_MODE" "$TMPPATH"
[ -x /sbin/restorecon ] && /sbin/restorecon "$TMPPATH"
fi
More information about the Debian-init-diversity
mailing list