Created
October 7, 2018 19:40
-
-
Save h0tw1r3/1cc1c89dd20dd9265a8154945090698f to your computer and use it in GitHub Desktop.
hooks.d for libvirt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copy or link this script to /etc/libvirt/hooks/{network,qemu,daemon,lxc} | |
TYPE=$(basename $0) | |
HOOKS_PATH="/etc/libvirt/hooks.d/${TYPE}/${1}" | |
[ ! -e "${HOOKS_PATH}" ] && exit 0 | |
if [ -x "${HOOKS_PATH}/${2}/${3}" ] ; then | |
exec "${HOOKS_PATH}/${2}/${3}" "$@" <&0 | |
elif [ -x "${HOOKS_PATH}/${2}" ] ; then | |
exec "${HOOKS_PATH}/${2}" "$@" <&0 | |
elif [ -x "${HOOKS_PATH}" ] ; then | |
exec "${HOOKS_PATH}" "$@" <&0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment