diff options
author | felics@felics-tablet | 2016-09-21 19:45:28 +0200 |
---|---|---|
committer | felics@felics-tablet | 2016-09-21 19:45:28 +0200 |
commit | 35f3636021ed1bcfa121a97be1c2ed14f1b147a5 (patch) | |
tree | 426a683deb032c21ca57bd6fd51d0ebf21b0bf9b | |
parent | ce7309009c25f78d28d4f1f7190bf7b68496dda4 (diff) | |
download | aur-35f3636021ed1bcfa121a97be1c2ed14f1b147a5.tar.gz |
Rework of initscripts, initscripts' config file and install messages.
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | PKGBUILD | 19 | ||||
-rw-r--r-- | conf_d_wwwoffle | 9 | ||||
-rw-r--r-- | initscript_openrc | 30 | ||||
-rw-r--r-- | initscript_systemd | 5 | ||||
-rw-r--r-- | initscript_sysvinit | 37 | ||||
-rw-r--r-- | wwwoffle.install | 16 |
7 files changed, 90 insertions, 40 deletions
@@ -1,7 +1,7 @@ pkgbase = wwwoffle-svn pkgdesc = Simple caching proxy server with special features (request, recursive fetch, abonnement, modify HTML, ...) for use with dial-up internet links. Includes startup scripts for OpenRC, System V init, systemd. pkgver = 2.9j+svn2227 - pkgrel = 4 + pkgrel = 5 epoch = 1 url = http://www.gedanken.org.uk/software/wwwoffle/ install = wwwoffle.install @@ -25,8 +25,8 @@ pkgbase = wwwoffle-svn replaces = wwwoffle-sysvinit<=2.9j+svn2227 replaces = wwwoffle-openrc<=2.9j+svn2227 replaces = wwwoffle-systemd<=2.9j+svn2227 + backup = etc/conf.d/wwwoffle backup = etc/wwwoffle/wwwoffle.conf - backup = etc/wwwoffle/wwwoffle.conf.template source = wwwoffle::svn+http://gedanken.org.uk/svn/wwwoffle/trunk source = conf_d_wwwoffle source = initscript_openrc @@ -34,11 +34,11 @@ pkgbase = wwwoffle-svn source = initscript_sysvinit source = wwwoffle.install sha256sums = SKIP - sha256sums = cd05738f73b109dd074f6dd919300eeae55c2aa812a15e0ae61b32622423c867 - sha256sums = 090329f13d8889a3e6e3b46b3f9de152eea0963b71c10a2a7dbafb7bb7e17120 - sha256sums = 04fd88f2a100e3ff9a96da6a70e58457252722cbf6350ffdbf08f17e62b64869 - sha256sums = 3938777ba2baa7faac569d4a4a8a8cb7adeef786cfa84e991b6f03e991bcfae8 - sha256sums = c36b8868587f1f274bc6382fe6d2dd38c1575bf725f788b1624a67a062e8bce2 + sha256sums = 5491ffc23ae113db4b46167883594b5bcb6f1bbd0ce11432bc45047efbd635d2 + sha256sums = 5f6d81094d8031172733500597e3d608632da3241cfadff8c166723af97d996a + sha256sums = 03bebce87a0da1b383666ab7a95b9810e15f2a024c0954f09c959d342c5d9c87 + sha256sums = c1c8f30bc0fe928d887212678c9857a526ea7767964192b13d994e81314ba002 + sha256sums = 106f4ce3de6d6ea020e8dcd8a4fd4f78ed2ae855e8a953a8783134e4d2cfba12 pkgname = wwwoffle-svn @@ -7,7 +7,7 @@ pkgname="${_pkgname}-svn" # _pkgver=2.9i epoch=1 pkgver=2.9j+svn2227 -pkgrel=4 +pkgrel=5 pkgdesc="Simple caching proxy server with special features (request, recursive fetch, abonnement, modify HTML, ...) for use with dial-up internet links. Includes startup scripts for OpenRC, System V init, systemd." arch=('i686' 'x86_64' 'arm' 'arm64') url="http://www.gedanken.org.uk/software/wwwoffle/" @@ -34,8 +34,9 @@ conflicts=( ) backup=( + 'etc/conf.d/wwwoffle' 'etc/wwwoffle/wwwoffle.conf' - 'etc/wwwoffle/wwwoffle.conf.template' + # 'etc/wwwoffle/wwwoffle.conf.template' ) install="${_pkgname}.install" @@ -53,13 +54,13 @@ source=( ) sha256sums=( - # 'e6341a4ec2631dc22fd5209c7e5ffe628a5832ad191d444c56aebc3837eed2ae' # Main source, release - 'SKIP' # Main source, SVN - 'cd05738f73b109dd074f6dd919300eeae55c2aa812a15e0ae61b32622423c867' # conf_d_wwwoffle - '090329f13d8889a3e6e3b46b3f9de152eea0963b71c10a2a7dbafb7bb7e17120' # initscript_openrc - '04fd88f2a100e3ff9a96da6a70e58457252722cbf6350ffdbf08f17e62b64869' # initscript_systemd - '3938777ba2baa7faac569d4a4a8a8cb7adeef786cfa84e991b6f03e991bcfae8' # initscript_sysvinit - 'c36b8868587f1f274bc6382fe6d2dd38c1575bf725f788b1624a67a062e8bce2' # ${install} + # 'e6341a4ec2631dc22fd5209c7e5ffe628a5832ad191d444c56aebc3837eed2ae' # Main source, release + 'SKIP' # Main source, SVN + '5491ffc23ae113db4b46167883594b5bcb6f1bbd0ce11432bc45047efbd635d2' # conf_d_wwwoffle + '5f6d81094d8031172733500597e3d608632da3241cfadff8c166723af97d996a' # initscript_openrc + '03bebce87a0da1b383666ab7a95b9810e15f2a024c0954f09c959d342c5d9c87' # initscript_systemd + 'c1c8f30bc0fe928d887212678c9857a526ea7767964192b13d994e81314ba002' # initscript_sysvinit + '106f4ce3de6d6ea020e8dcd8a4fd4f78ed2ae855e8a953a8783134e4d2cfba12' # ${install} ) _pgmver() { diff --git a/conf_d_wwwoffle b/conf_d_wwwoffle index 7b0eafe106e4..667bb50ad692 100644 --- a/conf_d_wwwoffle +++ b/conf_d_wwwoffle @@ -1,10 +1,15 @@ # -# Parameters to be passed to wwwoffle. +# Parameters to be passed to wwwoffled. # # NOTE: # This file is parsed when using System V initscript or openrc-initscript, # but it is ignored when using systemd to start up wwwoffle. # When using systemd, edit the wwwoffle service definition directly to change startup options. # +# The following variables are understood (as of version 2.9j+svn2227-5): +# * WWWOFFLE_CONFIG_FILE holds the configuration file to use, +# * WWWOFFLED_EXTRA_ARGS holds extra arguments to be passed to wwwoffled during startup (can be assigned the empty string). +# -WWWOFFLE_ARGS="-c /etc/wwwoffle/wwwoffle.conf" +WWWOFFLE_CONFIG_FILE="/etc/wwwoffle/wwwoffle.conf" +WWWOFFLED_EXTRA_ARGS="" diff --git a/initscript_openrc b/initscript_openrc index c6b2bf215c1a..666d6fe88fe7 100644 --- a/initscript_openrc +++ b/initscript_openrc @@ -1,38 +1,48 @@ #!/usr/bin/openrc-run # OpenRC wwwoffle script -## The WWWOFFLE_ARGS environment variable should be set within /etc/conf.d/wwwoffle! +## The controlling environment variable should be set within /etc/conf.d/wwwoffle! _DAEMON="/usr/sbin/wwwoffled" _DAEMON_ARGS=( - ${WWWOFFLE_ARGS} + -c "${WWWOFFLE_CONFIG_FILE}" + ${WWWOFFLED_EXTRA_ARGS} ) -extra_started_commands="reload" +extra_started_commands="reload status" depend() { use logger dns } +_check_conf_file_var() { + if [ -z "${WWWOFFLE_CONFIG_FILE}" ]; then + eerror "Variable 'WWWOFFLE_CONFIG_FILE' not set or empty in '/etc/conf.d/wwwoffle'". + eerror "This variable needs to be set to the configuration file to use." + return 1 + fi +} + start() { ebegin "Starting $(basename "${_DAEMON}"): Executing ${_DAEMON} ${_DAEMON_ARGS[@]}" - - start-stop-daemon --start --quiet --exec "${_DAEMON}" -- "${_DAEMON_ARGS[@]}" - + _check_conf_file_var && start-stop-daemon --start --exec "${_DAEMON}" -- "${_DAEMON_ARGS[@]}" eend "$?" } stop() { ebegin "Stopping $(basename "${_DAEMON}")" - - start-stop-daemon --stop --quiet --exec "${_DAEMON}" - + start-stop-daemon --stop --exec "${_DAEMON}" eend "$?" } reload() { ebegin "Re-reading configuration file for $(basename "${_DAEMON}")" - wwwoffle "${_DAEMON_ARGS[@]}" -config + _check_conf_file_var && wwwoffle -c "${WWWOFFLE_CONFIG_FILE}" -config eend "$?" } +status() { + ebegin "Querying status of $(basename "${_DAEMON}")" + _check_conf_file_var && wwwoffle -c "${WWWOFFLE_CONFIG_FILE}" -status + eend "$?" +} diff --git a/initscript_systemd b/initscript_systemd index 75ad23d83847..e3e746e4b93a 100644 --- a/initscript_systemd +++ b/initscript_systemd @@ -6,8 +6,9 @@ Description=The wwwoffle proxy server After=network.target [Service] -ExecStart=/usr/sbin/wwwoffled -d -c /etc/wwwoffle/wwwoffle.conf -ExecReload=/usr/bin/wwwoffle -config -c /etc/wwwoffle/wwwoffle.conf +ExecStart=/usr/sbin/wwwoffled -c /etc/wwwoffle/wwwoffle.conf -d +ExecReload=/usr/bin/wwwoffle -c /etc/wwwoffle/wwwoffle.conf -config +ExecStatus=/usr/bin/wwwoffle -c /etc/wwwoffle/wwwoffle.conf -status [Install] WantedBy=multi-user.target diff --git a/initscript_sysvinit b/initscript_sysvinit index c68fe5858b07..3c7f042b76ec 100644 --- a/initscript_sysvinit +++ b/initscript_sysvinit @@ -2,24 +2,37 @@ # source application-specific settings -# WWWOFFLE_ARGS will be by sourcing '/etc/conf.d/wwwoffle'. -WWWOFFLE_ARGS= -[ -f /etc/conf.d/wwwoffle ] && . /etc/conf.d/wwwoffle +# The controlling will be by sourcing '/etc/conf.d/wwwoffle'. +WWWOFFLE_CONFIG_FILE='' +WWWOFFLED_EXTRA_ARGS='' + +_initconffile='/etc/conf.d/wwwoffle' +[ -f "${_initconffile}" ] && . "${_initconffile}" _pretty_name="wwwoffle" _DAEMON="/usr/sbin/wwwoffled" _DAEMON_ARGS=( - ${WWWOFFLE_ARGS} + -c "${WWWOFFLE_CONFIG_FILE}" + ${WWWOFFLED_EXTRA_ARGS} ) + . /etc/rc.conf . /etc/rc.d/functions -PID=`pidof -o %PPID "${_DAEMON}"` +_check_conf_file_var() { + if [ -z "${WWWOFFLE_CONFIG_FILE}" ]; then + echo "ERROR: Variable 'WWWOFFLE_CONFIG_FILE' not set or empty in '${_initconffile}'". + echo "ERROR: This variable needs to be set to the configuration file to use." + return 1 + fi +} + +PID=`pidof -o %PPID "${_DAEMON}"` || true case "$1" in start) stat_busy "Starting ${_pretty_name}" - [ -z "$PID" ] && "${_DAEMON}" "${_DAEMON_ARGS[@]}" + _check_conf_file_var && [ -z "$PID" ] && "${_DAEMON}" "${_DAEMON_ARGS[@]}" if [ $? -gt 0 ]; then stat_fail else @@ -44,7 +57,16 @@ case "$1" in ;; reload) stat_busy "Re-reading configuration file of ${_pretty_name}" - wwwoffle "${_DAEMON_ARGS[@]}" -config + _check_conf_file_var && wwwoffle -c "${WWWOFFLE_CONFIG_FILE}" -config + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi + ;; + status) + stat_busy "Querying status of ${_pretty_name}" + _check_conf_file_var && wwwoffle -c "${WWWOFFLE_CONFIG_FILE}" -status if [ $? -gt 0 ]; then stat_fail else @@ -55,4 +77,3 @@ case "$1" in echo "usage: $0 {start|stop|restart}" ;; esac -exit 0 diff --git a/wwwoffle.install b/wwwoffle.install index 01d4966b0222..a70c8cd98f68 100644 --- a/wwwoffle.install +++ b/wwwoffle.install @@ -3,7 +3,20 @@ post_install() { } post_upgrade() { - echo "ATTENTION WWWOFFLE:" + echo "WWWOFFLE post-installation/ post-upgrade information, please read:" + echo "-------------------" + echo "" + echo "If you upgraded from a version below 2.9j+svn2227-5," + echo "MANUAL INTERVENTION is required:" + echo "Format of /etc/conf.d/wwwoffle changed between version" + echo "2.9j+svn2227-4 and v2.9j+svn2227-5." + echo "If you upgraded from a version below 2.9j+svn2227-5, please make" + echo "sure you edit /etc/conf.d/wwwoffle." + echo "The old variable 'WWWOFFLE_ARGS' is no longer understood. Instead," + echo "the place of the config file to use goes into 'WWWOFFLE_CONFIG_FILE'," + echo "and further arguments to be passed to the deamon upon startup go into" + echo "WWWOFFLED_EXTRA_ARGS." + echo "" echo "-------------------" echo "" echo "Configuration file template is installed at" @@ -57,4 +70,3 @@ pre_remove() { echo ">>> Removing group wwwoffle." groupdel wwwoffle &> /dev/null } - |