hooks->lxc: Make script a bit more elegant
authorKristian Fiskerstrand <kf@sumptuouscapital.com>
Sat, 28 May 2016 21:00:17 +0000 (23:00 +0200)
committerKristian Fiskerstrand <kf@sumptuouscapital.com>
Sat, 28 May 2016 21:00:17 +0000 (23:00 +0200)
hooks/lxc

index 6f9d2e3..f13686d 100755 (executable)
--- a/hooks/lxc
+++ b/hooks/lxc
@@ -21,10 +21,7 @@ HOOK_LOCATION="/etc/libvirt/hooks/hook.d"
 function run_scripts(){
        DIR=${1}
        for x in ${DIR}/*; do
-       echo $x
-       if [[ -x ${DIR}/${x} ]]; then
-               echo -n ${HOOK_DATA} | ${DIR}/${x} ${HOOK_GUEST_NAME} ${HOOK_PHASE} >&2
-       fi
+       [[ -x ${x} ]] && echo -n ${HOOK_DATA} | ${x} ${HOOK_GUEST_NAME} ${HOOK_PHASE} >&2
        done;
 }