Add automatic creation/deletion of runlevels based on rcadd rcdel
authorEric Edgar <rocket@gentoo.org>
Fri, 22 Jul 2005 16:05:18 +0000 (16:05 +0000)
committerEric Edgar <rocket@gentoo.org>
Fri, 22 Jul 2005 16:05:18 +0000 (16:05 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@808 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
targets/support/rc-update.sh

index 683877c3f512215723f2e6dbca7a3180a45e42a5..9571fd6c32f041e417c2e74ec235185962e4b793 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.308 2005/07/19 21:44:14 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.309 2005/07/22 16:05:18 rocket Exp $
+
+  22 Jul 2005; Eric Edgar <rocket@gentoo.org> targets/support/rc-update.sh:
+  Add automatic creation/deletion of runlevels based on rcadd rcdel
 
   19 Jul 2005; Eric Edgar <rocket@gentoo.org> modules/grp_target.py:
   Fix grp so that grp/use is not required anymore
index bff808069a8d357fc67abe65b8f8b262d95a7199..e9f189d61379dc3fcc5dc6160a8d5f7f5e645e91 100644 (file)
@@ -48,6 +48,12 @@ then
     then
        for x in ${clst_rcadd}
        do
+           echo "Adding ${x%%|*} to ${x##*|}"
+           if [ ! -d /etc/runlevels/${x%%|*} ]
+           then
+               echo "Runlevel ${x##*|} doesn't exist .... creating it"
+               mkdir -p "/etc/runlevels/${x##*|}"
+           fi
            rc-update add "${x%%|*}" "${x##*|}"
        done
     fi
@@ -58,6 +64,16 @@ then
        do
            rc-update del "${x%%|*}" "${x##*|}"
        done
+       for x in $(ls /etc/runlevels)
+       do
+           CONTENTS=$(find /etc/runlevels/${x} -type f)
+           if [ -z "${CONTENTS}" ]
+           then
+               echo "${x}: Empty runlevel found.... deleting"
+               rmdir "/etc/runlevels/${x}"
+           fi
+       done
+                   
     fi
 fi