aboutsummaryrefslogtreecommitdiff
path: root/www/mod_frontpage/files/apache.sh.sample
diff options
context:
space:
mode:
Diffstat (limited to 'www/mod_frontpage/files/apache.sh.sample')
-rw-r--r--www/mod_frontpage/files/apache.sh.sample58
1 files changed, 58 insertions, 0 deletions
diff --git a/www/mod_frontpage/files/apache.sh.sample b/www/mod_frontpage/files/apache.sh.sample
new file mode 100644
index 000000000000..8b5a24f5e18a
--- /dev/null
+++ b/www/mod_frontpage/files/apache.sh.sample
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
+ echo "$0: Cannot determine the PREFIX" >&2
+ exit 1
+fi
+
+#
+# Create New FrontPage suidkey
+#
+
+new_key() {
+
+ CUR_UMASK=`umask`
+ skdir=${PREFIX}/frontpage/version4.0/apache-fp
+ PERL=PERL5
+
+ if [ -x ${PREFIX}/libexec/apache/mod_frontpage.so ]
+ then
+
+ #NOTE: We need Perl 5, to generate a new key
+ if [ -x ${PERL} ]
+ then
+ umask 077
+ ${PERL} -e '@a=(split(//, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*-=_+")); print((map {$a[rand(scalar @a)]} (1..128)), "\n");' > $skdir/suidkey
+ umask ${CUR_UMASK}
+ fi
+ fi
+
+}
+
+#
+# Main
+#
+
+case "$1" in
+
+start)
+ if [ -x ${PREFIX}/sbin/apachectl ]
+ then
+ new_key
+ ${PREFIX}/sbin/apachectl start && echo -n ' httpd'
+ fi
+ ;;
+
+stop)
+ if [ -r /var/run/httpd.pid ]
+ then
+ ${PREFIX}/sbin/apachectl stop && echo -n ' httpd'
+ fi
+ ;;
+
+*)
+ echo "usage: $0 {start|stop}" 1>&2
+ exit 64
+ ;;
+
+esac