]> git.pld-linux.org Git - packages/webapps.git/blame - webapps.sh
- rel 1
[packages/webapps.git] / webapps.sh
CommitLineData
e9689537
ER
1#!/bin/sh
2webapps=/etc/webapps
3action="$1"
f21ce9bd 4httpd="$2"
e9689537
ER
5app="$3"
6
7webapp_register() {
5ec58d25 8 ln -sf $webapps/$app/$httpd.conf /etc/$httpd/webapps.d/$app.conf
e9689537
ER
9}
10
11webapp_unregister() {
5ec58d25 12 rm -f /etc/$httpd/webapps.d/$app.conf
e9689537
ER
13}
14
15usage() {
16 cat >&2 <<EOF
f21ce9bd
ER
17Usage: $0 register httpd webapp
18Usage: $0 unregister httpd webapp
19
a715016d 20Where httpd is one of the webservers
f21ce9bd
ER
21apache 1.x: apache
22apache 2.x: httpd
23lighttpd: lighttpd
e9689537
ER
24EOF
25}
26
a715016d
ER
27die() {
28 echo >&2 "$0: $*"
29 exit 1
30}
31
32checkconfig() {
33 # sanity check
34 if [ ! -d "$webapps/$app" ]; then
35 die "Missing directory: $webapps/$app"
36 fi
5ec58d25
ER
37 if [ ! -d "/etc/$httpd/webapps.d" ]; then
38 die "Missing directory: /etc/$httpd/webapps.d"
a715016d
ER
39 fi
40}
41
e9689537
ER
42case "$action" in
43register)
a715016d 44 checkconfig
d91deb44 45 webapp_register
e9689537
ER
46 ;;
47unregister)
a715016d 48 checkconfig
d91deb44 49 webapp_unregister
e9689537
ER
50 ;;
51*)
52 usage
53 exit 1
54esac
This page took 0.066508 seconds and 4 git commands to generate.