From 0cc9b20c15460213e488bf5e70963b941482f628 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Tue, 14 Jan 2025 16:06:02 -0600 Subject: Add source. --- sdk/bin/instinit | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 sdk/bin/instinit (limited to 'sdk/bin/instinit') diff --git a/sdk/bin/instinit b/sdk/bin/instinit new file mode 100755 index 0000000..fdd0899 --- /dev/null +++ b/sdk/bin/instinit @@ -0,0 +1,61 @@ +#!/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 + + + -- cgit v1.2.3-54-g00ecf