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