2006-07-18 17:10:18 +00:00
|
|
|
#!/bin/sh
|
1987-01-06 15:16:53 +00:00
|
|
|
: Update Files from database
|
|
|
|
|
|
|
|
PATH=/bin:/usr/bin
|
|
|
|
|
|
|
|
case $# in
|
|
|
|
1) ;;
|
|
|
|
*) echo use: $0 file >&2
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
(
|
1993-08-05 13:00:40 +00:00
|
|
|
IFCOMMAND="if [ -r \$FN ] ;\
|
1987-01-06 15:16:53 +00:00
|
|
|
then if cmp -s \$FN \$TMP;\
|
|
|
|
then rm \$TMP;\
|
|
|
|
else mv \$TMP \$FN;\
|
|
|
|
echo update \$FN;\
|
|
|
|
fi;\
|
|
|
|
else mv \$TMP \$FN;\
|
|
|
|
echo create \$FN;\
|
|
|
|
fi"
|
|
|
|
echo 'TMP=.uf$$'
|
|
|
|
echo 'FN=$TMP'
|
|
|
|
echo 'cat >$TMP <<\!EOF!'
|
|
|
|
sed -n '/^!File:/,${
|
|
|
|
/^$/d
|
|
|
|
/^!File:[ ]*\(.*\)$/s@@!EOF!\
|
|
|
|
'"$IFCOMMAND"'\
|
|
|
|
FN=\1\
|
|
|
|
cat >$TMP <<\\!EOF!@
|
|
|
|
p
|
|
|
|
}' $1
|
|
|
|
echo '!EOF!'
|
|
|
|
echo $IFCOMMAND
|
|
|
|
) |
|
|
|
|
sh
|