-
Notifications
You must be signed in to change notification settings - Fork 1
/
make.trees.bash
executable file
·55 lines (48 loc) · 1.58 KB
/
make.trees.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/env bash
# Copyright 2017-2019 (c) all rights reserved
# by S D Rausty https://sdrausty.github.io
#####################################################################
set -Eeuo pipefail
shopt -s nullglob globstar
VERSIONID="v2.2"
_STRPERROR_() { # Run on script error.
local RV="$?"
echo Signal "$RV" received!
printf "\\e[?25h\\e[1;7;38;5;0mbuildAPKs %s ERROR: Signal %s received! See \`stnderr*.log files.\`\\e[0m\\n" "${0##*/}" "$RV"
exit 240
}
_STRPEXIT_() { # Run on exit.
local RV="$?"
sleep 0.04
if [[ "$RV" = 0 ]]
then
printf "\\a\\e[0;32m%s %s \\a\\e[0m$VERSIONID\\e[1;34m: \\a\\e[1;32m%s\\e[0m\\n\\n\\a\\e[0m" "${0##*/}" "$ARGS" "DONE 🏁 "
printf "\\e]2; %s: %s \\007" "${0##*/} $ARGS" "DONE 🏁 "
else
printf "\\a\\e[0;32m%s %s \\a\\e[0m$VERSIONID\\e[1;34m: \\a\\e[1;32m%s %s\\e[0m\\n\\n\\a\\e[0m" "${0##*/}" "$ARGS" "[Exit Signal $RV]" "DONE 🏁 "
printf "\033]2; %s: %s %s \\007" "${0##*/} $ARGS" "[Exit Signal $RV]" "DONE 🏁 "
fi
printf "\\e[?25h\\e[0m"
set +Eeuo pipefail
exit
}
__STRPSIGNAL_() { # Run on signal.
printf "\\e[?25h\\e[1;7;38;5;0mbuildAPKs %s WARNING: Signal %s received!\\e[0m\\n" "${0##*/}" "$?"
exit 241
}
_STRPQUIT_() { # Run on quit.
printf "\\e[?25h\\e[1;7;38;5;0mbuildAPKs %s WARNING: Quit signal %s received!\\e[0m\\n" "${0##*/}" "$?"
exit 242
}
if [[ -z "${1:-}" ]]
then
ARGS=""
else
ARGS="$@"
fi
trap '_STRPERROR_ $LINENO $BASH_COMMAND $?' ERR
trap _STRPEXIT_ EXIT
trap _STRPSIGNAL_ HUP INT TERM
trap _STRPQUIT_ QUIT
find -type d -name .git -execdir "$HOME"/buildAPKs/scripts/maintenance/make.tree.bash {} \;
exit $?