[oe-commits] org.oe.dev initscripts: SlugOS - add bootclean.sh to clean out /tmp, /var/lock, /var/run

mwester commit openembedded-commits at lists.openembedded.org
Wed Nov 21 01:04:32 UTC 2007


initscripts: SlugOS - add bootclean.sh to clean out /tmp, /var/lock, /var/run
(required when turned-up to disk).  Create SlugOS-specific volatiles config
because SlugOS needs /etc/resolv.conf to be static and not volatile.

Author: mwester at openembedded.org
Branch: org.openembedded.dev
Revision: 0eebea61b014c526ea797fe0413a8a28f8e22166
ViewMTN: http://monotone.openembedded.org/revision/info/0eebea61b014c526ea797fe0413a8a28f8e22166
Files:
1
packages/initscripts/initscripts-1.0/slugos/bootclean.sh
packages/initscripts/initscripts-1.0/slugos/volatiles
packages/initscripts/initscripts-slugos_1.0.bb
Diffs:

#
# mt diff -rdc7318b35dd6cc95503b1d9848da50570ff6899a -r0eebea61b014c526ea797fe0413a8a28f8e22166
#
# 
# 
# add_file "packages/initscripts/initscripts-1.0/slugos/bootclean.sh"
#  content [5ee9d16c6ee82710382962de81f55e894d4eb076]
# 
# add_file "packages/initscripts/initscripts-1.0/slugos/volatiles"
#  content [018cdf15373dbc496fd5aabfbb165ecaab713d78]
# 
# patch "packages/initscripts/initscripts-slugos_1.0.bb"
#  from [71d94c53d23cfef2b8d315d9ddb7041ec3ee445c]
#    to [b75e27a4183122b65f6236b01b8b2c27a015094e]
# 
============================================================
--- packages/initscripts/initscripts-1.0/slugos/bootclean.sh	5ee9d16c6ee82710382962de81f55e894d4eb076
+++ packages/initscripts/initscripts-1.0/slugos/bootclean.sh	5ee9d16c6ee82710382962de81f55e894d4eb076
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# bootclean.sh - Cleans out /tmp, /var/run, and /var/lock
+# This script should run after mountall.sh in runlevel S.
+#
+# This script relies upon find and xargs, and is largely
+# based on the equivalent script in the Debian releases.
+
+. /etc/default/rcS
+
+# Completely clean out everything in /tmp, but do not walk into
+# anything that might be mounted beneath /tmp.  If /tmp is not
+# a directory, ignore this (it's probably a symlink to
+# /var/volatiles/tmp, and we best leave it alone).
+
+if [ -d /tmp -a ! -L /tmp ] ; then
+  echo "bootclean.sh: Cleaning /tmp..."
+  cd /tmp || { echo "bootclean.sh: unable to cd to /tmp." ; return 1 ; }
+  find . -depth -xdev ! -type d -print0 | xargs -0r rm -f --
+  find . -depth -xdev -type d ! -name . -empty -exec rmdir \{\} \;
+else
+  echo "bootclean.sh: Skipping /tmp (not a directory)..."
+fi
+
+# Now clean out /var/lock.
+
+if [ -d /var/lock -a ! -L /var/lock ] ; then
+  echo "bootclean.sh: Cleaning /var/lock..."
+  cd /var/lock || { echo "bootclean.sh: unable to cd to /var/lock." ; return 1 ; }
+  find . -xdev ! -type d -print0 | xargs -0r rm -f --
+else
+  echo "bootclean.sh: Skipping /var/lock (not a directory)..."
+fi
+
+# Now clean out /var/run.
+
+if [ -d /var/run -a ! -L /var/run ] ; then
+  echo "bootclean.sh: Cleaning /var/run..."
+  cd /var/run || { echo "bootclean.sh: unable to cd to /var/run." ; return 1 ; }
+  find . -xdev ! -type d ! -name utmp -print0 | xargs -0r rm -f --
+else
+  echo "bootclean.sh: Skipping /var/run (not a directory)..."
+fi
+
+# done.
+
+exit 0
============================================================
--- packages/initscripts/initscripts-1.0/slugos/volatiles	018cdf15373dbc496fd5aabfbb165ecaab713d78
+++ packages/initscripts/initscripts-1.0/slugos/volatiles	018cdf15373dbc496fd5aabfbb165ecaab713d78
@@ -0,0 +1,36 @@
+# This configuration file lists filesystem objects that should get verified
+# during startup and be created if missing.
+#
+# Every line must either be a comment starting with #
+# or a definition of format:
+# <type> <owner> <group> <mode> <path> <linksource>
+# where the items are separated by whitespace !
+#
+# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
+#
+# A linking example:
+# l root root 0777 /var/test /tmp/testfile
+# f root root 0644 /var/test none
+#
+# Understanding links:
+# When populate-volatile is to verify/create a directory or file, it will first
+# check it's existence. If a link is found to exist in the place of the target,
+# the path of the target is replaced with the target the link points to.
+# Thus, if a link is in the place to be verified, the object will be created
+# in the place the link points to instead.
+# This explains the order of "link before object" as in the example above, where
+# a link will be created at /var/test pointing to /tmp/testfile and due to this
+# link the file defined as /var/test will actually be created as /tmp/testfile.
+d root root 0755 /var/volatile/cache none
+d root root 1777 /var/volatile/lock none
+d root root 0755 /var/volatile/log none
+d root root 0755 /var/volatile/run none
+d root root 1777 /var/volatile/tmp none
+l root root 0755 /var/cache /var/volatile/cache
+l root root 1777 /var/lock /var/volatile/lock
+l root root 0755 /var/log /var/volatile/log
+l root root 0755 /var/run /var/volatile/run
+l root root 1777 /var/tmp /var/volatile/tmp
+d root root 0755 /var/lock/subsys none
+f root root 0664 /var/log/wtmp none
+f root root 0664 /var/run/utmp none
============================================================
--- packages/initscripts/initscripts-slugos_1.0.bb	71d94c53d23cfef2b8d315d9ddb7041ec3ee445c
+++ packages/initscripts/initscripts-slugos_1.0.bb	b75e27a4183122b65f6236b01b8b2c27a015094e
@@ -10,7 +10,7 @@ RCONFLICTS = "initscripts"
 # All other standard definitions inherited from initscripts
 # Except the PR which is hacked here.  The format used is
 # a suffix
