1 |
cnh |
1.1 |
#!/bin/sh -f |
2 |
|
|
# |
3 |
|
|
# Functions used by the build_pkg shell script. |
4 |
|
|
# |
5 |
|
|
# |
6 |
|
|
check_action() { |
7 |
|
|
theaction=$1 |
8 |
|
|
therc=1 |
9 |
|
|
if [ "x$theaction" == "xbuild" ]; then |
10 |
|
|
therc=0 |
11 |
|
|
fi |
12 |
|
|
if [ "x$theaction" == "xclean" ]; then |
13 |
|
|
therc=0 |
14 |
|
|
fi |
15 |
|
|
if [ "x$therc" == "x1" ]; then |
16 |
|
|
write_usage |
17 |
|
|
exit $therc |
18 |
|
|
fi |
19 |
|
|
} |
20 |
|
|
|
21 |
|
|
check_rc_exit() { |
22 |
|
|
therc=$1 |
23 |
|
|
thecommand=$2 |
24 |
|
|
themessage=$3 |
25 |
|
|
if [ "x$therc" != "x0" ]; then |
26 |
|
|
echo "$themessage" |
27 |
|
|
echo " Command:" |
28 |
|
|
echo " >>" "$thecommand" |
29 |
|
|
echo " Error:" |
30 |
|
|
cat ${STDERR} | awk '{print " >> ",$0}' |
31 |
|
|
echo "\"$0\" exiting with return code $rc" |
32 |
|
|
exit $rc |
33 |
|
|
fi |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
is_comment_line() { |
38 |
|
|
line=$1 |
39 |
|
|
if [ "x${line:0:1}" != "x#" ] && [ "x${line:0:1}" != "x" ]; then |
40 |
|
|
return 0 |
41 |
|
|
else |
42 |
|
|
return 1 |
43 |
|
|
fi |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
write_usage() { |
47 |
|
|
echo "Usage: $0 [build|clean]" |
48 |
|
|
} |
49 |
|
|
|