6f9a1982b5
them to the environment.
97 lines
1.8 KiB
Bash
Executable File
97 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Print out the files in some or all lists.
|
|
# Usage: makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
|
|
#
|
|
|
|
. ./sets.subr
|
|
prefix=/
|
|
|
|
usage()
|
|
{
|
|
cat 1>&2 <<USAGE
|
|
Usage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
|
|
-a arch set arch (e.g, m68k, mips, powerpc) [$MACHINE_ARCH]
|
|
-m machine set machine (e.g, amiga, i386, macppc) [$MACHINE]
|
|
-s setsdir directory to find sets [$setsdir]
|
|
-p prefix prefix for created plist [$prefix]
|
|
setname pkgname set and package to build plist for
|
|
USAGE
|
|
exit 1
|
|
}
|
|
|
|
# handle args
|
|
while getopts a:m:ps: ch; do
|
|
case ${ch} in
|
|
a)
|
|
MACHINE_ARCH=${OPTARG}
|
|
MACHINE_CPU=$(arch_to_cpu ${OPTARG})
|
|
;;
|
|
m)
|
|
MACHINE=${OPTARG}
|
|
;;
|
|
p)
|
|
prefix=${OPTARG}
|
|
;;
|
|
s)
|
|
setsdir=${OPTARG}
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
shift $((${OPTIND} - 1))
|
|
if [ $# -ne 2 ]; then
|
|
usage
|
|
fi
|
|
setname="$1"
|
|
pkgname=$2
|
|
|
|
filename=/tmp/makeplist.$$
|
|
ffilename=/tmp/makeplist.files.$$
|
|
dfilename=/tmp/makeplist.dirs.$$
|
|
|
|
list_set_files $setname | \
|
|
env PLISTPKG=$pkgname awk '
|
|
$2 == ENVIRON["PLISTPKG"] {
|
|
sub("^\\./", "", $1);
|
|
print $1
|
|
}' | sort -u > $filename
|
|
|
|
SELECTDIRS="-maxdepth 0 -type d"
|
|
SELECTNONDIRS="-maxdepth 0 ! -type d"
|
|
|
|
cd $prefix
|
|
#
|
|
# match the directories
|
|
#
|
|
xargs echo $SELECTDIRS < $filename | \
|
|
while read ignore ignore ignore ignore args; do
|
|
[ -z "$args" ] && break
|
|
find $args $SELECTDIRS
|
|
done | awk '{ print "@dirrm " $1; }' > $dfilename
|
|
|
|
#
|
|
# match the non-directories
|
|
#
|
|
xargs echo $SELECTNONDIRS < $filename | \
|
|
while read ignore ignore ignore ignore ignore args; do
|
|
[ -z "$args" ] && break
|
|
find $args $SELECTNONDIRS
|
|
done > $ffilename
|
|
|
|
cd -
|
|
|
|
echo "@cwd $prefix"
|
|
if [ -s $ffilename ]; then
|
|
cat $ffilename
|
|
fi
|
|
if [ -s $dfilename ]; then
|
|
sort -r $dfilename
|
|
fi
|
|
|
|
rm -f $filename $ffilename $dfilename
|
|
|
|
exit 0
|