Mercurial > hgrepos > hgweb.cgi > s4
changeset 82:db489961e461
Installer script - sr-start.sh - added
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 03 Aug 2015 12:15:28 +0900 |
parents | ddc8a4c0b8d9 |
children | 815840076efa |
files | s4-start.sh |
diffstat | 1 files changed, 89 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/s4-start.sh Mon Aug 03 12:15:28 2015 +0900 @@ -0,0 +1,89 @@ +#!/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 + rc=0 + else + echo Calling s4-init.sh 'FAILED!!' + fi +else + echo Failed +fi 1>&2 + +exit ${rc:-5}