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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/s4-start.sh Mon Aug 03 12:15:28 2015 +0900 1.3 @@ -0,0 +1,89 @@ 1.4 +#!/bin/sh 1.5 +# 愛 1.6 +# Start s4 - Generate s4.cgi 1.7 +mydir=`dirname $0` 1.8 +myname=`basename $0` 1.9 + 1.10 +script_dir=${SCRIPT_DIR:-scripts} 1.11 + 1.12 +admin="" 1.13 +type="form1" 1.14 +ex=examples 1.15 + 1.16 +usage() { 1.17 + cat<<EOF 1.18 +$myname `sed -n 3p $0` 1.19 +Usage: $myname [Options] 1.20 +Options are as follows: 1.21 + -h Show this help 1.22 + -a ADM Set ADMIN email address to ADM 1.23 + -f Force overwriting 1.24 + -t TYPE Force overwriting (defaults to $type) 1.25 + 1.26 +TYPEs are one of directory names in examples except \`common'. 1.27 +EOF 1.28 + exit 0 1.29 +} 1.30 +while getopts afht: f; do 1.31 + case $f in 1.32 + a) admin=$OPTARG;; 1.33 + f) force=1;; 1.34 + t) type=$OPTARG;; 1.35 + \?|h) usage; exit 1;; 1.36 + esac 1.37 +done 1.38 +shift $(expr $OPTIND - 1) 1.39 + 1.40 +if [ ! -d $ex/$type ]; then 1.41 + cat<<EOF 1>&2 1.42 +Invalid type($type). 1.43 +Types are one of as follows. 1.44 +`ls $ex|grep -v common | sed 's/^/ /'` 1.45 +EOF 1.46 + exit 1 1.47 +fi 1.48 + 1.49 +if [ -z "$admin" ]; then 1.50 + cat<<EOF 1>&2 1.51 +Administrator's email not specified. 1.52 +Please feed administrator email with \`-a' option. 1.53 +EOF 1.54 + exit 1 1.55 +fi 1.56 + 1.57 +if ! cd $mydir; then 1.58 + echo "Script(s4-funcs.sh) not found in \`$mydir'." 1>&2 1.59 + exit 1 1.60 +fi 1.61 + 1.62 +. ./s4-funcs.sh || exit 2 1.63 +if ! checkdomain $admin; then 1.64 + cat<<EOF 1>&2 1.65 +Administrator's email - $admin - is invalid(host not found). 1.66 +Please specify existing email address. 1.67 +EOF 1.68 + exit 3 1.69 +fi 1.70 + 1.71 +if [ -d templ/form ]; then 1.72 + if [ -z "$force" ]; then 1.73 + echo "templ/ directory already exists. Remove it, then try again." 1>&2 1.74 + exit 4 1.75 + fi 1.76 + rm -rf templ/* 1.77 +fi 1.78 +mkdir templ 1.79 +if (cd templ && ln -s ../examples/$type/* .); then 1.80 + if ./s4-init.sh; then 1.81 + cat<<EOF 1.82 +-------- The s4 System Successfully Installed -------- 1.83 +EOF 1.84 + rc=0 1.85 + else 1.86 + echo Calling s4-init.sh 'FAILED!!' 1.87 + fi 1.88 +else 1.89 + echo Failed 1.90 +fi 1>&2 1.91 + 1.92 +exit ${rc:-5}