projects
/
invirt/packages/invirt-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update invirt-base's setup.py to deal with invirt.authz module.
[invirt/packages/invirt-base.git]
/
files
/
lib
/
init
/
config-init.sh
diff --git
a/files/lib/init/config-init.sh
b/files/lib/init/config-init.sh
index
04ca1a0
..
33ea582
100644
(file)
--- a/
files/lib/init/config-init.sh
+++ b/
files/lib/init/config-init.sh
@@
-1,30
+1,47
@@
# For a package which only configures another, "parent" package.
#
# For a package which only configures another, "parent" package.
#
-# Global variable PARENTPACKAGE names parent; may be array
-# for zero or many parents.
+# Usage:
+# PACKAGE=short-name
+# GEN_FILES=(files to generate)
+# PARENTPACKAGE=(parent-package another-parent-package)
+# . /lib/init/config-init.sh
+# config_init "$1"
#
#
-# Global variable PACKAGE names this package, for log message.
+# PACKAGE - name to appear in log message
+# GEN_FILES - files to be generated with gen-files.sh
+# PARENTPACKAGE - packages to receive start, etc, commands passed through
#
#
-# Requires bash.
+# Global variables GEN_FILES, PARENTPACKAGE may be unset for zero
+# values, or scalars for one. If run under sh, they cannot be arrays.
. /lib/init/vars.sh
. /lib/lsb/init-functions
. /lib/init/gen-files.sh
. /lib/init/vars.sh
. /lib/lsb/init-functions
. /lib/init/gen-files.sh
+if [ $BASH_VERSION ]; then
+ handle_parents () {
+ for p in "${PARENTPACKAGE[@]}"; do
+ invoke-rc.d "$p" "$1"
+ done
+ }
+else
+ handle_parents () {
+ if [ -n "$PARENTPACKAGE" ]; then
+ invoke-rc.d "$PARENTPACKAGE" "$1"
+ fi
+ }
+fi
+
config_init () {
case "$1" in
start|reload|force-reload|restart)
log_begin_msg "Reloading config for $PACKAGE"
gen_files
log_end_msg $?
config_init () {
case "$1" in
start|reload|force-reload|restart)
log_begin_msg "Reloading config for $PACKAGE"
gen_files
log_end_msg $?
- for p in "${PARENTPACKAGE[@]}"; do
- invoke-rc.d "$p" "$1"
- done
+ handle_parents "$1"
;;
stop)
;;
stop)
- for p in "${PARENTPACKAGE[@]}"; do
- invoke-rc.d "$p" "$1"
- done
+ handle_parents "$1"
;;
*)
log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
;;
*)
log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"