#!/bin/sh # # Create appropriate category directories and symlinks for the packages # listed in a specified INDEX file. usage() { echo "usage:" `basename $0` "" exit 1 } # Creates symlinks for a given package and list of categories handle_pkg() { for cat in $2; do mkdir -p ${cat} rm -f ${cat}/$1.tgz ln -s ../All/$1.tgz ${cat}/$1.tgz done } if [ $# -ne 1 ]; then usage fi # Open INDEX exec 3< $1 while true; do read line <&3 if [ -z "$line" ]; then exit fi pkg=`echo $line | cut -d\| -f 1` cats=`echo $line | cut -d\| -f 7` handle_pkg $pkg "$cats" done