forked from gwsystems/composite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcos
executable file
·82 lines (71 loc) · 1.33 KB
/
cos
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/sh
script=
name=
binary=
build()
{
if ! [ -r "src/.PLATFORM_ID" ]; then
echo "Must \"cos init\" before \"cos build\"."
exit 2
fi
echo "[cos executing] make -C src all"
make -C src all
}
clean()
{
echo "[cos executing] make -C clean"
make -C src clean
}
distclean()
{
echo "[cos executing] make -C distclean"
make -C src distclean
}
initialize()
{
echo "[cos executing] make -C src config init"
make -C src config init
}
usage()
{
echo "Usage: " $0 " init|build|reset|compose <script> <output name>|run <binary>"
exit 2
}
compose()
{
if [ -z "$script" ] || [ -z "$name" ]; then
usage
fi
if ! [ -e "src/composer/target/debug/compose" ]; then
echo "Must \"cos build\" before composition. Could not find src/composer/target/debug/compose"
exit 2
fi
echo "[cos executing] src/composer/target/debug/compose $script $name"
src/composer/target/debug/compose $script $name
}
run()
{
if [ -z "$binary" ]; then
usage
fi
echo "[cos executing] tools/run.sh $binary"
tools/run.sh $binary
}
case $1 in
init ) initialize
;;
build ) build
;;
reset ) clean
;;
distclean ) distclean
;;
compose ) script=$2
name=$3
compose
;;
run ) binary=$2
run
;;
* ) usage
esac