⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setld

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻
📖 第 1 页 / 共 5 页
字号:
			awk '{print $10}' $_S.inv		}		return 0	}	# Generate report	echo "Subset		Status		Description======		======		==========="	LIST=`echo *.ctrl | sed 's/\.ctrl//g'`	[ "$LIST" = '*' ] && return 0	for _S in $LIST	{		STATUS=		[ -f $_S.lk ] && STATUS="installed"		[ -f $_S.dw ] && STATUS="corrupt" # ica-12459		ReadCtrlFile . $_S 2> /dev/null || 		{			# if .ctrl is incomplete, subset is incomplete 			STATUS="incomplete"		} 		echo "$_S'$STATUS'$DESC"	} | awk -F"'" '{ printf "%-16s%-16s%s\n", $1, $2, $3 }'	return 0) }:	-ListKnown#		Given a version free subset name, print a list of all other#		versions of that subset currently known to the system.##	given:	a version free subset name ($P$N) parts only.#	does:	looks up version of $P$N know the the system#	return:	nothing#	sides:	none#	output:	a list of subset codesListKnown(){ (	PN=$1	LIST=`(cd $UAS; echo $PN???.ctrl | sed 's/\.ctrl//g' )`	case "$LIST" in	*'*'*)	return		# No '*' match	esac	echo "$LIST") }:	-LoadCtrlInfo#		read the installation control information from the media#	into $_TDIR##	given:	global info#		$_MEDIA - media type to read#		$_SRC - unit to read from#		$_TDIR - target directory#	does:	read the control information required to perform the task#		defined in $CMDSW into $_TDIR#	return:	0 if everything goes well, 1 otherwise#	effect:	sets SBS to list subsets installable from the media#	note:	assumes that wd is the desired rootLoadCtrlInfo(){	case "$_MEDIA" in	diskette)		[ "$CMDSW" = "x" ] &&		{			Error "diskette media unsupported for -x"			return 1		}		echo "Insert the $IC diskette for the softwareyou wish to load on your system in $_MEDIA unit $_SRC."		Ready		(cd $_TDIR;tar xpf $D/rra${_SRC}a) > $TMP1 ||		{			echo "Attempt to read from diskette drive $_SRC failed.Remove your diskette from $_MEDIA unit $_SRC."			# flip unit numbers			_SRC=`expr $_SRC $ALTOP 1`			ALTOP=`ChOp $ALTOP`			echo "Insert the $IC diskette for the softwareyou wish to load in $_MEDIA unit $_SRC.NOTE: we are trying the SAME DISKETTE again but in $_MEDIA unit $_SRC."			Ready			(cd $_TDIR;tar xpf $D/rra${_SRC}a) ||			{				Error "Cannot read control information"				return 1			}		}		;;	disk)	# mounted directory contains subsets		[ -d $_SRC/instctrl ] ||		{			Error "$_SRC/instctrl: $ENOENT"			return 1		}		# copy control info into $_TDIR.		(cd $_SRC/instctrl; tar cf - *)|(cd $_TDIR; tar xpf -)		;;	inet)	[ $CMDSW = x ] &&		{			Error "network media not supported for -x"			return 1		}		cd $_R		[ -f etc/hosts ] && cp etc/hosts $HOSTS 		IAM=`hostname`		# break off bind spec, first part only used in client		#  file naming		set -- `Parse . $IAM`		IAM=$1		ERROR=`rcp ris@$_SRC:clients/risdb $TMP1 2>&1` ||		{			Error "cannot access server database ($ERROR)"			return 1		}		# we have copied the server's ris database to $TMP1		#  this database has entries:		#  cliname:haddr:sys-type,prod,...,prod		# find the record for this client		RISRECORD=`egrep '^'$IAM: $TMP1` ||		{			Error "$IAM: not in server database"			return 1		}		# break out the fields, save the sys-type,prod,...,prod		#  section		set -- `Parse : $RISRECORD`		RISDATA=$3		# break the sys-type,prod,...,prod into parts		set -- `Parse , $RISDATA`		_SYSTEM=$1		shift		# Products		PRODUCTS=$*		# Read Control Files over one dir at a time, building rismap		#  from each directory as it comes		for DIR in $PRODUCTS		{			mkdir $_TDIR/$DIR			rsh $_SRC -l ris -n "cd $_SYSTEM/$DIR/instctrl;tar cf - *" |				(cd $_TDIR/$DIR;tar xpf -)			(	cd $_TDIR/$DIR				echo "$DIR \c" >> ../rismap				echo *.ctrl | sed 's/.ctrl//g' >> ../rismap				mv * ..			)			rm -rf $_TDIR/$DIR &		}		;;	tape)	echo "Positioning Tape"		PositionTape 1 0 ||		{			Error "Tape Positioning Error"			mt -f $RAW rew &			_CPOS=-$T_0			return 1		}		(cd $_TDIR;tar xpbf 20 $RAW && mt -f $RAW fsf) ||		{			Error "Error reading control information"			return 1		}		_CPOS=1		echo		;;	*)	Error "Internal error in LoadCtrlInfo()"		set | WriteLog		return 1	esac		# set all modes and ownerships of incomming files	(cd $_TDIR		chown root *.inv *.scp *.ctrl		chgrp system *.inv *.scp *.ctrl		chmod 644 *.inv *.scp *.ctrl		chmod +x *.scp	)	# Determine which subsets are availble from the media	#  and are installable in the current context.	#	#! fix for setld -l loc subset [ subset... ]	# have DetermineAvailable set up $SBS	DetermineAvailable	# put SBS in correct order	case "$_MEDIA" in	tape)	SBS=`(cd $_TDIR; DependencyOrder $SBS)`		;;	*)	SBS=`(cd $_TDIR; depord $SBS)`	esac}:	-LoadFromDisk#		Load a subset from disk##	given:	full GLOBAL context#	does:	load a subset from disk#	return:	1 on failureLoadFromDisk(){	TickWhile "$DECOMP < $_SRC/$S | tar xpf -"	return $?}:	-LoadFromDiskette#		Load a subset from a diskette##	given:	full GLOBAL context#	does:	loads a subset from diskettes#	return:	ignoreLoadFromDiskette(){	VOL=1	set xx `Parse : $NVOLS`	NVOLS=$2	VMAX=`expr $2 + 1`	while [ $VOL -le $NVOLS ]	do		echo "Insert diskette $NAME $VOL of $NVOLS in $_MEDIA unit $_SRC."		Ready		# check volume number.		tar tf $D/rra${_SRC}a > $TMP1 ||		{			_SRC=`expr $_SRC $ALTOP 1`			ALTOP=`ChOp $ALTOP`			echo "$E_FAILRemove diskette $NAME $VOL of $NVOLS.Insert diskette $NAME $VOL of $NVOLS in $_MEDIA unit $_SRC.NOTE: we are trying the SAME DISKETTE AGAIN but in $_MEDIA unit $_SRC."			Ready			tar tf $D/rra${_SRC}a > $TMP1 ||			{				echo "Cannot read your diskette, we will continue with the next volume."				VOL=`expr $VOL + 1`				continue			}		}		ISVOL=`egrep "^Volume" $TMP1`		ISVOL=`expr "$ISVOL" : '.*ume\([0-9][0-9]*\)'`		case "$ISVOL" in		$VOL)			;;		*)			echo "You have mistakenly mounted volume $ISVOL.Please remove the diskette."			sleep 1			continue			;;		esac		tar xpf $D/rra${_SRC}a ||		{			_SRC=`expr $_SRC $ALTOP 1`			ALTOP=`ChOp $ALTOP`			echo "$E_FAILRemove diskette $NAME $VOL of $NVOLS.Insert diskette $NAME $VOL of $NVOLS in $_MEDIA unit $_SRC.NOTE: we are trying the SAME DISKETTE AGAIN but in $_MEDIA unit $_SRC."			Ready			tar xpf $D/rra${_SRC}a ||			{				Error "$E_FAILDiskette $NAME: $VOL of $NVOLS may not have been installedproperly on your system but the rest of the installation will continue."			}			ERR=1		}		echo "Remove diskette $NAME $VOL of $NVOLS."		VOL=`expr $VOL + 1`	done}:	-LoadFromInet#		read a subset from internet##	given:	full GLOBAL context#	does:	read a subset from internet onto the system#	return:	non-zero on failureLoadFromInet(){ (	# read the rismap to determine which directory to search for this	#  subset	set -- `egrep $S $_TDIR/rismap` ||	{		Error "LoadFromInet($S): cannot open rismap"		set | WriteLog		return 1	}	DIR=$1        # restore the hosts file in the event it was overwritten during        #  the install of a previous subset        [ -f $HOSTS ] && cp $HOSTS etc/hosts  	# unpack the subset from the server onto the system	Ticker on	rsh $_SRC -l ris -n "dd if=$_SYSTEM/$DIR/$S bs=10k" 2> /dev/null |		$DECOMP | tar xpbf 20 -	RETVAL=$?	Ticker off	return $RETVAL) }:	-LoadFromMedia#		load a subset from the installation medium##	given:	$1 - the name of the subset to install#		$DEVICE - device (location) name to use#		$_MEDIA - media type#		$_SRC - media handle to use (named unit, hostname, etc)#	does:	Load and verify the subset#	return:	nothing#	effect: may modify globals ALTOP, _CPOS, _CVOLLoadFromMedia(){	S=$1	ERR=0	CTX=$UAS/$S	cd $_R	Log "$S LOAD, \c"	ReadCtrlFile $_TDIR $S ||	{		Error "Error reading control file"		return 1	}	ISOPT=`FlagsAttrCheck SATTR_OPTION $FLAGS`	# check sizing	fitset $_R < $_TDIR/$S.inv 2> /dev/null ||	{		Error "There is not enough file system space for subset $S"		return `expr $ISOPT + 1`	}	# check dependency list	for DEP in $DEPS	{		[ "$DEP" = '.' ] && continue		[ -f $UAS/$DEP.lk ] ||		{			Error "Error installing $DESC ($S):Subset $S requires the existence of subset $DEP to operatecorrectly. Please install subset $DEP before trying to install subset $S."			return `expr $ISOPT + 1`		}	}	ACT=PRE_$ACT $_TDIR/$S.scp ||	{		Log "DECLINED (scp)"		echo "Installation declined by subset control program.$DESC ($S) will not be loaded."		return `expr $ISOPT + 1`	}	# drop a .dw marker	> $CTX.dw	echo "$DESC ($S)"	echo "   Copying from $_LOC ($_MEDIA)"	# check if it's a compressed subset.	DECOMP=cat	NameParse LOC_ $S	[ -f $_TDIR/$LOC_P$LOC_V.comp ] && DECOMP="compress -d"	# run a sweep of the disk clearing away files which cannot	#  be tarred over.	tclear < $_TDIR/$S.inv ||	{	 	Error "System contains files which cannot be overwritten"	 	return `expr $ISOPT + 1`	}	case $_MEDIA in	disk)	LoadFromDisk ||		{	# utter failure			Error "$E_FAILSubset $S may not have been installed properly on your systembut the rest of the installation will continue."		}		;;	diskette)		LoadFromDiskette		;;	inet)	LoadFromInet ||		{			Error "Load from $_SRC failed, subset $S"		}		;;	tape)	LoadFromTape ||		{			Error "$E_FAIL$DESC ($S) may not have installed properly on your system (tar error)"		}	esac	sync	cp $_TDIR/$S.ctrl $UAS ||	{		Error "Cannot get control file for $S"		return `expr $ISOPT + 1`	}	cp $_TDIR/$S.inv $UAS ||	{		Error "Cannot get inventory file for $S"		return `expr $ISOPT + 1`	}	cp $_TDIR/$S.scp $UAS ||	{		Error "Cannot get control program for $S"		return `expr $ISOPT + 1`	}	# Verify the subset	Log "VERIFY, \c"	echo "   Verifying"	echo "SUBSET $S at $_R:" >> /$V/$A/fverifylog	TickWhile "fverify -y < $CTX.inv 2> /dev/null" &&	{		Log "SUCCEEDED"		# verify succeeded, move lock and queue SCP		mv $CTX.dw $CTX.lk		return 0	}	# Verify Failed	Error "There were verification errors for $DESC ($S)"	case "$ISOPT$CMDSW" in	0[al])	return 1		;;	*)	return 2	esac}:	-LoadFromTape#		Load a subset from tape to the system##	given:	full GLOBAL context#	does:	read the subset from the tape to the system#	return:	non-zero on failureLoadFromTape(){	set -- `Parse : $MTLOC`	MTVOL=$1	MTLOC=$2	PositionTape $1 $2	TickWhile "dd if=$RAW bs=10k 2> /dev/null | $DECOMP | tar x${VBSE}pf -"	RET=$?	[ $RET = 0 ] && _CPOS=`Add $_CPOS 1`	return $RET}:	-Log#		write entry to log file##	given:	an entry to write#	does:	writes entry to logfile named in global LOGFILE#	return:	nothingLog(){	echo "$1" >> $LOGFILE}:	-Main#		This is the main program##	given:	$* from command line#	does:	parse arguments and all sorts of miscellany#	return:	does not returnMain(){	ARGV=$*	trap '		for DIR in $TMPS	# save the temp directories		{			mv $DIR \#$DIR 2> /dev/null		}		trap "" 3		Log "Non-Standard Exit"		Ferror 1 "Exiting"	' 1 2 3 15	[ -t 1 ] && stty -tabs		# permit tabs use on output if isatty	DATE=`date $DATFMT`	# Set tar verbose switch if necessary	case "$-" in	*x*)	VBSE=v		DBG_FITSET=-d		DEBUG=1		Error "$PROG: debug: debug enabled"	esac	umask 22	OpenLog			# initialize logging	Args $ARGV || Ferror 2 "error in Args()"	(Dirs) || Ferror 2 "error in Dirs()"	case $CMDSW in	a)	Ferror 2 "Unreached in Main(), CMDSW=a"		;;	c)	Configure $*		Exit		;;	d)	Delete $*		Exit		;;	h)	Usage -h		Exit 0		;;	i)	Inventory $*		Exit		;;	l)	InitDevice || Ferror 2 "cannot initialize $DEVICE"		cd $_R		LoadCtrlInfo ||			Ferror 2 "cannot load control information"		set -- $ARGV		[ $# = 0 ] &&		{			SplitByType || Exit $?			# here we have determined which subsets are known			#  from this media. initailize the subsets database			#  with the control and inventory info for all of			#  these subsets			for _S in $MAND $OPT			{				cp $_TDIR/$_S.ctrl $_TDIR/$_S.inv $_TDIR/$_S.scp $UAS			}			TickWhile PreSize install $MAND ||			{				Error "There is not enough file system space to install the mandatory subsets"				Exit 1			}			case "$ADVFLAG" in			0|2)	# basic installation				SBS=$MAND				;;			*)	SelectSubsets || Exit $?			esac			set -- $SBS		}		Install $*		Exit $?		;;	u)	InitDevice || Ferror 2 "cannot initialize $DEVICE"		cd $_R		LoadCtrlInfo ||			Ferror 2 "cannot load control information"		Update		Exit $?		;;	v)	Verify $*		Exit		;;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -