#!/bin/sh

PR_BASE=`basename $0`
PREVRUN=`runlevel | cut -d ' ' -f 1`

# Display our stuff ONLY if the kernel patch is present and we are booting
# and ONLY if we are called as SXXname

if [ -w /proc/progress ] && [ $PREVRUN = "N" ] && [ `echo $PR_BASE | cut -c 1` = "S" ]; then
	# get the name and the start number (0 to 99) of the service
	PR_NAME=`echo $PR_BASE | cut -c 4-`
	PR_NUM=`echo $PR_BASE | cut -c 2-3`
	# get a value from 67 to 100
	PR_NEWNUM=`echo "$PR_NUM / 3 + 67" | bc`
	# echo "$PR_NEWNUM starting $PR_NAME EOL"
    	echo "$PR_NEWNUM" > /proc/progress
fi

# Basic functions used in rc.sysinit (and can be used in each service script)

function pr_warn()
{
	if [ -w /proc/progress ]; then
		echo w > /proc/progress
	fi
}


function pr_fail()
{
	if [ -w /proc/progress ]; then
		echo f > /proc/progress
	fi
}

 
function pr_set()
{
	if [ -w /proc/progress ]; then
		echo $1 $2 > /proc/progress
	fi
}

