#!/bin/sh # # Print out the files in some or all lists. # Usage: makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname # rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/" . "${rundir}/sets.subr" prefix=/ usage() { cat 1>&2 < "${filename}" SELECTDIRS="-prune -type d" SELECTNONDIRS="! -type d -print -o ( -type d -prune )" cd "${prefix}" # # Match the directories. Use find(1) to avoid repeat calls to # 'test -d'. # # This is a little clever. I cannot use 'xargs find', because # find wants for the option arguments to follow the path arguments. # So I use 'xargs echo ${SELECTDIRS}' to make a maximum-length proto-command # line. I use 'read' to peel the options off the front of the # command-line, and 'find ${args} ${SELECTDIRS}' to put them at the end. # xargs echo ${SELECTDIRS} < "${filename}" | \ while read ignore ignore ignore args; do [ -z "${args}" ] && break ${FIND} ${args} ${SELECTDIRS} done | ${AWK} '{ print "@dirrm " $1; }' > "${dfilename}" # # Match the non-directories. Use find(1) to avoid repeat calls to # 'test ! -d'. See 'Match the directories' for an explanation of the # cleverness. # xargs echo ${SELECTNONDIRS} < "${filename}" | \ while read ignore ignore ignore ignore ignore 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