1 1.1 jwise #!/bin/sh 2 1.1 jwise # 3 1.1 jwise # Print out the files in some or all lists. 4 1.4 dyoung # Usage: makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname 5 1.1 jwise # 6 1.1 jwise 7 1.15 erh rundir=${0%/*} 8 1.15 erh . ${rundir}/sets.subr 9 1.1 jwise prefix=/ 10 1.1 jwise 11 1.12 lukem usage() 12 1.12 lukem { 13 1.12 lukem cat 1>&2 <<USAGE 14 1.12 lukem Usage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname 15 1.13 lukem -a arch set arch (e.g, m68k, mips, powerpc) [$MACHINE_ARCH] 16 1.13 lukem -m machine set machine (e.g, amiga, i386, macppc) [$MACHINE] 17 1.12 lukem -s setsdir directory to find sets [$setsdir] 18 1.12 lukem -p prefix prefix for created plist [$prefix] 19 1.12 lukem setname pkgname set and package to build plist for 20 1.12 lukem USAGE 21 1.12 lukem exit 1 22 1.1 jwise } 23 1.1 jwise 24 1.1 jwise # handle args 25 1.14 dyoung while getopts a:m:p:s: ch; do 26 1.12 lukem case ${ch} in 27 1.12 lukem a) 28 1.13 lukem MACHINE_ARCH=${OPTARG} 29 1.13 lukem MACHINE_CPU=$(arch_to_cpu ${OPTARG}) 30 1.1 jwise ;; 31 1.12 lukem m) 32 1.13 lukem MACHINE=${OPTARG} 33 1.1 jwise ;; 34 1.12 lukem p) 35 1.12 lukem prefix=${OPTARG} 36 1.1 jwise ;; 37 1.12 lukem s) 38 1.12 lukem setsdir=${OPTARG} 39 1.1 jwise ;; 40 1.12 lukem *) 41 1.1 jwise usage 42 1.1 jwise ;; 43 1.1 jwise esac 44 1.1 jwise done 45 1.12 lukem shift $((${OPTIND} - 1)) 46 1.12 lukem if [ $# -ne 2 ]; then 47 1.1 jwise usage 48 1.1 jwise fi 49 1.12 lukem setname="$1" 50 1.12 lukem pkgname=$2 51 1.7 agc 52 1.7 agc filename=/tmp/makeplist.$$ 53 1.7 agc ffilename=/tmp/makeplist.files.$$ 54 1.7 agc dfilename=/tmp/makeplist.dirs.$$ 55 1.7 agc 56 1.8 dyoung list_set_files $setname | \ 57 1.12 lukem env PLISTPKG=$pkgname awk ' 58 1.12 lukem $2 == ENVIRON["PLISTPKG"] { 59 1.12 lukem sub("^\\./", "", $1); 60 1.12 lukem print $1 61 1.12 lukem }' | sort -u > $filename 62 1.8 dyoung 63 1.8 dyoung SELECTDIRS="-maxdepth 0 -type d" 64 1.8 dyoung SELECTNONDIRS="-maxdepth 0 ! -type d" 65 1.8 dyoung 66 1.8 dyoung cd $prefix 67 1.8 dyoung # 68 1.8 dyoung # match the directories 69 1.8 dyoung # 70 1.8 dyoung xargs echo $SELECTDIRS < $filename | \ 71 1.8 dyoung while read ignore ignore ignore ignore args; do 72 1.8 dyoung [ -z "$args" ] && break 73 1.8 dyoung find $args $SELECTDIRS 74 1.8 dyoung done | awk '{ print "@dirrm " $1; }' > $dfilename 75 1.8 dyoung 76 1.8 dyoung # 77 1.8 dyoung # match the non-directories 78 1.8 dyoung # 79 1.8 dyoung xargs echo $SELECTNONDIRS < $filename | \ 80 1.8 dyoung while read ignore ignore ignore ignore ignore args; do 81 1.8 dyoung [ -z "$args" ] && break 82 1.8 dyoung find $args $SELECTNONDIRS 83 1.8 dyoung done > $ffilename 84 1.8 dyoung 85 1.8 dyoung cd - 86 1.7 agc 87 1.7 agc echo "@cwd $prefix" 88 1.7 agc if [ -s $ffilename ]; then 89 1.7 agc cat $ffilename 90 1.1 jwise fi 91 1.7 agc if [ -s $dfilename ]; then 92 1.7 agc sort -r $dfilename 93 1.7 agc fi 94 1.7 agc 95 1.7 agc rm -f $filename $ffilename $dfilename 96 1.7 agc 97 1.7 agc exit 0 98