mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-25 06:07:38 +00:00
signal traps for endgame cleanups
This commit is contained in:
parent
cfe04a6bee
commit
9d718d0ebb
21
tomb
21
tomb
@ -73,6 +73,23 @@ PATH+=:/sbin:/usr/sbin
|
||||
|
||||
# {{{ Safety functions
|
||||
|
||||
endgame() {
|
||||
# here clear all temp files and flush all pipes
|
||||
_verbose "Signal trap: $1"
|
||||
unset tomb_secret
|
||||
}
|
||||
|
||||
# trap functions for the endgame event
|
||||
TRAPINT() { endgame INT }
|
||||
TRAPEXIT() { endgame EXIT }
|
||||
TRAPHUP() { endgame HUP }
|
||||
TRAPQUIT() { endgame QUIT }
|
||||
TRAPABRT() { endgame ABORT }
|
||||
TRAPKILL() { endgame KILL }
|
||||
TRAPPIPE() { endgame PIPE }
|
||||
TRAPTERM() { endgame TERM }
|
||||
TRAPSTOP() { endgame STOP }
|
||||
|
||||
_have_shm() {
|
||||
# Check availability of 1MB of SHM
|
||||
_verbose "_have_shm 0 We need only 1 MB of RAM."
|
||||
@ -1249,6 +1266,7 @@ dig_tomb() {
|
||||
chown $_uid:$_gid "${tombdir}/${tombfile}"
|
||||
|
||||
_verbose "Data dump using ${DD[1]} from /dev/urandom"
|
||||
|
||||
${=DD} if=/dev/urandom bs=1048576 count=${tombsize} of=${tombdir}/${tombfile}
|
||||
|
||||
if [ $? = 0 -a -e ${tombdir}/${tombfile} ]; then
|
||||
@ -2313,8 +2331,8 @@ slam_tomb() {
|
||||
# }}} - Tomb close
|
||||
|
||||
# {{{ Main routine
|
||||
|
||||
main() {
|
||||
|
||||
local -A subcommands_opts
|
||||
### Options configuration
|
||||
|
||||
@ -2580,6 +2598,7 @@ EOF
|
||||
# {{{ Run
|
||||
check_bin
|
||||
|
||||
|
||||
main $@
|
||||
ret=$?
|
||||
if [[ $ret != 0 ]]; then #this "if" seems useless, but avoid source tomb source from exiting
|
||||
|
Loading…
Reference in New Issue
Block a user