From bf776bf0be8bc17aa8692d2da0639e8815b5ec00 Mon Sep 17 00:00:00 2001 From: Eric Edgar Date: Fri, 22 Jul 2005 16:05:18 +0000 Subject: [PATCH] Add automatic creation/deletion of runlevels based on rcadd rcdel git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@808 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 5 ++++- targets/support/rc-update.sh | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 683877c3..9571fd6c 100644 --- 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 targets/support/rc-update.sh: + Add automatic creation/deletion of runlevels based on rcadd rcdel 19 Jul 2005; Eric Edgar modules/grp_target.py: Fix grp so that grp/use is not required anymore diff --git a/targets/support/rc-update.sh b/targets/support/rc-update.sh index bff80806..e9f189d6 100644 --- a/targets/support/rc-update.sh +++ b/targets/support/rc-update.sh @@ -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 -- 2.26.2