3 # mkclone - symlink every file appearing in $src/MANIFEST to a corresponding
4 # file in the target directory ($1). Directories specified in
5 # MANIFEST are created in the target directory
11 USAGE="usage: $prog [-m manifest] [-s srcdir] [-v] [-d] [-h] target"
12 while getopts dhm:s:v opt
15 m) MANIFEST=$OPTARG ;;
18 d) ECHO=echo debug=y ;;
25 : ${MANIFEST:=${SRCDIR}/MANIFEST}
27 [ -n "$debug" ] && verbose=
29 shift $(( $OPTIND - 1 ))
36 if [ ! -f $MANIFEST ]; then
37 echo "$prog: $MANIFEST: no such file or directory" >&2
38 echo "$prog: must be run with valid -s argument or from source directory" >&2
43 LINKTEMP=`mktemp -t linktmp.XXXXXXXX 2>/dev/null`
44 if [ -z "$LINKTEMP" ]; then
46 LINKTEMP=${TMPDIR}/linktmp.$$
50 $rm_ltmp && rm -f ${LINKTEMP}
51 # if the user specified hard links, then do that. otherwise, try to use
52 # symlinks if they're present
53 if [ -n "$hardlinks" ]; then
55 elif (ln -s /dev/null ${LINKTEMP}) >/dev/null 2>&1; then
64 if [ ! -d "$TARGET" ]; then
68 echo "${prog}: creating clone of bash source tree (from $SRCDIR) in $TARGET"
70 cd "$TARGET" || { echo "${prog}: cannot cd to $TARGET" >&2 ; exit 1; }
72 while read fname type mode
74 [ -z "$fname" ] && continue
81 d) [ -n "$verbose" ] && echo mkdir $fname
82 $ECHO mkdir $fname ;; # already in $TARGET
85 */*) dn=${fname%/*} ;;
88 if [ -n "$verbose" ] || [ -n "$debug" ]; then
89 echo "( cd $dn && $LN $SRCDIR/$fname $fn )"
91 [ -z "$debug" ] && ( cd $dn && $LN $SRCDIR/$fname $fn )
93 *) echo "${prog}: ${fname}: unknown file type $type" 1>&2 ;;
98 SPECIAL="parser-built y.tab.c y.tab.h"
103 [ -n "$verbose" ] && echo cp -p $SRCDIR/$sf $TARGET
104 $ECHO cp -p $SRCDIR/$sf $TARGET