BuildSourceImage: shell traps
unused so far, but we may likely want some cleanup place
This commit is contained in:
parent
27c11edb8b
commit
41c9435adf
1 changed files with 12 additions and 0 deletions
|
@ -48,6 +48,16 @@ _init() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
local ret=$?
|
||||||
|
if [ ${ret} -ne 0 ] ; then
|
||||||
|
echo ""
|
||||||
|
_warn "cleaning up"
|
||||||
|
fi
|
||||||
|
exit "${ret}"
|
||||||
|
}
|
||||||
|
trap "cleanup" EXIT TERM KILL
|
||||||
|
|
||||||
# enable access to some of functions as subcommands!
|
# enable access to some of functions as subcommands!
|
||||||
_subcommand() {
|
_subcommand() {
|
||||||
local command="${1}"
|
local command="${1}"
|
||||||
|
@ -1061,6 +1071,8 @@ main() {
|
||||||
local unpack_dir
|
local unpack_dir
|
||||||
local work_dir
|
local work_dir
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
|
||||||
_init "${@}"
|
_init "${@}"
|
||||||
_subcommand "${@}"
|
_subcommand "${@}"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue