
Part One: Create template Move tools/xen from devstack to os-xenapi which will be the center place to hold some XenServer/XenAPI specify source code. This part is used to install a clean ubuntu VM template Change-Id: I5e62741b5f647680a411fa83ab8609b6feb2a65e
25 lines
355 B
Bash
Executable File
25 lines
355 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
set -o xtrace
|
|
|
|
if [ -z "${on_exit_hooks:-}" ]; then
|
|
on_exit_hooks=()
|
|
fi
|
|
|
|
on_exit()
|
|
{
|
|
for i in $(seq $((${#on_exit_hooks[*]} - 1)) -1 0); do
|
|
eval "${on_exit_hooks[$i]}"
|
|
done
|
|
}
|
|
|
|
add_on_exit()
|
|
{
|
|
local n=${#on_exit_hooks[*]}
|
|
on_exit_hooks[$n]="$*"
|
|
if [[ $n -eq 0 ]]; then
|
|
trap on_exit EXIT
|
|
fi
|
|
}
|