-PR := "${PR}.11"
+PR := "${PR}.12"
 
 FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/${P}', '${FILE_DIRNAME}/initscripts-${PV}', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}"
 
@@ -19,6 +19,7 @@ SRC_URI += "file://devices.patch;patch=1
 SRC_URI += "file://alignment.sh"
 SRC_URI += "file://domainname.sh"
 SRC_URI += "file://devices.patch;patch=1"
+SRC_URI += "file://bootclean.sh"
 
 # Without this it is not possible to patch checkroot.sh
 S = "${WORKDIR}"
@@ -30,6 +31,7 @@ do_install_append() {
 	# slugos specific scripts
 	install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
 	install -m 0755 ${WORKDIR}/domainname.sh ${D}${sysconfdir}/init.d
+	install -m 0755 ${WORKDIR}/bootclean.sh ${D}${sysconfdir}/init.d
 
 	# Remove the do install links (this detects a change to the
 	# initscripts .bb file - it will cause a build failure here.)
@@ -103,6 +105,8 @@ do_install_append() {
 	# checkfs.sh is currently disabled from S 30 (and won't work on SlugOS)
 	# ramdisk is not used on SlugOS, would run at S 30
 	update-rc.d -r ${D} mountall.sh		start 35 S .
+	# bootclean must run after mountall but before populate-volatile
+	update-rc.d -r ${D} bootclean.sh	start 36 S .
 	# base-files populate-volatile.sh runs at S37
 	update-rc.d -r ${D} devpts.sh		start 38 S .
 	# slugos file syslog starts here (39)






More information about the Openembedded-commits mailing list