#!/bin/sh
##############################################################################
# $Id: relink_init_script,v 1.1 2002/03/21 19:09:24 root Exp $
##############################################################################
# Solaris init scripts are hard linked into the /etc/rc?.d directories.
# Thus, if we edit an init script in /etc/init.d via sed or similar
# methods which change the inode, the links in /etc/rc?.d get orphaned.
# This recreates the links as symlinks.
##############################################################################
# $Log: relink_init_script,v $
# Revision 1.1  2002/03/21 19:09:24  root
# Initial revision
#
##############################################################################

echo
echo "Start of $0"
echo '  $Id: relink_init_script,v 1.1 2002/03/21 19:09:24 root Exp $'

BASE=/a

if [ -z "$1" ]
then
	echo "  No init script specified" >&2
	exit
fi

echo "  Relinking $1 init script"
for i in $BASE/etc/rc?.d/*$1
do
	echo "    Relinking $i to ../init.d/$1"
	rm -f $i
	ln -s ../init.d/$1 $i
done

echo "End of $0"

