#!/bin/sh
# /etc/init.d/dphys-config - boot time trigger automatic config updates
# authors dsbg and franklin, last modification 2009.06.27
# copyright ETH Zuerich Physics Departement
#   use under either modified/non-advertising BSD or GPL license

# this init.d script is intended to be run from rc2.d
#   on our site it needs to run after rc2.d/S20inetd (and so identd)
#     else our config file server will disallow requests for config files
#   on our site it needs to run before rc2.d/S24dphys-admin
#     else that will not find its /etc/dphys-admin.list config file
#   so we run it as rc2.d/S22dphys-config

# /usr/local added for FreeBSD, because their ports end up in there
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
export PATH

# what we are
NAME=dphys-config

case "$1" in

  start)
    echo -n "Starting ${NAME} automatic config file updates ..."

    # in case system was switched off for a while, no cron, run an upgrade

    # no direct output, so no on-screen error message if not configured
    #   this is also consistant with cron.d handling
    #   errors will still be recorded to syslog, enough, as not boot-critical
    dphys-config init > /dev/null 2>&1

    echo ", done."
    ;;

  stop)
    echo "'Stopping' ${NAME} automatic config updates (does nothing)."
    ;;

  restart|reload|force-reload)
    echo "No daemon to (force-)re[start|load] in ${NAME}"
    ;;

  *)
    echo "Usage: $0 {start}"

    exit 1
    ;;

esac

exit 0

