diff options
author | Kurt J. Bosch <kjb-temp-2009@alpenjodel.de> | 2011-07-07 01:23:45 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2011-07-10 21:54:37 +0200 |
commit | 71e8540921bba7df926a3af9714d380c5af2b538 (patch) | |
tree | 96e566a234f2ea66644aea8a850b0b820a62cdcb | |
parent | 98363ca955850c62064934265c56a7ca159b0035 (diff) | |
download | initscripts-71e8540921bba7df926a3af9714d380c5af2b538.tar.xz |
rc.sysinit: Simplify /var/run/daemons workaround
There are only two possible situations:
a) /var/run is a symlink to /run: Conditional result is always 'false' even without checking /var/run/daemons (which doesn't exist).
b) /var/run is a directory: Conditional result is always 'true' because any symlink was removed when cleaning /var/run.
So following changes can be made:
* /var/run/daemons can be removed unconditionally because a symlink doesn't survive cleaning of /var/run anyway.
* The check whether /var/run/daemons is a symlink can be dropped because it has actually no effect.
Furthermore we can refactor to use the same conditional used for cleaning /var/run because we can't create the symlink if /var/run is not a directory.
-rwxr-xr-x | rc.sysinit | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -227,12 +227,12 @@ RANDOM_SEED=/var/lib/misc/random-seed cp $RANDOM_SEED /dev/urandom stat_busy "Removing Leftover Files" - rm -rf /etc/{nologin,shutdownpid} /forcefsck /tmp/* /tmp/.* &>/dev/null + rm -rf /etc/{nologin,shutdownpid} /forcefsck /tmp/* /tmp/.* /var/run/daemons &>/dev/null [[ ! -L /var/lock ]] && rm -rf /var/lock/* - [[ ! -L /var/run && -d /var/run ]] && find /var/run/ \! -type d -delete - [[ ! -L /var/run && ! -L /var/run/daemons ]] && - rm -rf /var/run/daemons && + 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 |