📄 tape_build.sh
字号:
#! /bin/sh## %Z%%M% %I% %E% SMI## tape_build# Generating pre-installed release tape from dd images# This script assumes:# 1) 2 tapes will be created. One for the disk-building scripts# and one for the disk images.# 2) The place where the above files are kept is a dir called /golden.### Constants GOLDEN=/golden COPYRIGHT=/tmp/Copyright thisdir=$PWD cleanup='echo "Exiting";'# Variables arch= release= disk= tape=rmt8# Programif [ $# -ne 0 ]; then if [ $1 = "-t" ]; then tape=$2 fifi# Note we use r??8 for the higher tape densitiescase $tape in rst8) ;; rmt8) ;; rst0) ;; *) echo "$tape not valid tapedrive name."; exit 1;;esac# Determine which architecture is to be loaded to tapewhile truedo echo -n "Architecture to load to tape (sun4c, sun3x): " read arch case "$arch" in sun4m|sun4c|sun3x) break;; *) echo "$arch is not a valid entry";; esacdone# Determine which release is to be loaded to tapeecho -n "Release name (e.g. 4.1, pie): "read release[ -d $GOLDEN/$release/$arch ] || { echo "$GOLDEN/$release/$arch does not exist" exit}# Determine which disk drive model is to be loaded to tape (100/200mb)while truedo echo " [ 1 ] 100mb Quantum ProDrive 105S" echo " [ 2 ] 200mb SUN0207" echo " [ 3 ] 424mb SUN0424" echo -n "Select Drive Model enter [ 1, 2, or 3 ]: " read ans case "$ans" in 1) size=100;disk=Quantum_ProDrive_105S;break;; 2) size=200;disk=SUN0207;break;; 3) size=424;disk=SUN0424;break;; *) echo;; esacdone[ -d $GOLDEN/$release/$arch/$disk ] || { echo "$GOLDEN/$release/$arch/$disk is not a directory" eval "$cleanup" exit 1 }# Check for existence of copyright filesif [ ! -s Copyright_${arch}_${size} ]; then echo "Copyright file not present." eval "$cleanup" exit 1fi# Create disk image tapeecho "Insert tape #1 and hit <return>"read ret# Remove the copyright file from /tmp if it exists cd $thisdir[ -f $COPYRIGHT ] && rm -f $COPYRIGHTcp Copyright_${arch}_${size} $COPYRIGHT# Use dd to load the copyright to tape (1st file)echo "Loading Copyright header Copyright_${arch}_${size}"mt -f /dev/$tape rewinddd if=$COPYRIGHT of=/dev/n$tape conv=sync [ $? -ne 0 ] && echo "Unable to write to tape." && eval "$cleanup" && exit 1# Use tar to append the following to tapeecho "Loading the images"cd $GOLDENtar cvpf /dev/n$tape $release/$arch/$disk # Use dd again this time to append the copyright to the end of the tapeecho "Loading Copyright trailer Copyright_${arch}_${size}"dd if=$COPYRIGHT of=/dev/n$tape conv=sync mt -f /dev/$tape rewind# Ask if the person wants to build a tools tapewhile truedo echo -n "Build tools tapes [y/n]: " read ans case "$ans" in y) break;; n) echo "Pre-install tapes created on `date`"; eval "$cleanup" && exit 0;; *) ;; esacdone# Create tools tapeecho "Insert tape #2 and hit <return>"read ret# Remove the copyright file from /tmp if it exists cd $thisdir[ -f $COPYRIGHT ] && rm -f $COPYRIGHTcp Copyright_scripts $COPYRIGHT# Use dd to load the copyright to tape (1st file)echo "Loading Copyright header Copyright_scripts"mt -f /dev/$tape rewinddd if=$COPYRIGHT of=/dev/n$tape conv=sync [ $? -ne 0 ] && echo "Unable to write to tape." && eval "$cleanup" && exit 1# Use tar to append the following to tapeecho "Loading the tools"cd $GOLDENtar cvpf /dev/n$tape tools# Use dd again this time to append the copyright to the end of the tapeecho "Loading Copyright trailer Copyright_scripts"dd if=$COPYRIGHT of=/dev/n$tape conv=sync mt -f /dev/$tape rewindecho "Pre-install tapes created on `date`"eval "$cleanup" && exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -