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

📄 setld.orig

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 ORIG
📖 第 1 页 / 共 2 页
字号:
	#	SBS=`egrep -v ROOT $TDIR/*.image|awk '{print $3}'`esac || {	EMESG="Cannot read kit table of contents"	exit}#**************************************#	EXTRACT FOR RIS#case "$ACT" inX)	#! run a df -i and get sizing here.	case "$MEDIA" in	tape)		wait ||		{			EMESG="Tape Positioning Error."			exit		}	esac	# fire off the instctrl stuff right away!	[ -d instctrl ] ||		mkdir instctrl	IF=`(cd $TDIR;echo *.image)`	(		(cd $TDIR;tar cf - *) | (cd instctrl;tar xpf -;touch $IF)	) &	# is there a root dump to be had?	grep -s ROOT $TDIR/*.image &&	{		# extract it from the tape		echo -n "ROOT " >> $LOGFILE &		echo -n "Extracting ROOT..." &		case "$MEDIA" in		tape)	mt -f $RAW bsf 3 && mt -f $RAW fsf &&				dd if=$RAW of=ROOT bs=20b 2> $NUL ||			{				mt rew &				echo -n "FAILED " >> $LOGFILE &				rm -f checksums mandatory				EMESG="Error extracting ROOT"				exit			}			mt -f $RAW fsf ||			{				# assume position lost				echo -n "FAILED " >> $LOGFILE &				mt -f $RAW rew && mt -f $RAW fsf 4 ||				{					mt rew &					rm -f checksums mandatory					EMESG="Error extracting ROOT"					exit				}				echo "RECOVERED" >> $LOGFILE			}			;;		DISK)	cp $_U/ROOT .			;;		esac ||			{				echo -n "FAILED " >> $LOGFILE &				rm -f checksums mandatory				EMESG="Error extracting ROOT"				exit			}		sum ROOT|tr '\012' ' ' > checksums		echo "ROOT" >> checksums &		echo "SUCCEEDED" >> $LOGFILE &		echo done. &	}		# drop the load.	> mandatory	[ -f checksums ] || > checksums	for _S in $SBS	{		echo -n "Extracting $_S..." &		echo -n "$_S " >> $LOGFILE &		case "$MEDIA" in		tape)	dd if=$RAW of=$_S bs=10k 2> $NUL			;;		DISK)	cp $_U/$_S .			;;		esac ||			{				echo "FAILED" >> $LOGFILE &				rm -f checksums mandatory				EMESG="Error extracting $_S"				exit			}		wait	# waits on instctrl copy AND previous checksum		echo "SUCCEEDED" >> $LOGFILE &		echo done. &		(sum $_S|tr '\012' ' ' >> checksums;echo "$_S" >> checksums) &		TZAK=$TDIR/$_S		[ -f $TDIR/$_S.ctrl ] &&		{			. $TDIR/$_S.ctrl			FLAGS=`expr $FLAGS / 2`			case `expr $FLAGS % 2` in			0)	echo $_S >> mandatory &			esac		}	}	wait	case "$MEDIA" in	tape)	mt -f $RAW rew &	esac	LOG=	diff checksums $TDIR/*.image > csd ||	{		HEADER="There were checksum errors on:$NL"		grep "<" csd |		while read X		do			set xx $X			case "$2" in			"<")	echo "$HEADER	$5"				HEADER=			esac		done	}	rm -f checksums csd &	EMESG="$LOG${NL}Media extraction complete."	STAT=0;exit	;;esac#**************************************#	FIND MANDATORY SUBSETS#cd $ROOTPATHcase "$ACT" inL)	MAND=""	# list of mandatory subsets	OPT=""	# list of optional subsets	# scan control files, differentiate OPT & MAND subsets	INSTALLED=		# smu-2290	for _S in $SBS	{		# make sure subset is not installed.		[ -f $UAS/$_S.lk ] && 		{			INSTALLED=1			continue		}		. $TDIR/$_S.ctrl		# save the description information...		eval DESC$_S='$DESC'		# bit 2 on flags means subset is optional		X=`expr $FLAGS / 2`		case `expr $X % 2` in		1)	OPT="$OPT $_S"			;;		*)	MAND="$MAND $_S"		esac	}	case "$MAND$OPT$INSTALLED" in	"")	EMESG="No installable subsets on your kit"		STAT=1		exit		;;	1)	EMESG="All subsets on the kit are already installed"		STAT=0		exit	esacesac#**************************************#	USER SUBSET SELECTION#case "$ACT$ADVFLAG" inL0)	# basic installation, mandatory subsets only.	SBS=$MAND	;;L*)	# a note on table field formatting used here:	#  the string to be printed in the table is padded to	#  be AT LEAST as wide as the desired field and piped to sed.	#  Sed chops off anything following the fortieth character.	FW="......................................"	# 38 of them.	SP="                                        "	case "$OPT" in	"")	echo "The following subsets will be installed:"		N=-n		for _S in $MAND		{			eval DESC='$DESC'$_S			PSTR=`expr " * $DESC$SP" : '\('$FW'\).*'`			wait			echo $N "$PSTR  "			case $N in			-n)	N=				;;			*)	N=-n			esac		}		echo $N		# will terminate line if needed.		while :		do			echo -n "Do you wish to continue? (y/n): "			read X			X=`echo $X`			case "$X" in			[yY]*)				break				;;			[Nn]*)				exit 0				;;			esac		done		SBS=$MAND		;;	*)		echo "$NL*** Enter Subset Selections ***" &		# list out mandatory subsets if any.		while :		do			case "$MAND" in			"")	;;			*)	echo "The following subsets are mandatory and will be installed automatically:" &				N=-n				for _S in $MAND				{					eval DESC='$DESC'$_S					PSTR=`expr " * $DESC$SP" : '\('$FW'\).*'`					wait					echo $N "$PSTR  " &					case "$N" in					-n)	N=						;;					*)	N=-n					esac				}				wait;echo $N				;;			esac			# this builds the selection table.			echo "The subsets listed below are optional:" &			N=-n			X=1			for _S in $OPT			{				eval ORD$X=$_S				eval DESC='$DESC'$_S				case "$X" in				?)	X=" $X"				esac				PSTR=`expr "$X) $DESC$SP" : '\('$FW'\).*'`				wait				echo $N "$PSTR  " &				X=`expr $X + 1`				case "$N" in				-n)	N=					;;				*)	N=-n				esac			}			wait;echo $N			ALL=$X			NONE=`expr $X + 1`			case "$ALL" in			?)	PALL=" $ALL"				;;			*)	PALL="$ALL"			esac			case "$NONE" in			?)	PNONE=" $NONE"				;;			*)	PNONE="$NONE"			esac			echo -n "$PALL) All of the Above$PNONE) None of the AboveEnter your choice(s): "			read X			# walk thru the input...			SORTED=			for I in $X			{				# is it a number?				J=`expr $I : '\([0-9][0-9]*\)'`				case $I in				$ALL|$NONE)					SORTED=$I					break					;;				$J)	;;				*)	echo "Invalid choice: $I (malformed number)" &					continue				esac				# is it in range?				[ $I -gt $NONE ] &&				{					echo "Invalid Choice: $I (out of range)" &					continue				}				HI=$SORTED LO=				# insert # into sorted list...				for J in $SORTED				{					case "$I" in					$J)	I=						break						;;					esac					if [ $I -gt $J ]					then						LO="$LO $J"						set xx $HI						shift;shift						HI=$*					else						break					fi				}				SORTED="$LO $I $HI"			}			case $SORTED in			"")	continue				;;			$ALL)				SBS="$MAND $OPT"				;;			$NONE)				SBS="$MAND"				;;			*)				SBS="$MAND"				for X in $SORTED				{					eval _S='$ORD'$X					SBS="$SBS $_S"				}			esac			#! insert size checking here			case "$SBS" in			"")	echo -n "You have chosen not to install any of the subsets offered.Is this correct? (y/n): "				read X				case "$X" in				[Yy]*)	case "$MEDIA" in					tape)	mt -f $RAW rew					esac					STAT=2;exit				esac				continue			esac			echo "You are installing the following subsets:" &			N=-n			for _S in $SBS			{				eval DESC='$DESC'$_S				PSTR=`expr "   $DESC$SP" : '\('$FW'\).*'`				wait				echo $N "$PSTR  " &				case "$N" in				-n)	N=					;;				*)	N=-n				esac			}			wait;echo $N			echo -n "Is this correct? (y/n): "			read X			case "$X" in			[Yy]*)	break			esac		done		;;	esac	# case OPT	;;esac	# case ACT,ADVFLAG# only A and L get this far....#**************************************#	INSTALL SUBSETS FROM MEDIA#SCPLIST=OPTERRS=0for _S in $SBSdo	ERR=0	# set TZAK for this context.	TZAK=$UAS/$_S	# do we know this subset?	[ -f $TZAK.ctrl ] ||	{		echo "$NL$E_UNKNOWN $_S." &		continue	}	echo -n "$_S LOAD, " >> $LOGFILE &	# internalize the control file	. $TZAK.ctrl	CTRLSTR="~$DESC~$NVOLS~$MTLOC~$DEPS~$FLAGS~"	# did we get it all?	case "$CTRLSTR" in	*~~*)	echo "$E_CFCPTN $_S" &		echo "FAILED (control file garbled)" >> $LOGFILE &		continue		;;	esac	X=`expr $FLAGS / 2`	ISOPT=`expr $X % 2`	fitset $ROOTPATH < $TZAK.inv 2> /dev/null ||	{		echo "FAILED (sizing)" >> $LOGFILE &		case "$ISOPT" in		0)	echo "There is not enough file system space for mandatory subset $_S$PROG cannot continue."			exit		esac		echo "There is not enough file system space for subset $_S$PROG will continue with the next subset.$NL"		continue	}	# check dependency list	for DEP in $DEPS	{		case $DEP in		.)	continue			;;		*)			[ -f $UAS/$DEP.lk ] ||			{				echo "FAILED (dependency $DEP)" >> $LOGFILE &				echo "Subset $_S requires the existence of the $DEP subset to operatecorrectly. Please install subset $DEP before trying to install the$_S subset." &				continue 2			}		esac	}	ACT=PRE_$ACT $UAS/$_S.scp ||	{		echo "DECLINED (scp)" >> $LOGFILE &		echo "Installation declined by subset control program.$DESC ($_S) will not be installed."		continue	}	echo "${NL}Copying $DESC ($_S) from $MEDIA" &	# check if it's a compressed subset.	DECOMP=cat	PCODE=`expr $_S : '\(...\).*'`	VCODE=`expr $_S : '.*\(...\)'`	[ -f $UAS/$PCODE$VCODE.comp ] && DECOMP="compress -d"	case $MEDIA in	network)	# install from server.		[ -f hosts ] && cp hosts etc/hosts		rsh $_U -l ris -n "dd if=$_S bs=10k " 2> $NUL |			$DECOMP |			tar xpbf 20 - ||		{			cp hosts etc/hosts &			echo "FAILED (tar error)" >> "$LOGFILE" &			echo "Install from $_U failed subset $_S" &			ERR=1		}		;;	rx50)	# load from diskettes.		VOL=1		IFS=:		set xx $NVOLS;shift		IFS="$DIFS"		NVOLS=$2		VMAX=`expr $2 + 1`		while :		do			case "$VOL" in			"$VMAX")				break				;;			esac			echo -n "Insert diskette $NAME $VOL of $NVOLS in $MEDIA unit $_U.$NL"			ready			# check volume number.			tar tf $D/rra${_U}a > $TMP1 ||			{				_U=`expr $_U $ALTOP 1`				case "$ALTOP" in				+)	ALTOP=-					;;				-)	ALTOP=+					;;				esac				echo -n "$NL$E_FAILRemove diskette $NAME $VOL of $NVOLS.$NLInsert diskette $NAME $VOL of $NVOLS in $MEDIA unit $_U.NOTE: we are trying the SAME DISKETTE AGAIN but in $MEDIA unit $_U.$NL"				ready				tar tf $D/rra${_U}a > $TMP1 ||				{					echo "Cannot read your diskette, we will continue with the next volume." &					VOL=`expr $VOL + 1`					continue				}			}			ISVOL=`grep "^Volume" $TMP1`			ISVOL=`expr "$ISVOL" : '.*ume\([0-9][0-9]*\)'`			case "$ISVOL" in			$VOL)				;;			*)				echo "You have mistakenly mounted volume $ISVOL.$NLPlease remove the diskette." &				sleep 1				continue				;;			esac			tar xpf $D/rra${_U}a ||			{				_U=`expr $_U $ALTOP 1`				case "$ALTOP" in				+)	ALTOP=-					;;				-)	ALTOP=+					;;				esac				echo -n "$NL$E_FAILRemove diskette $NAME $VOL of $NVOLS.$NLInsert diskette $NAME $VOL of $NVOLS in $MEDIA unit $_U.NOTE: we are trying the SAME DISKETTE AGAIN but in $MEDIA unit $_U.$NL"				ready				tar xpf $D/rra${_U}a ||				{					echo "FAILED (tar error)" >> $LOGFILE &					echo "$NL$NL$E_FAIL$NLDiskette $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		;;	DISK)	$DECOMP < $_U/$_S | tar xpf - ||		{	# utter failure			echo "FAILED (tar error)" >> $LOGFILE &			echo "$NL$E_FAIL$NLSubset $_S may not have been installed properly on your systembut the rest of the installation will continue." &			ERR=1		}		;;	tape)	IFS=:		set xx $MTLOC;shift		IFS="$DIFS"		MTVOL=$1		MTLOC=$2		# position tape.		#		wait		# how far to next subset?		case "$MTVOL" in		$CURVOL)			;;		*)	#! this volume change logic only partially implemented			#!			echo -n "Volume change. Rewinding tape..."			mt -f $RAW rew && mt -f $RAW offl ||				echo "error$NL$NLI can't dismount your tape. You will have to take thetape drive off line manually."			echo -n "$NLPlease remove tape volume $CURVOL and replace it withvolume $MTVOL.$NL"			ready			mt rew; mt fsf 2	# don't change that 2!			POS=0			;;		esac		X=`expr $POS - $MTLOC`		POS=$MTLOC		# exit status from last command run from between		#  these parenthes will serve as exit value of		#  parens as a whole.		wait		case "$X" in		0)	# we're at it.			;;		-*)	# forward X files.			IFS=-			X=`echo $X`			IFS="$DIFS"			mt -f $RAW fsf $X			;;		*)				X=`expr $X + 2`			mt -f $RAW bsf $X && mt -f $RAW fsf			;;		esac && dd if=$RAW bs=10k 2> $NUL | $DECOMP | tar x${VBSE}pf - &&		POS=`expr $POS + 1` ||		{			echo "FAILED (tar error)" >> $LOGFILE &			echo "$NL$E_FAIL$NLSubset $NAME may not have installed properly on your system (tar error)" &			ERR=1		}		;;	esac	# MEDIA	# verify this subset.	echo -n "VERIFY, " >> $LOGFILE &	echo "Verifying $DESC ($_S)" &	echo "${NL}SUBSET $_S at $ROOTPATH:" >> /$V/$A/fverifylog &	if fverify -y <$TZAK.inv 2> $TMP1	then		> $UAS/$_S.lk		rm -f $UAS/$_S.dw		chmod 644 $UAS/$_S.lk &		SCPLIST="$SCPLIST $_S"		echo "SUCCEEDED" >> $LOGFILE &	else		echo "There were fatal verification errors for subset $_S" &		echo "FAILED (fverify)" >> $LOGFILE &		> $UAS/$_S.dw	# ica-12459		case "$ISOPT" in		0)	exit			;;		1)	OPTERRS=2		esac	fidonecase $MEDIA intape)	wait; mt -f $RAW rew &	;;esac#**************************************#	EXECUTE POST INSTALL SCP'S#SACT=$ACTfor _S in $SCPLIST{	echo -n "$_S SCP POST_$SACT " >> $LOGFILE	ACT=POST_$SACT $UAS/$_S.scp ||	{		echo "FAILED (post-scp)" >> $LOGFILE &		echo "The subset control program for subset $_S failed." &		[ -s $UAS/$_S.lk ] &&		{			echo "This failure may adversely affect the operation of the following subsets:$NL" &			sort $UAS/$_S.lk|uniq		}		rm -f $UAS/$_S.lk		case "$ISOPT" in		0)	exit			;;		1)	OPTERRS=2		esac	}	# update lock files	. $UAS/$_S.ctrl	for K in $DEPS	{		case "$K" in		.)	break		esac		echo "$_S" >> $UAS/$K.lk &	}		case "$DEFPATH" in	1)	ACT=C $UAS/$_S.scp INSTALL		;;	esac	echo "SUCCEEDED" >> $LOGFILE &}[ -f hosts ] && mv hosts etc/hosts[ -f /hosts ] && mv /hosts /etc/hostsSTAT=$OPTERRSEMESG=wait	# finish rew on tapesexit

⌨️ 快捷键说明

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