annotate s4-start.sh @ 86:518e3afcb230

add examples/form-text+img/form/memo.def
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 03 Aug 2015 14:11:53 +0900
parents 465447d8b3ab
children 573f0d54eb5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
1 #!/bin/sh
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
2 # 愛
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
3 # Start s4 - Generate s4.cgi
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
4 mydir=`dirname $0`
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
5 myname=`basename $0`
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
6
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
7 script_dir=${SCRIPT_DIR:-scripts}
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
8
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
9 ADMIN=""
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
10 TYPE="form1"
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
11 ex=examples
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
12
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
13 usage() {
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
14 cat<<EOF
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
15 $myname `sed -n 3p $0`
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
16 Usage: $myname [Options]
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
17 Options are as follows:
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
18 -h Show this help
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
19 -a ADM Set ADMIN email address to ADM
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
20 -f Force overwriting
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
21 -t TYPE Construction type (defaults to $TYPE)
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
22
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
23 TYPEs are one of directory names in examples except \`common'.
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
24 EOF
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
25 exit 0
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
26 }
85
465447d8b3ab -a option take one argument
HIROSE Yuuji <yuuji@gentei.org>
parents: 84
diff changeset
27 while getopts a:fht: f; do
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
28 case $f in
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
29 a) ADMIN=$OPTARG;;
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
30 f) force=1;;
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
31 t) TYPE=$OPTARG;;
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
32 \?|h) usage; exit 1;;
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
33 esac
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
34 done
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
35 shift $(expr $OPTIND - 1)
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
36
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
37 if [ ! -d $ex/$TYPE ]; then
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
38 cat<<EOF 1>&2
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
39 Invalid type($TYPE).
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
40 Types are one of as follows.
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
41 `ls $ex|grep -v common | sed 's/^/ /'`
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
42 EOF
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
43 exit 1
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
44 fi
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
45
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
46 if [ -z "$ADMIN" ]; then
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
47 cat<<EOF 1>&2
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
48 Administrator's email not specified.
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
49 Please feed administrator email with \`-a' option.
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
50 EOF
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
51 exit 1
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
52 fi
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
53
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
54 if ! cd $mydir; then
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
55 echo "Script(s4-funcs.sh) not found in \`$mydir'." 1>&2
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
56 exit 1
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
57 fi
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
58
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
59 . ./s4-funcs.sh || exit 2
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
60 if ! checkdomain $ADMIN; then
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
61 cat<<EOF 1>&2
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
62 Administrator's email - $ADMIN - is invalid(host not found).
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
63 Please specify existing email address.
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
64 EOF
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
65 exit 3
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
66 fi
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
67
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
68 if [ -d templ/form ]; then
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
69 if [ -z "$force" ]; then
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
70 echo "templ/ directory already exists. Remove it, then try again." 1>&2
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
71 exit 4
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
72 fi
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
73 rm -rf templ/*
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
74 fi
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
75 mkdir templ
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
76 if (cd templ && ln -s ../examples/$type/* .); then
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
77 if ./s4-init.sh; then
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
78 cat<<EOF
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
79 -------- The s4 System Successfully Installed --------
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
80 EOF
86
518e3afcb230 add examples/form-text+img/form/memo.def
HIROSE Yuuji <yuuji@gentei.org>
parents: 85
diff changeset
81 echo "ADMIN=$ADMIN" >> s4-config.sh && rc=0
82
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
82 else
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
83 echo Calling s4-init.sh 'FAILED!!'
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
84 fi
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
85 else
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
86 echo Failed
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
87 fi 1>&2
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
88
db489961e461 Installer script - sr-start.sh - added
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff changeset
89 exit ${rc:-5}

yatex.org