makedat.in
上传用户:s81996212
上传日期:2007-01-04
资源大小:722k
文件大小:1k
- #! @SHELL@
- #
- # $Id: makedat.in,v 1.2 1999/10/11 01:22:13 mrsam Exp $
- #
- # Generic wrapper for makedat.
- #
- # Usage: makedat.sh -src=src -file=file -tmp=tmpfile -hup=hupfile
- #
- # Create [file] from [src]. [src] can be either a plain text file, or a
- # directory. [tmpfile] is used. if [hupfile] is specified and it exists,
- # this file contains a PID, which is SIGHUPed.
- prefix="@prefix@";
- exec_prefix="@exec_prefix@";
- srcfile=""
- dstfile=""
- tmpfile=""
- hupfile=""
- usage() {
- echo "Usage: $0 -src=src -file=file -tmp=tmpfile -hup=hupfile" >&2
- exit 1
- }
- while test $# -gt 0
- do
- case $1 in
- -src=*)
- srcfile=`echo "$1" | sed 's/-src=//'`;
- shift
- ;;
- -tmp=*)
- tmpfile=`echo "$1" | sed 's/-tmp=//'`;
- shift
- ;;
- -file=*)
- dstfile=`echo "$1" | sed 's/-file=//'`;
- shift
- ;;
- -hup=*)
- hupfile=`echo "$1" | sed 's/-hup=//'`;
- shift
- ;;
- *)
- usage
- ;;
- esac
- done
- if test "$dstfile" = ""
- then
- usage
- fi
- if test "$srcfile" = ""
- then
- usage
- fi
- if test "$tmpfile" = ""
- then
- usage
- fi
- get_access() {
- if test -d "$srcfile"
- then
- for f in "$srcfile"/*
- do
- cat "$f" || return
- done
- else
- cat "$srcfile" || return
- fi
- echo "."
- }
- get_access | @makedatprogpath@ - "$tmpfile" "$dstfile" || exit 1
- if test "$hupfile" != ""
- then
- if test -f $hupfile
- then
- kill -HUP `cat "$hupfile"`
- fi
- fi