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