diff options
author | Roy Marples <roy@marples.name> | 2007-11-23 13:52:15 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-11-23 13:52:15 +0000 |
commit | d7ea2987d6ba92206202f389e3e157407d6bb5a4 (patch) | |
tree | f4ba2dca7e027c3cc447ca2ffd3a63b2d3de799b /sh/init-common-post.sh | |
parent | 9583df9c28827ab503ecd3bfc0c69e230c25933f (diff) |
grep isn't always in /bin
Diffstat (limited to 'sh/init-common-post.sh')
-rw-r--r-- | sh/init-common-post.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sh/init-common-post.sh b/sh/init-common-post.sh index ef53d3d6..850342dd 100644 --- a/sh/init-common-post.sh +++ b/sh/init-common-post.sh @@ -26,10 +26,15 @@ # mount $svcdir as something we can write to if it's not rw # On vservers, / is always rw at this point, so we need to clean out # the old service state data -if mkdir "${RC_SVCDIR}/.test.$$" 2>/dev/null ; then +if [ "${RC_SVCDIR}" != "/" ] && mkdir "${RC_SVCDIR}/.test.$$" 2>/dev/null; then rmdir "${RC_SVCDIR}/.test.$$" - rm -rf $(ls -d1 "${RC_SVCDIR:-/lib/rcscripts/init.d}"/* 2>/dev/null | \ - grep -Ev "/(deptree|ksoftlevel|rc.log)$") + for x in ${RC_SVCDIR:-/lib/rcscripts/init.d}/*; do + [ -e "${x}" ] || continue + case ${x##*/} in + deptree|ksoftlevel|rc.log) ;; + *) rm -rf "${x}";; + esac + done else mount_svcdir fi |