#!/bin/sh # # Put up a new ISO on the jukebox server. # - Cameron Simpson 18sep2002 # src=/dev/cdrom dest=/u/cdroms/iso remote= cmd=`basename "$0"` usage="Usage: $cmd [-f file] [-d dir] vendor appname version-parts... -f file Source file. Default: $src -d dir Destination directory. Default: $dest -r remote Remote host to receive the iso." badopts= while : do case $1 in -r) remote=$2; shift ;; -f) src=$2; shift ;; -d) dest=$2; shift [ -d "$dest/." ] || { echo "$cmd: no such directory: $d" >&2 badopts=1 } ;; --) shift; break ;; -?*) echo "$cmd: unrecognised option: $1" >&2 badopts=1 ;; *) break ;; esac shift done if [ $# -lt 3 ] then echo "$cmd: missing vendor, appname or version-parts" >&2 badopts=1 fi [ $badopts ] && { echo "$usage" >&2; exit 2; } echo "Access group will be \""`echo "$*"|tr ' ' -`\" title=`readline 'CD title (vendor excluded)? '` || exit 1 [ -n "$title" ] || { echo "No title, upload aborted." >&2; exit 1; } shtitle=`shqstr "$title"` echo SKIPPING mkgroup "$@" || exit 1 vendor=$1 appname=$2; shift; shift; version=`echo "$*" | tr ' ' -` if [ -n "$remote" ] then remote="ssh $remote" else remote=eval fi umask 2 target=$dest/$vendor shtarget=`shqstr "$target"` [ -d "$target/." ] || (set -x; $remote "umask 2; [ -d $shtarget/. ] || mkdir $shtarget") || exit 1 iso=$target/$appname-$version.iso [ -s "$iso" ] && { echo "$cmd: already exists: $iso" >&2 exit 1 } shiso=`shqstr "$iso"` titlef=$target/$appname-$version.title shtitlef=`shqstr "$titlef"` prcat "$src" | $remote "umask 2; cat >$shiso || exit 1; echo $shtitle >$shtitlef; xit=\$?; cat $shtitlef; exit \$xit" xit=$? if [ "x$src" = x/dev/cdrom -o "x$src" = x/dev/dvd ]; then eject & fi ls -ld "$iso" exit $xit