makespool
616 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh
if [ "$1" = "-r"]; then
shift
rm -rf $*
exit 0
fi
mkdirhier() {
dir=""
for d in `echo $1|sed 's,/, ,g'`
do
dir="$dir/$d"
test -d $dir || mkdir $dir
done
}
while [ $# -gt 0 ]
do
SRCDIR=${1:?}
DSTDIR=${2:?}
shift 2
if [ ! -d $SRCDIR ]; then
echo "$SRCDIR not a directory" >&2
exit 1
fi
if [ ! -r $SRCDIR/DISTFILES ]; then
echo "$SRCDIR/DISTFILES does not exist" >&2
exit 1
fi
mkdirhier $DSTDIR
chmod -R u+w $DSTDIR
cat $SRCDIR/DISTFILES |
while read NAME
do
test -f $DSTDIR/$NAME && rm $DSTDIR/$NAME
cp $SRCDIR/$NAME $DSTDIR/$NAME
chmod u+w $DSTDIR/$NAME
done
done