#!/bin/sh run=/etc/rc.d levels="" base=$1 if [ ! -d $run ] ; then exit 0 fi if [ -d $run/init.d ] ; then levels=$run init='../init.d/'$1'.init' run=$run/init.d target=$1'.init' else target='rc.'$1 levels='false' fi source=$1'.init' shift if [ ! -f "$run/$target" ] ; then echo 'Adding '$target' to '$run if [ -f /etc/sudo.conf ] ; then sudo root install -o root -m 0700 $source $run/$target else su root -c "install -o root -m 0700 $source $run/$target" fi else exit 0 fi if [ -z "$BASH" ] ; then exit 0 fi if [ -z "$levels" ] ; then exit 0 fi initial=$1 shift for level in $* ; do runlvl=$levels'/rc'$level'.d' if [ ! -d $runlvl ] ; then continue fi cd $runlvl count=$initial while [ -f *$count* ] ; do count=$[count + 1] done target='S'$count$base echo 'Adding '$target' to '$runlvl ln -s $init $target done