diff options
-rw-r--r-- | debian/bcfg2.default | 18 | ||||
-rw-r--r-- | debian/buildsys/2.3/bcfg2.init | 10 | ||||
-rw-r--r-- | debian/buildsys/common/bcfg2.init | 7 | ||||
-rw-r--r-- | misc/bcfg2.spec | 4 | ||||
-rw-r--r-- | tools/bcfg2-cron | 11 |
5 files changed, 37 insertions, 13 deletions
diff --git a/debian/bcfg2.default b/debian/bcfg2.default index 0b00f7c35..80dc94cca 100644 --- a/debian/bcfg2.default +++ b/debian/bcfg2.default @@ -2,18 +2,26 @@ # BCFG2_OPTIONS: # Set the default options for Bcfg2 on startup -# +# Default: "-q" #BCFG2_OPTIONS="-q" -# BCFG_ENABLED: +# BCFG2_ENABLED: # Should Bcfg2 be run automatically by system scripts # -# Uncomment the following line to automatically start bcfg2 on startup -# +# Uncomment the following line to enable any of the below selections +# Default: 0 (disable) #BCFG2_ENABLED=1 +# BCFG2_INIT: +# Enable bcfg2 during system bootup +# +# Set value to 1 to enable +# Default: 0 (disable) +#BCFG2_INIT=1 + # BCFG2_CRON: # Set the frequency of cron runs. # -# Can be set to off, hourly or daily +# Can be set to off, hourly, daily or both +# Default: off #BCFG2_CRON=off diff --git a/debian/buildsys/2.3/bcfg2.init b/debian/buildsys/2.3/bcfg2.init index a184297e8..e6781208d 100644 --- a/debian/buildsys/2.3/bcfg2.init +++ b/debian/buildsys/2.3/bcfg2.init @@ -6,8 +6,16 @@ # description: bcfg2 client for configuration requests # BCFG2_OPTIONS="-q" + +# Disabled per default +BCFG2_ENABLED=0 +BCFG2_INIT=0 + +# Include default startup configuration if exists test -f "/etc/default/bcfg2" && . /etc/default/bcfg2 +["$BCFG2_ENABLED" == "0" -o "$BCFG2_INIT" == 0 ] && exit 0 + case "$1" in start) if test -e /etc/donttouchme; then @@ -15,7 +23,7 @@ case "$1" in echo "bcfg2 does not need to run." else echo -n "Running bcfg: " - /usr/sbin/bcfg2 $BCFG2_OPTIONS + /usr/sbin/bcfg2 $BCFG2_OPTIONS $BCFG2_OPTIONS_INIT echo "bcfg2" fi ;; diff --git a/debian/buildsys/common/bcfg2.init b/debian/buildsys/common/bcfg2.init index e7466f18d..1c2836c7a 100644 --- a/debian/buildsys/common/bcfg2.init +++ b/debian/buildsys/common/bcfg2.init @@ -22,15 +22,18 @@ # This might need some better logic BCFG2=/usr/sbin/bcfg2 +# Set default options +# You can set script specific options with BCFG2_OPTIONS_INIT BCFG2_OPTIONS="-q" # Disabled per default BCFG2_ENABLED=0 +BCFG2_INIT=0 # Include default startup configuration if exists test -f "/etc/default/bcfg2" && . /etc/default/bcfg2 -test "$BCFG2_ENABLED" != "0" || exit 0 +["$BCFG2_ENABLED" == "0" -o "$BCFG2_INIT" == 0 ] && exit 0 # Exit if bcfg2 doesn't exist and is not executable test -x $BCFG2 || exit 5 @@ -41,7 +44,7 @@ test -x $BCFG2 || exit 5 case "$1" in start) echo -n "Running configuration management client: " - ${BCFG2} ${BCFG2_OPTIONS} + ${BCFG2} ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_INIT} STATUS=$? if [ "$STATUS" = 0 ] then diff --git a/misc/bcfg2.spec b/misc/bcfg2.spec index cd7f314ae..2529c2a2c 100644 --- a/misc/bcfg2.spec +++ b/misc/bcfg2.spec @@ -41,8 +41,8 @@ mkdir -p ${RPM_BUILD_ROOT}/usr/sbin mkdir -p ${RPM_BUILD_ROOT}/etc/init.d/ mv ${RPM_BUILD_ROOT}/usr/bin/bcfg2* ${RPM_BUILD_ROOT}/usr/sbin mv ${RPM_BUILD_ROOT}/usr/bin/StatReports ${RPM_BUILD_ROOT}/usr/sbin -install -m 755 debian/bcfg2.init ${RPM_BUILD_ROOT}/etc/init.d/bcfg2 -install -m 755 debian/bcfg2-server.init ${RPM_BUILD_ROOT}/etc/init.d/bcfg2-server +install -m 755 debian/buildsys/common/bcfg2.init ${RPM_BUILD_ROOT}/etc/init.d/bcfg2 +install -m 755 debian/buildsys/common/bcfg2-server.init ${RPM_BUILD_ROOT}/etc/init.d/bcfg2-server install -m 755 debian/bcfg2.default ${RPM_BUILD_ROOT}/etc/default/bcfg2 %clean diff --git a/tools/bcfg2-cron b/tools/bcfg2-cron index 6dfa5db66..d5f6d76fc 100644 --- a/tools/bcfg2-cron +++ b/tools/bcfg2-cron @@ -12,6 +12,9 @@ BCFG2_CRON=off BCFG2_ENABLED=0 # Set default options +# This script will respect additional variables: +# BCFG_OPTIONS_DAILY and BCFG_OPTIONS_HOURLY are added to BCFG2_OPTIONS +# This allows you to run different types of passes with cron BCFG2_OPTIONS="-q" # bcfg2 file locations @@ -27,16 +30,18 @@ BCFG2_CFG=/etc/bcfg2.conf invoke_bcfg2 () { # Invoke bcfg2 if enabled if [ ${BCFG2_ENABLED} -eq 1 ]; then - ${BCFG2_BIN} ${BCFG2_OPTIONS} + ${BCFG2_BIN} ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_${RUNTYPE}} fi } case $1 in "--daily") - [ "x${BCFG2_CRON}" = "xdaily" ] && invoke_bcfg2 + [ "x${BCFG2_CRON}" = "xdaily" -o "x${BCFG2_CRON}" = "xboth" ] && \ + RUNTYPE=DAILY invoke_bcfg2 ;; "--hourly") - [ "x${BCFG2_CRON}" = "xhourly" ] && invoke_bcfg2 + [ "x${BCFG2_CRON}" = "xhourly" -o "x${BCFG2_CRON}" = "xboth"] && \ + RUNTYPE=HOURLY invoke_bcfg2 ;; *) echo "Usage: $0 [--daily|--hourly]" |