head     1.2;
access   ;
symbols  ;
locks    ; strict;
comment  @# @;


1.2
date     86.04.02.15.53.24;  author mark;  state Exp;
branches ;
next     1.1;

1.1
date     86.04.02.15.38.21;  author mark;  state Exp;
branches ;
next     ;


desc
@@


1.2
log
@added warning messages for failed mv or ln in setting up basic symbolic ]
links.
@
text
@#! /bin/csh
#
# Name:
#	 RHOST
#
# syntax:
#
#	 RHOST <newhost> file [file ...]
#
# Description:
#
#	for each file, produce:
#		file -> .file.$RHOST
#		.file.
#		.file.<newhost>
#		.file.$RHOST -> .file.
#
#
set NEWHOST = $1
shift
foreach f ($*)
	if ( ! -e $f ) then
		echo $f not found
	else
		set head = $f:h
		set tail = $f:t
		if ( $head == $tail ) then
			set hidden = .${head}.
		else
			set hidden = ${head}/.${tail}.
		endif

#
# change original name to hidden name (foo to .foo.) and create the
# symbolic link (foo -> .foo.$RHOST).
#
		if ( ! -e $hidden ) then
			mv $f $hidden
			if ($status != 0) then
				echo "Unknown problem encountered in executing the command"
				echo "	mv $f $hidden"
				echo "Be sure to check this after exiting from Admin."
				echo -n "Type RETURN to proceed..."
				set dummy = ($<)
			endif
			ln -s ${hidden}'$RHOST' $f
			if ($status != 0) then
				echo "Unknown problem encountered in executing the command"
				echo "	ln -s ${hidden}'$RHOST' $f"
				echo "Be sure to check this after exiting from Admin."
				echo -n "Type RETURN to proceed..."
				set dummy = ($<)
			endif
		endif
#
# create remotely owned version (.foo.<newhost> )
# If foo was a directory then create a doirectory else an empty file.
#
		if ( ! -e ${hidden}${NEWHOST} ) then
			if ( -d $hidden ) then
				mkdir ${hidden}${NEWHOST}
			else
				cp /dev/null ${hidden}${NEWHOST}
			endif
		endif
	endif
##
## Temporary stuff until diskless is fully integrated...created a backward
## symbolic link so a non-diskless kernel will still find original files.
##
	if ( ! -e ${hidden}'$RHOST'  ) then
		ln -s $hidden ${hidden}'$RHOST'
	endif
end
@


1.1
log
@Initial revision
@
text
@d39 7
d47 7
@
