-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_utils.sh
More file actions
40 lines (36 loc) · 855 Bytes
/
build_utils.sh
File metadata and controls
40 lines (36 loc) · 855 Bytes
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
#!/bin/bash
set -e
# include this in other bash scripts with the following line:
#
# source "$(dirname "$0")/build_utils.sh"
#
function to_bool() {
local arg="$1"
case "$(echo "$arg" | tr '[:upper:]' '[:lower:]')" in
[0-9]+)
if [ $arg -eq 0 ]; then
echo false
else
echo true
fi
;;
n|no|f|false) echo false ;;
y|yes|t|true) echo true ;;
* )
if [ -n "$arg" ]; then
echo "warning: invalid boolean argument ('$arg'). Expected true or false" >&2
fi
echo false
;;
esac;
}
# Prints a timestamp + title for a step/section
function checkpoint {
local delimiter="--------------------------------------------------------------------------------"
echo ""
echo ""
echo "$delimiter"
echo "--- $(date +'%T') --- $1 "
echo "$delimiter"
echo ""
}