diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-12-05 07:57:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-12-11 12:13:01 +0000 |
commit | 5e729cbab5cf9a15dec85946dd41b935dda403c5 (patch) | |
tree | ae40b418de1251dc822f865b1cd23f89eb7112c4 | |
parent | Adding XML export format to container list command. (diff) | |
download | compute-tools-5e729cbab5cf9a15dec85946dd41b935dda403c5.tar.xz compute-tools-5e729cbab5cf9a15dec85946dd41b935dda403c5.zip |
Enabling pre and post hooks in container program.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-x | bin/container | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/container b/bin/container index 484a0e1..5b97d3e 100755 --- a/bin/container +++ b/bin/container @@ -21,6 +21,8 @@ set -e SOFTWARE="container-tools" PROGRAM="container" +HOOKS="/etc/${SOFTWARE}/hooks" + # Parameter PARAMETER="${1}" @@ -43,6 +45,15 @@ fi shift 1 OPTIONS="${@}" +# Pre hooks +for FILE in "${HOOKS}/pre-${PROGRAM}".* "${HOOKS}/${NAME}.pre-${PROGRAM}" +do + if [ -x "${FILE}" ] + then + "${FILE}" + fi +done + # Notification if echo "${OPTIONS}" | grep -qs "\--no-notification" then @@ -76,3 +87,12 @@ fi # Run exec "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" "${OPTIONS}" + +# Post hooks +for FILE in "${HOOKS}/post-${PROGRAM}".* "${HOOKS}/${NAME}.post-${PROGRAM}" +do + if [ -x "${FILE}" ] + then + "${FILE}" + fi +done |