#!/bin/sh # # Copies a specified package over to the CD-ROM and sets up links accordingly. PACKAGE_DIR=/a/asami/portbuild/4/packages REMOTE_MACHINE=widget.osd.bsdi.com REMOTE_DIR=/usr/disc1/packages DEST_DIR=${REMOTE_MACHINE}:${REMOTE_DIR} # copies a single package over, the package should be $1 # copy_package() { pkg_file=$1.tgz if [ -r ${PACKAGE_DIR}/All/${pkg_file} ]; then echo "Copying package $1..." # copy the package over scp ${PACKAGE_DIR}/All/${pkg_file} ${DEST_DIR}/All/. # build a shell script to make the directories # build a shell script to generate the softlinks (cd $PACKAGE_DIR ; find . -name $pkg_file) | \ sed -e '/^\.\/All/d' -e 's:^\./\(.*\)/\([^/]*\)$:\1 \2:' |\ awk "BEGIN { printf \"cd ${REMOTE_DIR}; set -x\n\" } \ { printf \"mkdir -p %s; ln -sf ../All/${pkg_file} %s/%s\n\", $ 1, $ 1, $ 2 }" |\ ssh $REMOTE_MACHINE sh else echo "Could not find package $1!" fi } # usage info # usage() { echo "$0 [package [...]]" echo echo "Each package is copied over to the build machine and the" echo "appropriate symlinks are created." exit 1 } # copy each package for pkg; do copy_package $pkg # XXX - openssh's server sucks sleep 1 done