forked from derivative-maker/derivative-maker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
derivative-maker
executable file
·82 lines (65 loc) · 2.8 KB
/
derivative-maker
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
## Copyright (C) 2012 - 2023 ENCRYPTED SUPPORT LP <[email protected]>
## See the file COPYING for copying conditions.
set -x
set -e
true "INFO: Currently running script: $BASH_SOURCE $@"
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$MYDIR"
source ./help-steps/pre
source ./help-steps/colors
error_handler_dist_build_one() {
true "${red}${bold}ERROR in $0${reset}"
true "${red}${bold}BASH_COMMAND${reset}: $BASH_COMMAND"
true "${red}${bold}dist_build_one_build_step_current${reset}: $dist_build_one_build_step_current"
true "${red}\$@: $@${reset}"
true "${red}${bold}INFO: Now exiting from $0 (because error was detected, see above).${reset}"
exit 1
}
trap "error_handler_dist_build_one" ERR
dist_build_machine() {
run-parts --verbose --test ./build-steps.d
## Not using:
#run-parts --verbose --exit-on-error ./build-steps.d
## Because of an issue,
## "run-parts, trap INT, read error":
## https://lists.gnu.org/archive/html/help-bash/2015-03/msg00066.html
for dist_build_one_build_step_current in ./build-steps.d/*; do
if [ -x "$dist_build_one_build_step_current" ]; then
## If the last character is a ~, ignore that file,
## because it was created by some editor,
## which creates backup files.
if [ "${dist_build_one_build_step_current: -1}" = "~" ]; then
continue
fi
## Skipping files such as .dpkg-old and .dpkg-dist.
if ( echo "$dist_build_one_build_step_current" | grep -q ".dpkg-" ); then
true "skip $dist_build_one_build_step_current"
continue
fi
true "${cyan}${bold}${under}############################################################${reset}"
true "${cyan}${bold}${under}############################################################${reset}"
true "${cyan}${bold}${under}############################################################${reset}"
true "${cyan}${bold}${under}INFO: BEGIN: dist_build_one_build_step_current: $dist_build_one_build_step_current${reset}"
"./$dist_build_one_build_step_current" "$@"
true "${cyan}${bold}${under}INFO: END : dist_build_one_build_step_current: $dist_build_one_build_step_current${reset}"
true "${cyan}${bold}${under}############################################################${reset}"
true "${cyan}${bold}${under}############################################################${reset}"
true "${cyan}${bold}${under}############################################################${reset}"
fi
done
}
main() {
if [ "$1" = "--help" ]; then
./help-steps/parse-cmd --help
exit 0
fi
root_check
## XXX
trap "error_handler_dist_build_one" ERR
trap - INT
trap - TERM
dist_build_machine "$@"
true
}
main "$@"