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

📄 gentapes

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻
📖 第 1 页 / 共 3 页
字号:
#!/bin/sh5#   DO *NOT* EDIT: FILE CREATED BY MAKE Fri Nov 10 16:08:56 EST 1989#!/bin/sh5## @(#)gentapes	4.1	(ULTRIX)	7/2/90##    gentapes.sh5 - sh5 script for generic remote tape production#	OR#    gentapes.sh5 - sh5 routines  for generic remote tape production##			Copyright (c) 1989 by#		Digital Equipment Corporation, Maynard, MA#			All rights reserved.#								#	This software is furnished under a license and may be used and#	copied  only  in accordance with the terms of such license and#	with the  inclusion  of  the  above  copyright  notice.   This#	software  or  any  other copies thereof may not be provided or#	otherwise made available to any other person.  No title to and#	ownership of the software is hereby transferred.		#								#	The information in this software is subject to change  without#	notice  and should not be construed as a commitment by Digital#	Equipment Corporation.					#								#	Digital assumes no responsibility for the use  or  reliability#	of its software on equipment which is not supplied by Digital.#GENTAPES_USAGE="Usage: gentapes [-verify] [-write] [remhost:[:]]kitcode device	-verify	verify only	-write	write only	-check_only		Check that each subset that needs to be written to a		kit exists in on of the kit directories.  Implies		-write.  In other words, this option inhibits anything		being written out to tape.	remhost	TCP or DECnet hostname where kit files reside	device	magtape output device	DECnet remhost (not yet implemented) should contain two colons, network	access information can be included, example:		remhost/username/password::ULT-4.0-V-BW	"GENTAPES_SCCSID="@(#)gentapes	4.1 (ULTRIX online dist) 7/2/90"readonly GENTAPES_SCCSIDcase "$GENTAPES_NO_EXECUTE" in    "")	PROG=`basename $0`	echo "$PROG: $GENTAPES_SCCSID"	PATH=/usr/5bin:/bin:/etc:/usr/bin:/usr/ucb:/usr/hosts	export PATH	ME=`whoami`	if [ $ME != "root" -a $ME != "tarsa" ]	then	    echo 1>&2 "?${PROG}: You must be root to run this script"	    exit 1	fiesacset -h	# hash subroutine references_KitManip_included="yes"_K_Interpret_Kitcap(){(FUNC=_K_Interpret_Kitcap NUMARGS=2test $UTIL_DEBUG && echo 1>&2 "DEBUG: $FUNC($*)"case "$#" in    ${NUMARGS})	# right number of args, perform search        KITTYPE="$1"	KITCAP="$2"	;;    *)		# wrong number of args, error	echo 1>&2 "$FUNC($# args): Must have ${NUMARGS} arguments"	exit 1	;;esacK_NAME= NEWIMAGE= KITDESC= PRODLIST= KITDIRS= SUBSETLIST= NVOLS=0KITCODE=`expr $KITTYPE : '\(.*\)..'`DEVTYPE=`expr $KITTYPE : '.*\(..\)'`KITDESC=`grep "^$KITTYPE[:|]" $KITCAP ` ||    {    ERRFLG=0    if [ "$DEVTYPE" = "MT" ]    then	KITDESC=`grep "^${KITCODE}TK[:|]" $KITCAP ` ||	    {	    echo 1>&2 "\07$FUNC: can't find either $KITTYPE or" \	    	      "${KITCODE}TK kit descriptors in kitcap."	    ERRFLG=1	    }    else	echo 1>&2 "\07$FUNC: can't find $KITTYPE kit descriptor in kitcap."	ERRFLG=1    fi    if [ $ERRFLG -ne 0 ]    then	(	echo "\nRecognized kit codes are as follows:"	grep '^[A-Z0-9]' $LCL_KITCAP |		sed -e '/^ULTTEST/d' \		    -e 's/:.*$//' \		    -e 's/[MT][TK][:|].*//' |		sort -u |		    pr -3 -t -l20 -o4	) | more 1>&2	echo 1>&2	exit 1    fi    }NEWIMAGE=`expr $KITCODE : '\([A-Z0-9][A-Z0-9][A-Z0-9]\)'`OFS="$IFS"IFS=:set $KITDESCRAW_NAME="$1"	# save raw name fieldshift		# shift past the kitnameIFS="$OFS"for K in $*do    case $K in    *TK | *MT)		# entries ending in "TK" or "MT" are product codes	PRODCODE=`expr $K : '\(.*\)[TM][KT]'`	PRODLIST="$PRODLIST $PRODCODE"	;;    /* | ./* )		# entry starting with slash is the dir path, save it.	KITDIRS="$KITDIRS $K"	;;    %%*)		# entries starting with %% are volume numbers.	SUBSETLIST="$SUBSETLIST $K"	VOL=`expr $K : '%%\(.*\)'`	if [ $VOL -gt $NVOLS ]	then	    NVOLS=$VOL	fi	;;    * )			# All others are regular subsets, add them to the list.	SUBSETLIST="$SUBSETLIST $K"	;;    esacdoneOFS="$IFS"IFS='|'set $RAW_NAMEIFS="$OFS"case $# in    1)			# no K_NAME if no '|'        K_NAME=	;;    2)			# K_NAME is second sub-field	K_NAME=$2	;;    *)	K_NAME=$2	echo 1>&2 "?$FUNC: WARNING: multiple synonyms in name field: $*"	echo 1>&2 " Using $K_NAME"	;;esacecho K_NAME='"'$K_NAME'"'echo NEWIMAGE='"'$NEWIMAGE'"'echo KITDESC='"'$KITDESC'"'echo PRODLIST='"'$PRODLIST'"'echo KITDIRS='"'$KITDIRS'"'echo SUBSETLIST='"'$SUBSETLIST'"'echo NVOLS='"'$NVOLS'"')}_K_Get_Local_Kitcap(){(NUMARGS=4 FUNC=_K_Get_Local_Kitcaptest $UTIL_DEBUG && echo 1>&2 "DEBUG: $FUNC($*)"case "$#" in    3|${NUMARGS})	# right number of args, perform search        HOST="$1"	REMKITCAP="$2"	LCLKITCAP="$3"	KIT_ROOT="$4"	# will be null if only 3 args	;;    *)		# wrong number of args, error	echo 1>&2 "$FUNC($# args): Must have ${NUMARGS} arguments"	exit 1	;;esacKITROOT_TOKEN=${KITCAP_KITROOT_TOKEN-"%%KITROOT%%"}_U_Remote_Copy $HOST ${REMKITCAP} /usr/tmp/tmpkitcap$$ ||    {    DISPHOST=`echo $HOST | sed 's=\(.*/.*\)/.*=\1/password:='`    echo 1>&2 "\07$FUNC: Cannot copy ${DISPHOST}:${REMKITCAP}"    return 1    }cat <<- '-EOFsedfile' > /usr/tmp/tmpkitcap.sed$$    0s** save the kitcap version line *    /@(#)/b    /^#/d;			0s**	delete comment lines *    /^[ 	]*$/d;		0s**	delete blank lines *    /:#/s/:#[^:]*//g;		0s**	delete in-line comments *    0s**---------------------------------------------------- *    0s** Combine all lines ending with backslash             *    0s** When there are no more backslashes, jump to comprss *    0s**---------------------------------------------------- *    :combine    /\\$/!bcomprss    s/\\$//;			0s**	remove continuation character *    N;				0s**	Append next line w/newline *    s/[ 	]*\n[ 	]*//;	0s**	remove newline & assoc whitespace *    bcombine    0s**----------------------------------------------- *    0s** Remove duplicates that arise out of prettyness *    0s**----------------------------------------------- *    :comprss    s/[ 	]*:[ 	]/:/g;	0s**	remove spaces around colons *    s/:::*/:/g;			0s**	change 2 or more colons into 1 colon *    s/[ 	]*|[ 	]/|/g;	0s**	remove spaces around vertical bars *    0s**	kitcap now consists of single lines *    /:#/s/:#[^:]*//g;		0s**	delete in-line comments *    s/:$//;			0s**	strip trailing colon *-EOFsedfileecho "    /${KITROOT_TOKEN}/s==${KIT_ROOT}=g" >> /usr/tmp/tmpkitcap.sed$$sed -f /usr/tmp/tmpkitcap.sed$$ /usr/tmp/tmpkitcap$$ > ${LCLKITCAP} ||	{	echo 1>&2 "\07$FUNC: Internal error: cannot filter local kitcap file."	return 1	}rm /usr/tmp/tmpkitcap$$ /usr/tmp/tmpkitcap.sed$$)}_K_Unpack_Instctrls(){(    NUMARGS=5 FUNC=_K_Unpack_Instctrls    test $UTIL_DEBUG && echo 1>&2 "DEBUG: $FUNC($*)"    case "$#" in	${NUMARGS})	# right number of args, set values	    HOST="$1"	    KITCODE="$2"	    KITCAP="$3"	    DEVTYPE="$4"	    PRODLIST="$5"	    ;;	*)		# wrong number of args, error	    echo 1>&2 "$FUNC($# args): Needs ${NUMARGS} arguments"	    exit 1	    ;;    esac    DIRELIST=    echo 1>&2 "\nCreating component list for $KITCODE\c"    set $PRODLIST    case $# in	1)  ;;	*)	    echo 1>&2 " by merging entries for $PRODLIST\c"	    ;;    esac    echo 1>&2 ".\n"    for PROD in $PRODLIST    do	KITDESC=`grep "^${PROD}${DEVTYPE}[:|]" $KITCAP` ||	    {	    if [ "$DEVTYPE" = "MT" ]	    then		KITDESC=`grep "^${PROD}TK[:|]" $KITCAP ` ||		    {		    echo 1>&2 "\07$FUNC: neither MT nor TK versions of $PROD" \			      "exists in kitcap."		    exit 1		    }	    else		echo 1>&2 "\07$FUNC: Product $PROD does not exist in $KITCAP"		exit 1	    fi	    }	OFS="$IFS"	IFS=:	set $KITDESC	IFS="$OFS"	for K in $*	do	    case $K in	    /* | ./* )	# only process kit data directories.		status=`_U_Dir_Exists $HOST "$K"`		case $status in		    false)			 echo 1>&2 "$FUNC:" \			      "\07Kitcap error: Directory $K does not exist."			exit 1			;;		    true)			;;		    *)	# Error message			echo 1>&2 "$FUNC: $status"			exit 1			;;		esac		DIRELIST="$DIRELIST $K"		;;	    esac	done    done    echo 1>&2 "Copying $PRODLIST control files into working directory \n"    for DIR in $DIRELIST    do	(cd $WORKDIR; _U_Remote_Tar_xpf $HOST $DIR/INSTCTRL) ||	    {	    DISPHOST=`echo $HOST | sed 's=\(.*/.*\)/.*=\1/password:='`	    echo 1>&2 "$FUNC: IRREGULARITY: Unable to unpack" \	    		"$DISPHOST:$DIR/$INSTCTRL"	    eval `_U_Prompt "Do you wish to continue anyway?" \			RESP "y yes n no" "no" "		You should only choose to continue if you desire a		potentially irregular kit.		If you are not sure what to do, then report this to		your supervisor immediately as a kit buiding problem."`	    case $RESP in		n*)		    echo 1>&2 "Kit build halted due to irregularity."		    exit 1		    ;;		y*)		    echo 1>&2 "Kit build continuing.  Expect problems."		    ;;	    esac	    }    done    echo DIRELIST='"'$DIRELIST'"')}_K_Image_Merge(){(    NUMARGS=2 FUNC=_K_Image_Merge    test $UTIL_DEBUG && echo 1>&2 "DEBUG: $FUNC($*)"    case "$#" in	${NUMARGS})	# right number of args, set values	    NEWIMAGENAME="$1"	    SUBSETLIST="$2"	    ;;	*)		# wrong number of args, error	    echo 1>&2 "$FUNC($# args): Needs ${NUMARGS} arguments"	    exit 1	    ;;    esac    echo 1>&2 "Creating new merged image file.\n"    rm -f $MERGEDIR/INSTCTRL $MERGEDIR/*.image $MERGEDIR/*.comp    for K in $SUBSETLIST    do	case $K in	    %%*)	# volume changes, skip these	        continue		;;	    *"|"*)	# blocking information, remove.		OFS="$IFS"		IFS="|"		set $K		IFS="$OFS"		case $# in		    1) ;;		    *) K=$1 ;;		esac		;;	esac	if [ "$K" != "ROOT" ]	then		    test -f ${WORKDIR}/${K}.ctrl || continue	    OLDIMAGE=`expr $K : '\([A-Z0-9][A-Z0-9][A-Z0-9]\)'`	    VERSCODE=`expr $K : '.*\([0-9][0-9][0-9]\)'`	    test -f $MERGEDIR/$OLDIMAGE$VERSCODE.comp ||		touch $MERGEDIR/$OLDIMAGE$VERSCODE.comp	fi	test -f $MERGEDIR/$NEWIMAGE.image ||	    touch $MERGEDIR/$NEWIMAGE.image	FOUND=0	for IMAGEFILE in $WORKDIR/*.image	do	    SUBSETINFO=`grep $K $IMAGEFILE` && FOUND=1	    if [ "$SUBSETINFO" ]	    then		DUPINFO=`grep "$K" $MERGEDIR/$NEWIMAGE.image`		if [ "$DUPINFO" != "$SUBSETINFO" ]		then		    if [ "$DUPINFO"]		    then			echo 1>&2 "?$FUNC: Fatal error. Cannot merge" \				  "image files."			echo 1>&2 " Multiple, different entries exist for $K."			return 1		    else			echo "$SUBSETINFO" >> $MERGEDIR/$NEWIMAGE.image		    fi		fi	    fi	done	if [ $FOUND -eq 0 ]	then	     echo 1>&2 "$FUNC: Cannot find image file entry for $K in any of"	     echo 1>&2 " the following image files: " $WORKDIR/*.image	     return 1	fi    done)}	_K_Product_Merge(){(    NUMARGS=3 FUNC=_K_Product_Merge    test $UTIL_DEBUG && echo 1>&2 "DEBUG: $FUNC($*)"    case "$#" in	${NUMARGS})	# right number of args, set values	    IMAGENAME="$1"	    KITNAME="$2"	    SUBSETLIST="$3"	    ;;	*)		# wrong number of args, error	    echo 1>&2 "$FUNC($# args): Needs ${NUMARGS} arguments"	    exit 1	    ;;    esac    SIGN="-"		# 1st LOCNUM-1 files are negative    TAPEVOL=1    LOCNUM=4    TAPELOC=     echo 1>&2 "Merging subset control files.\n"    (cd $MERGEDIR && tar c${TARVERIFY}pf INSTCTRL $IMAGENAME.image) || return 1    for K in $MERGEDIR/*.comp    do	{	K=`basename $K`	if [ -f $WORKDIR/$K ]	then	    (cd $WORKDIR &&	        tar r${TARVERIFY}pf $MERGEDIR/INSTCTRL $K) || return 1	else	    echo 1>&2 "$FUNC: WARNING: Cannot find $WORKDIR/$K to add to $MERGEDIR/INSTCTRL"	fi	}    done    for K in $SUBSETLIST    do	if [ "$SIGN" = "-" ]	then	    LOCNUM=`expr $LOCNUM - 1`	    if [ "$LOCNUM" = "0" ]	    then		SIGN=		TAPELOC="$TAPEVOL:$LOCNUM"	    else		TAPELOC="$TAPEVOL:$SIGN$LOCNUM"	    fi	else	    LOCNUM=`expr $LOCNUM + 1`	    TAPELOC="$TAPEVOL:$LOCNUM"	fi		case $K in	    %%*)		# new volume, reset position values		TAPEVOL=`expr $K : '%%\(.*\)'`		SIGN=-		LOCNUM=4		continue		;;	    *)			# check for existence of ctrl file		OFS="$IFS"		IFS="|"		set $K		IFS="$OFS"		case $# in		    1) ;;		    *) K=$1 ;;		esac		test -f ${WORKDIR}/${K}.ctrl ||		    {		    case $K in			SPACE | INSTCTRL | ROOT | *TK50*)			    ;;			* )	# other missing files are irregularities.			    echo 1>&2 "$FUNC: IRREGULARITY: No control file" \			    	      "for $K."			    eval `_U_Prompt "Do you wish to continue anyway?" \			    		RESP "y yes n no" "no" "			You should only choose to continue if you desire an			irregular kit.			If you are not sure what to do, then report this to			your supervisor immediately as a kit buiding			problem."`			    case $RESP in				n*)				    echo 1>&2 "Kit build halted due to" \				    	      "irregularity"				    exit 1				    ;;				y*)				    echo 1>&2 "Kit build continuing.  Expect" \				    	 "to see warnings about missing" \					 "checksum entries."				    ;;			    esac			    ;;		    esac		    continue		    }		;;	esac	if [ "$KITNAME" ]	then	    sed	-e "/^NAME=/s.*NAME='$KITNAME $K'" \		    -e "/^MTLOC=/s.*MTLOC=$TAPELOC" \			    ${WORKDIR}/$K.ctrl > ${LCL_DIR}/ctrl.$$	else	    sed	-e "/^MTLOC=/s.*MTLOC=$TAPELOC" \			    ${WORKDIR}/$K.ctrl > ${LCL_DIR}/ctrl.$$	fi && 	    {	    if test "$UTIL_DEBUG"	    then		echo "\noriginal file:" | cat - ${WORKDIR}/$K.ctrl		echo "\nnew file:" | cat - ${LCL_DIR}/ctrl.$$	    fi	    mv ${LCL_DIR}/ctrl.$$ ${WORKDIR}/$K.ctrl	    }	(cd $WORKDIR; tar r${TARVERIFY}pf $MERGEDIR/INSTCTRL $K.*)    done    echo 1>&2 "\nMerge process for $KITCODE complete. \n\n")} _Utility_included="yes"	dls(){(FUNC=dlstest $UTIL_DEBUG && echo 1>&2 "DEBUG: $FUNC($*)"TIMEOUT_MSG="Connect failed, no response from object"ERR=/usr/tmp/dlserr$$OUT=/usr/tmp/dlsout$$MAXCOUNT=5COUNT=0while : truedo    /usr/bin/dls $* 2> $ERR > $OUT    STATUS=$?    if [ $UTIL_DEBUG ]    then	echo "DEBUG: Status: $STATUS; Retry is: $COUNT of $MAXCOUNT" > /dev/tty	echo "DEBUG: ERR=`cat $ERR`" > /dev/tty	echo "DEBUG: OUT=`cat $OUT`" > /dev/tty    fi    if [ $STATUS -eq 0 ]    then	break    fi    if grep -s "$TIMEOUT_MSG" $ERR    then	COUNT=`expr $COUNT + 1`	SLEEPTIME=`expr  $COUNT \* 5`	sleep $SLEEPTIME	if [ $COUNT -ge $MAXCOUNT ]	then	    break	fi    else	break    fidonecat $OUTcat 1>&2 $ERRrm -f $ERR $OUTreturn $STATUS)}_U_Get_Hostname(){(FUNC=_U_Get_Hostname NUMARGS=1test $UTIL_DEBUG && echo 1>&2 "DEBUG: $FUNC($*)"case "$#" in    ${NUMARGS})	# right number of args, continue	ARG="$1"	;;    *)		# wrong number of args, error	echo 1>&2 "$FUNC($# args): Needs ${NUMARGS} argument"	return 1	;;esacHOST="local"	#default HOST is "local"DNET_SUFFIX=""case "$ARG" in    *::*)	DNET_SUFFIX=":"	;;esacOFS="$IFS"IFS=:set -- xxx $ARGshiftIFS="$OFS"case "$#" in    2)	HOST=$1$DNET_SUFFIX	shift	;;    3)	# better be a DECnet node with a gateway	if [ "$DNET_SUFFIX" ]	then	    HOST=$1::$2$DNET_SUFFIX	    shift	    shift	else	    echo 1>&2 "?Only DECnet node names can contain a gateway-- $ARG"	    return 1	fi	;;esac

⌨️ 快捷键说明

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