From d7ea2987d6ba92206202f389e3e157407d6bb5a4 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 23 Nov 2007 13:52:15 +0000 Subject: grep isn't always in /bin --- sh/init-common-post.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sh') 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 -- cgit v1.2.3