Magellan Linux

Diff of /trunk/magellan-initscripts/sbin/rc-config

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 222 by niro, Sun Jul 3 13:54:15 2005 UTC revision 223 by niro, Fri Sep 9 16:34:35 2005 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/sbin/rc-config,v 1.3 2005-07-03 13:54:15 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/sbin/rc-config,v 1.4 2005-09-09 16:28:55 niro Exp $
3    
4  RC_INIT_BASE=/etc/init.d  RC_INIT_BASE=${MROOT}/etc/init.d
5  RC_EXCLUDE="rc functions template splash-functions"  RC_EXCLUDE="rc functions template splash-functions"
6    
7  VERSION=0.2  VERSION=0.3
8    
9  get_run_levels(){  get_run_levels(){
10   local SCRIPT   local SCRIPT
# Line 95  rc_service_add() { Line 95  rc_service_add() {
95   [ "${i}" == "7:s" ] && i="sysinit:s"   [ "${i}" == "7:s" ] && i="sysinit:s"
96   echo -e "\t\t[rc${i/:s/}.d -> S${RC_START}]"   echo -e "\t\t[rc${i/:s/}.d -> S${RC_START}]"
97   ln -snf ../init.d/${RC_SERVICE} \   ln -snf ../init.d/${RC_SERVICE} \
98   /etc/rc.d/rc${i/:s/}.d/S${RC_START}${RC_SERVICE}   ${MROOT}/etc/rc.d/rc${i/:s/}.d/S${RC_START}${RC_SERVICE}
99   ;;   ;;
100   # stop   # stop
101   ?:k)   ?:k)
102   [ "${i}" == "7:k" ] && i="sysinit:k"   [ "${i}" == "7:k" ] && i="sysinit:k"
103   echo -e "\t\t[rc${i/:k/}.d -> K${RC_STOP}]"   echo -e "\t\t[rc${i/:k/}.d -> K${RC_STOP}]"
104   ln -snf ../init.d/${RC_SERVICE} \   ln -snf ../init.d/${RC_SERVICE} \
105   /etc/rc.d/rc${i/:k/}.d/K${RC_STOP}${RC_SERVICE}   ${MROOT}/etc/rc.d/rc${i/:k/}.d/K${RC_STOP}${RC_SERVICE}
106   ;;   ;;
107   *)   *)
108   echo "error"   echo "error"
# Line 120  rc_service_del(){ Line 120  rc_service_del(){
120   do   do
121   for z in 00 01 02 03 04 05 06 07 08 09 $(seq 10 99)   for z in 00 01 02 03 04 05 06 07 08 09 $(seq 10 99)
122   do   do
123   if [ -L "/etc/rc.d/rc${i}.d/S${z}${RC_SERVICE}" ]   if [ -L "${MROOT}/etc/rc.d/rc${i}.d/S${z}${RC_SERVICE}" ]
124   then   then
125   echo -e "\t\t[rc${i}.d <- S${z}]"   echo -e "\t\t[rc${i}.d <- S${z}]"
126   rm /etc/rc.d/rc${i}.d/S${z}${RC_SERVICE}   rm ${MROOT}/etc/rc.d/rc${i}.d/S${z}${RC_SERVICE}
127   fi   fi
128    
129   if [ -L "/etc/rc.d/rc${i}.d/K${z}${RC_SERVICE}" ]   if [ -L "${MROOT}/etc/rc.d/rc${i}.d/K${z}${RC_SERVICE}" ]
130   then   then
131   echo -e "\t\t[rc${i}.d <- K${z}]"   echo -e "\t\t[rc${i}.d <- K${z}]"
132   rm /etc/rc.d/rc${i}.d/K${z}${RC_SERVICE}   rm ${MROOT}/etc/rc.d/rc${i}.d/K${z}${RC_SERVICE}
133   fi   fi
134   done   done
135   done   done
# Line 150  rc_service_show() { Line 150  rc_service_show() {
150   level=${i}   level=${i}
151   fi   fi
152    
153   for script in /etc/rc.d/rc${level}.d/*   for script in ${MROOT}/etc/rc.d/rc${level}.d/*
154   do   do
155   x="$(basename ${script})"   x="$(basename ${script})"
156   if [ "${x/???/}" == "${RC_SERVICE}" ]   if [ "${x/???/}" == "${RC_SERVICE}" ]
# Line 160  rc_service_show() { Line 160  rc_service_show() {
160   done   done
161   done   done
162    
163   #show them (single)   # show them (single)
164   echo -n "${RC_SERVICE}: "   echo -n "${RC_SERVICE}: "
165   for i in $(seq 0 7)   for i in $(seq 0 7)
166   do   do
# Line 204  chg_initdefault() { Line 204  chg_initdefault() {
204   exit 1   exit 1
205   fi   fi
206    
207   current=$(cat /etc/inittab|grep initdefault)   current=$(cat ${MROOT}/etc/inittab|grep initdefault)
208    
209   cp /etc/inittab /etc/inittab-orig   cp ${MROOT}/etc/inittab ${MROOT}/etc/inittab-orig
210   sed -e "s/${current}/id:${newinitdef}:initdefault:/g"   \   sed -e "s/${current}/id:${newinitdef}:initdefault:/g"   \
211   /etc/inittab-orig > /etc/inittab   ${MROOT}/etc/inittab-orig > /etc/inittab
212   if [ "$?" == "0" ]   if [ "$?" == "0" ]
213   then   then
214   rm -f /etc/inittab-orig   rm -f ${MROOT}/etc/inittab-orig
215   echo "Changed default initlevel to ${newinitdef} successfully."   echo "Changed default initlevel to ${newinitdef} successfully."
216   exit 0   exit 0
217   else   else

Legend:
Removed from v.222  
changed lines
  Added in v.223