This repository was archived by the owner on Dec 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrelay.sh
More file actions
executable file
·81 lines (71 loc) · 1.36 KB
/
Copy pathrelay.sh
File metadata and controls
executable file
·81 lines (71 loc) · 1.36 KB
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
verbose() {
if [ -n "$RELAY_VERBOSE" ]
then
echo "$@" >&2
fi
}
info() {
if [ -n "$RELAY_INFO" ]
then
echo "$@" >&2
fi
}
verbose
verbose
while [ $# -gt 0 ]
do
case $1 in
--build-dir)
BUILD_DIR=$2
shift 2
;;
--command-file)
CMD_FILE=$2
shift 2
;;
--target)
TARGET=$2
shift 2
;;
--prerequisites)
shift 1
while [ $# -gt 0 ]
do
case $1 in
--)
shift 1
break
;;
*)
PREREQS="$PREREQS $1"
shift 1
;;
esac
done
;;
--phony)
shift 1
PHONY=True
;;
*)
break
;;
esac
done
info "$@"
verbose Making "$TARGET" with command "$@", with updated prereqs "$PREREQS",\
putting command into "$CMD_FILE", build dir is "$BUILD_DIR"
if [ "$PHONY" = "True" ]
then
verbose We\'re building phony target
fi
CMD="$@"
if [ ! -z $CMD_FILE ]
then
mkdir -p $(dirname $CMD_FILE)
echo "$CMD" > $CMD_FILE
fi
verbose Resulting CMD: "$CMD"
set -e
eval "$CMD" $REDIRECT
set +e