summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--conf.d/bootmisc4
-rwxr-xr-xinit.d/bootmisc91
3 files changed, 59 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index e1755e3..03d6c0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
+ 09 Sep 2007; Mike Frysinger <vapier@gentoo.org>:
+
+ Allow people to specify a list of temp dirs to clean in bootmisc #191807.
+
04 Sep 2007; Roy Marples <uberlord@gentoo.org>:
start-stop-daemon now works with userids correctly when a pidfile
diff --git a/conf.d/bootmisc b/conf.d/bootmisc
index 147f9d0..5bf7ecf 100644
--- a/conf.d/bootmisc
+++ b/conf.d/bootmisc
@@ -4,5 +4,9 @@
# system startup is complete
DELAYLOGIN="no"
+# List of /tmp directories we should clean up
+WIPE_TMP_DIRS="/tmp"
+
+# Should we wipe the tmp paths completely or just selectively remove known
# locks / files / etc... ?
WIPE_TMP="yes"
diff --git a/init.d/bootmisc b/init.d/bootmisc
index 73456c8..2d35419 100755
--- a/init.d/bootmisc
+++ b/init.d/bootmisc
@@ -9,6 +9,52 @@ depend() {
after clock sysctl
}
+cleanup_tmp_dir() {
+ local dir=$1
+
+ mkdir -p ${dir}
+ cd ${dir}
+ if [ "${WIPE_TMP}" = "yes" ] ; then
+ ebegin "Wiping ${dir} directory"
+ local startopts="-x . -depth"
+ [ "${RC_UNAME}" = "Linux" ] && startopts=". -xdev -depth"
+
+ # Faster than find
+ rm -rf [b-ikm-pr-zA-Z]*
+
+ find ${startopts} ! -name . \
+ ! -path ./lost+found \
+ ! -path "./lost+found/*" \
+ ! -path ./quota.user \
+ ! -path "./quota.user/*" \
+ ! -path ./aquota.user \
+ ! -path "./aquota.user/*" \
+ ! -path ./quota.group \
+ ! -path "./quota.group/*" \
+ ! -path ./aquota.group \
+ ! -path "./aquota.group/*" \
+ ! -path ./journal \
+ ! -path "./journal/*" \
+ -delete
+ eend 0
+ else
+ ebegin "Cleaning ${dir} directory"
+ rm -rf ${dir}/.X*-lock ${dir}/esrv* ${dir}/kio* ${dir}/jpsock.* \
+ ${dir}/.fam* ${dir}/.esd* ${dir}/orbit-* ${dir}/ssh-* \
+ ${dir}/ksocket-* ${dir}/.*-unix
+ eend 0
+ fi
+ chmod +t ${dir}
+
+ # Make sure our X11 stuff have the correct permissions
+ # Omit the chown as bootmisc is run before network is up
+ # and users may be using lame LDAP auth #139411
+ rm -rf ${dir}/.ICE-unix ${dir}/.X11-unix
+ mkdir -p ${dir}/.ICE-unix ${dir}/.X11-unix
+ chmod 1777 ${dir}/.ICE-unix ${dir}/.X11-unix
+ [ -x /sbin/restorecon ] && restorecon ${dir}/.ICE-unix ${dir}/.X11-unix
+}
+
start() {
# Put a nologin file in /etc to prevent people from logging
# in before system startup is complete.
@@ -85,46 +131,11 @@ start() {
printf "" >/var/lock/.keep
eend 0
- # Clean up /tmp directory
- cd /tmp
- if [ "${WIPE_TMP}" = "yes" ] ; then
- ebegin "Wiping /tmp directory"
- local startopts="-x . -depth"
- [ "${RC_UNAME}" = "Linux" ] && startopts=". -xdev -depth"
-
- # Faster than find
- rm -rf [b-ikm-pr-zA-Z]*
-
- find ${startopts} ! -name . \
- ! -path ./lost+found \
- ! -path "./lost+found/*" \
- ! -path ./quota.user \
- ! -path "./quota.user/*" \
- ! -path ./aquota.user \
- ! -path "./aquota.user/*" \
- ! -path ./quota.group \
- ! -path "./quota.group/*" \
- ! -path ./aquota.group \
- ! -path "./aquota.group/*" \
- ! -path ./journal \
- ! -path "./journal/*" \
- -delete
- eend 0
- else
- ebegin "Cleaning /tmp directory"
- rm -rf /tmp/.X*-lock /tmp/esrv* /tmp/kio* /tmp/jpsock.* \
- /tmp/.fam* /tmp/.esd* /tmp/orbit-* /tmp/ssh-* \
- /tmp/ksocket-* /tmp/.*-unix
- eend 0
- fi
-
- # Make sure our X11 stuff have the correct permissions
- # Omit the chown as bootmisc is run before network is up
- # and users may be using lame LDAP auth #139411
- rm -rf /tmp/.ICE-unix /tmp/.X11-unix
- mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
- chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
- [ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
+ # Clean up /tmp directories
+ local tmp
+ for tmp in ${WIPE_TMP_DIRS-/tmp} ; do
+ cleanup_tmp_dir ${tmp}
+ done
# Create an 'after-boot' dmesg log
if [ "${RC_SYS}" != "VPS" ] ; then