71 lines
1.8 KiB
Bash
71 lines
1.8 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Generate init.d database files required by multithreaded init system
|
|
#
|
|
# (c) 2003-2009 by Silvan Calarco - silvan.calarco@mambasoft.it
|
|
|
|
rcldir=/var/init
|
|
|
|
function get_runlevel_files() {
|
|
unset ALL_RUNLEVEL
|
|
runlevel=$1
|
|
startstop=$2
|
|
|
|
if [ $startstop = "S" ]; then
|
|
min="$start_min"
|
|
else
|
|
min="$stop_min"
|
|
fi
|
|
|
|
for i in $(ls -v /etc/rc$runlevel.d/$startstop* 2>/dev/null); do
|
|
#suffix=${i#/etc/rc$runlevel.d/$startstop}
|
|
service=${i#/etc/rc$runlevel.d/$startstop[0-9][0-9]}
|
|
#seqnum=${suffix:0:2}
|
|
ALL_RUNLEVEL="$ALL_RUNLEVEL $service"
|
|
done
|
|
}
|
|
|
|
get_runlevel_files 0 S
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/0.start.rcl
|
|
|
|
get_runlevel_files 1 S
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/1.start.rcl
|
|
cp $rcldir/1.start.rcl $rcldir/S.start.rcl
|
|
|
|
get_runlevel_files 2 S
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/2.start.rcl
|
|
|
|
get_runlevel_files 3 S
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/3.start.rcl
|
|
|
|
get_runlevel_files 4 S
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/4.start.rcl
|
|
|
|
get_runlevel_files 5 S
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/5.start.rcl
|
|
|
|
get_runlevel_files 6 S
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/6.start.rcl
|
|
|
|
get_runlevel_files 0 K
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/0.stop.rcl
|
|
|
|
get_runlevel_files 1 K
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/1.stop.rcl
|
|
cp $rcldir/1.stop.rcl $rcldir/S.stop.rcl
|
|
|
|
get_runlevel_files 2 K
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/2.stop.rcl
|
|
|
|
get_runlevel_files 3 K
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/3.stop.rcl
|
|
|
|
get_runlevel_files 4 K
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/4.stop.rcl
|
|
|
|
get_runlevel_files 5 K
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/5.stop.rcl
|
|
|
|
get_runlevel_files 6 K
|
|
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/6.stop.rcl
|