makeplist revision 1.13
11.1Sjwise#!/bin/sh 21.1Sjwise# 31.1Sjwise# Print out the files in some or all lists. 41.4Sdyoung# Usage: makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname 51.1Sjwise# 61.1Sjwise 71.8Sdyoung. ./sets.subr 81.1Sjwiseprefix=/ 91.1Sjwise 101.12Slukemusage() 111.12Slukem{ 121.12Slukem cat 1>&2 <<USAGE 131.12SlukemUsage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname 141.13Slukem -a arch set arch (e.g, m68k, mips, powerpc) [$MACHINE_ARCH] 151.13Slukem -m machine set machine (e.g, amiga, i386, macppc) [$MACHINE] 161.12Slukem -s setsdir directory to find sets [$setsdir] 171.12Slukem -p prefix prefix for created plist [$prefix] 181.12Slukem setname pkgname set and package to build plist for 191.12SlukemUSAGE 201.12Slukem exit 1 211.1Sjwise} 221.1Sjwise 231.1Sjwise# handle args 241.12Slukemwhile getopts a:m:ps: ch; do 251.12Slukem case ${ch} in 261.12Slukem a) 271.13Slukem MACHINE_ARCH=${OPTARG} 281.13Slukem MACHINE_CPU=$(arch_to_cpu ${OPTARG}) 291.1Sjwise ;; 301.12Slukem m) 311.13Slukem MACHINE=${OPTARG} 321.1Sjwise ;; 331.12Slukem p) 341.12Slukem prefix=${OPTARG} 351.1Sjwise ;; 361.12Slukem s) 371.12Slukem setsdir=${OPTARG} 381.1Sjwise ;; 391.12Slukem *) 401.1Sjwise usage 411.1Sjwise ;; 421.1Sjwise esac 431.1Sjwisedone 441.12Slukemshift $((${OPTIND} - 1)) 451.12Slukemif [ $# -ne 2 ]; then 461.1Sjwise usage 471.1Sjwisefi 481.12Slukemsetname="$1" 491.12Slukempkgname=$2 501.7Sagc 511.7Sagcfilename=/tmp/makeplist.$$ 521.7Sagcffilename=/tmp/makeplist.files.$$ 531.7Sagcdfilename=/tmp/makeplist.dirs.$$ 541.7Sagc 551.8Sdyounglist_set_files $setname | \ 561.12Slukem env PLISTPKG=$pkgname awk ' 571.12Slukem $2 == ENVIRON["PLISTPKG"] { 581.12Slukem sub("^\\./", "", $1); 591.12Slukem print $1 601.12Slukem }' | sort -u > $filename 611.8Sdyoung 621.8SdyoungSELECTDIRS="-maxdepth 0 -type d" 631.8SdyoungSELECTNONDIRS="-maxdepth 0 ! -type d" 641.8Sdyoung 651.8Sdyoungcd $prefix 661.8Sdyoung# 671.8Sdyoung# match the directories 681.8Sdyoung# 691.8Sdyoungxargs echo $SELECTDIRS < $filename | \ 701.8Sdyoungwhile read ignore ignore ignore ignore args; do 711.8Sdyoung [ -z "$args" ] && break 721.8Sdyoung find $args $SELECTDIRS 731.8Sdyoungdone | awk '{ print "@dirrm " $1; }' > $dfilename 741.8Sdyoung 751.8Sdyoung# 761.8Sdyoung# match the non-directories 771.8Sdyoung# 781.8Sdyoungxargs echo $SELECTNONDIRS < $filename | \ 791.8Sdyoungwhile read ignore ignore ignore ignore ignore args; do 801.8Sdyoung [ -z "$args" ] && break 811.8Sdyoung find $args $SELECTNONDIRS 821.8Sdyoungdone > $ffilename 831.8Sdyoung 841.8Sdyoungcd - 851.7Sagc 861.7Sagcecho "@cwd $prefix" 871.7Sagcif [ -s $ffilename ]; then 881.7Sagc cat $ffilename 891.1Sjwisefi 901.7Sagcif [ -s $dfilename ]; then 911.7Sagc sort -r $dfilename 921.7Sagcfi 931.7Sagc 941.7Sagcrm -f $filename $ffilename $dfilename 951.7Sagc 961.7Sagcexit 0 97