aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt J. Bosch <kjb-temp-2009@alpenjodel.de>2011-07-11 22:46:15 +0200
committerKurt J. Bosch <kjb-temp-2009@alpenjodel.de>2011-07-12 17:22:39 +0200
commitd980c23c0a5e9020402cd944c701f4e1f44d208d (patch)
tree9b49111fffa179eddcd9b2d29dbaa8c99d1df1a9
parentb58d073ecd10315931c34d5177b9ce956b310375 (diff)
downloadinitscripts-d980c23c0a5e9020402cd944c701f4e1f44d208d.tar.xz
functions/rc.sysinit: Refactor 'Removing Leftover Files' code
Move it into a function to allow clean error detection of all steps performed and also to be able to reuse this in rc.single.
-rw-r--r--functions14
-rwxr-xr-xrc.sysinit13
2 files changed, 16 insertions, 11 deletions
diff --git a/functions b/functions
index 000ee0e..fdf30fd 100644
--- a/functions
+++ b/functions
@@ -417,6 +417,20 @@ mount_all() {
mount -a -t "nosysfs,no${NETFS//,/,no}" -O no_netdev
}
+remove_leftover() {
+ stat_busy "Removing Leftover Files"
+ rm -rf /etc/{nologin,shutdownpid} /forcefsck /tmp/* /tmp/.[^.]* /tmp/..?* /var/run/daemons
+ [[ ! -L /var/lock ]] && rm -rf /var/lock/*
+ if [[ ! -L /var/run && -d /var/run ]]; then
+ find /var/run/ \! -type d -delete
+ ln -s /run/daemons /var/run/daemons
+ fi
+ install -Tm 0664 -o root -g utmp <(:) /var/run/utmp
+ # Keep {x,k,g}dm happy with xorg
+ mkdir -m 1777 /tmp/.{X11,ICE}-unix
+ stat_done
+}
+
bootlogd_stop() {
[[ -f /run/bootlogd.pid ]] || return 0
touch /var/log/boot
diff --git a/rc.sysinit b/rc.sysinit
index 6af105f..1516fba 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -226,17 +226,8 @@ RANDOM_SEED=/var/lib/misc/random-seed
status "Initializing Random Seed" \
cp $RANDOM_SEED /dev/urandom
-stat_busy "Removing Leftover Files"
- rm -rf /etc/{nologin,shutdownpid} /forcefsck /tmp/* /tmp/.[^.]* /tmp/..?* /var/run/daemons
- [[ ! -L /var/lock ]] && rm -rf /var/lock/*
- if [[ ! -L /var/run && -d /var/run ]]; then
- find /var/run/ \! -type d -delete
- ln -s /run/daemons /var/run/daemons
- fi
- install -Tm 0664 -o root -g utmp <(:) /var/run/utmp
- # Keep {x,k,g}dm happy with xorg
- mkdir -m 1777 /tmp/.{X11,ICE}-unix
-stat_done
+# Remove leftover files
+remove_leftover
if [[ $HOSTNAME ]]; then
stat_busy "Setting Hostname: $HOSTNAME"