diff options
author | Sebastian | 2016-04-25 12:01:08 +0200 |
---|---|---|
committer | Sebastian | 2016-04-25 12:01:08 +0200 |
commit | 5acda3eaeabae9045609539303a8c12c4ce401f1 (patch) | |
tree | 7e71975f8570b05aafe2ea6ec0e242a8912387bb /core/includes/cleanup.inc | |
parent | initial commit (diff) | |
download | mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.tar.gz mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.tar.xz mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.zip |
merge with latest dev version
Diffstat (limited to 'core/includes/cleanup.inc')
-rw-r--r-- | core/includes/cleanup.inc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/includes/cleanup.inc b/core/includes/cleanup.inc new file mode 100644 index 00000000..9716c841 --- /dev/null +++ b/core/includes/cleanup.inc @@ -0,0 +1,34 @@ +# ----------------------------------------------------------------------------- +# +# Copyright (c) 2014 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# +# Trapped cleanup functions +# +# ----------------------------------------------------------------------------- + +__init () { + # run 'cleanexit' when CTRL-c is pressed, an abrupt program termination or exit happens + trap cleanexit SIGINT SIGTERM +} + +# main cleaner function +cleanexit() { + trap '' SIGINT SIGTERM # from now on, ignore INT and TERM + unset_quiet # needed to get trap functioning correctly + pwarning "SIGINT/SIGTERM triggered - cleaning up ..." + # unmount and remove the temporary chroot stuff + pinfo "Calling chroot_cleanup_mounts ..." + chroot_cleanup_mounts + # TODO vmware etc/vmware/config stuff here, if it is still needed + exit 1 # perhaps a better exit code? +} + |