summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorjlam <jlam>2001-12-26 22:03:38 +0000
committerjlam <jlam>2001-12-26 22:03:38 +0000
commite782bc15da11425360cd61d4dfff0cf50806944e (patch)
tree2c0985b616cb167cea278ebb415d36d7f9e3e809 /www
parentff634e70dc6d749cfd18dae37de423ba259c0ae4 (diff)
downloadpkgsrc-e782bc15da11425360cd61d4dfff0cf50806944e.tar.gz
Vastly simplify this script by using /etc/rc.subr. Provide minimal start
functionality on pre-1.5 platforms, as apachectl may always be used instead for the full control interface.
Diffstat (limited to 'www')
-rw-r--r--www/apache/files/apache.sh79
-rw-r--r--www/apache6/files/apache.sh79
2 files changed, 34 insertions, 124 deletions
diff --git a/www/apache/files/apache.sh b/www/apache/files/apache.sh
index 3bd20dd9e7e..7e5db5799bc 100644
--- a/www/apache/files/apache.sh
+++ b/www/apache/files/apache.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: apache.sh,v 1.14 2001/11/26 07:34:06 jlam Exp $
+# $NetBSD: apache.sh,v 1.15 2001/12/26 22:03:38 jlam Exp $
#
# PROVIDE: apache
# REQUIRE: DAEMON
@@ -9,9 +9,15 @@
# To start apache at startup, copy this script to /etc/rc.d and set
# apache=YES in /etc/rc.conf.
+if [ -e /etc/rc.subr ]
+then
+ . /etc/rc.subr
+fi
+
name="apache"
rcvar=$name
-command="@PREFIX@/sbin/apachectl"
+command="@PREFIX@/sbin/httpd"
+ctl_command="@PREFIX@/sbin/apachectl"
apache_start=start
if [ -f @PKG_SYSCONFDIR@/apache_start.conf ]
@@ -20,66 +26,15 @@ then
. @PKG_SYSCONFDIR@/apache_start.conf
fi
-# set defaults
-if [ -r /etc/rc.conf ]
-then
- . /etc/rc.conf
-else
- eval ${rcvar}=YES
-fi
+required_files="@PKG_SYSCONFDIR@/httpd.conf"
+start_cmd="${ctl_command} ${apache_start}"
+stop_cmd="${ctl_command} stop"
+restart_cmd="${ctl_command} restart"
-# $flags from environment overrides ${rcvar}_flags
-if [ -n "${flags}" ]
+if [ -e /etc/rc.subr ]
then
- eval ${rcvar}_flags="${flags}"
-fi
-
-apache_doit()
-{
- action=$1
-
- case ${action} in
- start) echo -n "Starting ${name}: "; action=${apache_start} ;;
- stop) echo -n "Stopping ${name}: " ;;
- restart) echo -n "Restarting ${name}: " ;;
- esac
-
- ${command} ${apache_flags} ${command_args} ${action}
-}
-
-checkyesno()
-{
- eval _value=\$${1}
- case $_value in
- [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0 ;;
- [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1 ;;
- *)
- echo "\$${1} is not set properly."
- return 1
- ;;
- esac
-}
-
-cmd=${1:-start}
-case ${cmd} in
-force*)
- cmd=${cmd#force}
- eval ${rcvar}=YES
- ;;
-esac
-
-if checkyesno ${rcvar}
-then
- if [ -x ${command} ]
- then
- case ${cmd} in
- restart|start|stop|status)
- ${rcvar}_doit ${cmd}
- ;;
- *)
- echo 1>&2 "Usage: $0 [restart|start|stop|status]"
- exit 1
- ;;
- esac
- fi
+ load_rc_config $name
+ run_rc_command "$1"
+else
+ ${start_cmd}
fi
diff --git a/www/apache6/files/apache.sh b/www/apache6/files/apache.sh
index d8a2a50c68c..5c56ae0dd06 100644
--- a/www/apache6/files/apache.sh
+++ b/www/apache6/files/apache.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: apache.sh,v 1.10 2001/11/26 07:34:07 jlam Exp $
+# $NetBSD: apache.sh,v 1.11 2001/12/26 22:03:38 jlam Exp $
#
# PROVIDE: apache
# REQUIRE: DAEMON
@@ -9,9 +9,15 @@
# To start apache at startup, copy this script to /etc/rc.d and set
# apache=YES in /etc/rc.conf.
+if [ -e /etc/rc.subr ]
+then
+ . /etc/rc.subr
+fi
+
name="apache"
rcvar=$name
-command="@PREFIX@/sbin/apachectl"
+command="@PREFIX@/sbin/httpd"
+ctl_command="@PREFIX@/sbin/apachectl"
apache_start=start
if [ -f @PKG_SYSCONFDIR@/apache_start.conf ]
@@ -20,66 +26,15 @@ then
. @PKG_SYSCONFDIR@/apache_start.conf
fi
-# set defaults
-if [ -r /etc/rc.conf ]
-then
- . /etc/rc.conf
-else
- eval ${rcvar}=YES
-fi
+required_files="@PKG_SYSCONFDIR@/httpd.conf"
+start_cmd="${ctl_command} ${apache_start}"
+stop_cmd="${ctl_command} stop"
+restart_cmd="${ctl_command} restart"
-# $flags from environment overrides ${rcvar}_flags
-if [ -n "${flags}" ]
+if [ -e /etc/rc.subr ]
then
- eval ${rcvar}_flags="${flags}"
-fi
-
-apache_doit()
-{
- action=$1
-
- case ${action} in
- start) echo -n "Starting ${name}: "; action=${apache_start} ;;
- stop) echo -n "Stopping ${name}: " ;;
- restart) echo -n "Restarting ${name}: " ;;
- esac
-
- ${command} ${apache_flags} ${command_args} ${action}
-}
-
-checkyesno()
-{
- eval _value=\$${1}
- case $_value in
- [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0 ;;
- [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1 ;;
- *)
- echo "\$${1} is not set properly."
- return 1
- ;;
- esac
-}
-
-cmd=${1:-start}
-case ${cmd} in
-force*)
- cmd=${cmd#force}
- eval ${rcvar}=YES
- ;;
-esac
-
-if checkyesno ${rcvar}
-then
- if [ -x ${command} ]
- then
- case ${cmd} in
- restart|start|stop|status)
- ${rcvar}_doit ${cmd}
- ;;
- *)
- echo 1>&2 "Usage: $0 [restart|start|stop|status]"
- exit 1
- ;;
- esac
- fi
+ load_rc_config $name
+ run_rc_command "$1"
+else
+ ${start_cmd}
fi