Mercurial > hgrepos > hgweb.cgi > s4
view s4-start.sh @ 84:e16cb89bb0f2
Write ADMIN to s4-config.sh
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 03 Aug 2015 12:51:06 +0900 |
parents | db489961e461 |
children | 465447d8b3ab |
line wrap: on
line source
#!/bin/sh # 愛 # Start s4 - Generate s4.cgi mydir=`dirname $0` myname=`basename $0` script_dir=${SCRIPT_DIR:-scripts} admin="" type="form1" ex=examples usage() { cat<<EOF $myname `sed -n 3p $0` Usage: $myname [Options] Options are as follows: -h Show this help -a ADM Set ADMIN email address to ADM -f Force overwriting -t TYPE Force overwriting (defaults to $type) TYPEs are one of directory names in examples except \`common'. EOF exit 0 } while getopts afht: f; do case $f in a) admin=$OPTARG;; f) force=1;; t) type=$OPTARG;; \?|h) usage; exit 1;; esac done shift $(expr $OPTIND - 1) if [ ! -d $ex/$type ]; then cat<<EOF 1>&2 Invalid type($type). Types are one of as follows. `ls $ex|grep -v common | sed 's/^/ /'` EOF exit 1 fi if [ -z "$admin" ]; then cat<<EOF 1>&2 Administrator's email not specified. Please feed administrator email with \`-a' option. EOF exit 1 fi if ! cd $mydir; then echo "Script(s4-funcs.sh) not found in \`$mydir'." 1>&2 exit 1 fi . ./s4-funcs.sh || exit 2 if ! checkdomain $admin; then cat<<EOF 1>&2 Administrator's email - $admin - is invalid(host not found). Please specify existing email address. EOF exit 3 fi if [ -d templ/form ]; then if [ -z "$force" ]; then echo "templ/ directory already exists. Remove it, then try again." 1>&2 exit 4 fi rm -rf templ/* fi mkdir templ if (cd templ && ln -s ../examples/$type/* .); then if ./s4-init.sh; then cat<<EOF -------- The s4 System Successfully Installed -------- EOF echo "ADMIN=$admin" >> s4-config.sh && rc=0 else echo Calling s4-init.sh 'FAILED!!' fi else echo Failed fi 1>&2 exit ${rc:-5}