update to use efl svn
[maemo-efl] / trunk / scripts / helper-functions.sh
1 #!/bin/sh
2
3 ###########################################################
4 # Maemo-efl building script
5 # Helper functions for utility scripts.
6 ###########################################################
7
8 COLOR_GOOD="\033[1;32m"
9 COLOR_WARN="\033[1;33m"
10 COLOR_ERROR="\033[1;31m"
11 COLOR_NORMAL="\033[0m"
12
13 # usage <>
14 function usage() {
15     cat << EOF
16
17 Usage: $__this_script [OPTIONS]
18
19 Build script for Maemo EFL debian packages.
20
21 Options:
22     -n           Don't sign packages.
23     -c           Don't update source repositories.
24     -h           Show this usage guide.
25     -s PATH      Specify alternate scratchbox path (default: $__sbox_path).
26     -t A:B:Z     Specify scratchbox building targets (default: all targets installed).
27     -p P1:P2:PN  Specify packges to build (default: build all packages available).
28
29 EOF
30 }
31
32 # error <message>
33 error() {
34     echo -e " ${COLOR_ERROR}* E:${COLOR_NORMAL} $*"
35     exit 1
36 }
37
38 # warn <message>
39 warn() {
40     echo -e " ${COLOR_WARN}* W:${COLOR_NORMAL} $*"
41 }
42
43 # msg <message>
44 msg() {
45     echo -e " ${COLOR_GOOD}*${COLOR_NORMAL} $*"
46 }
47
48 # msg_begin <message>
49 msg_begin() {
50     echo -en " ${COLOR_GOOD}*${COLOR_NORMAL} $* ..."
51 }
52
53 # msg_end <error-code>
54 msg_end() {
55     echo -en "\033[72G"
56     if [ $1 -eq 0 ]; then
57         echo -e "[ ${COLOR_GOOD}ok${COLOR_NORMAL} ]"
58     else
59         echo -e "[${COLOR_ERROR}fail${COLOR_NORMAL}]"
60         exit 1
61     fi
62 }
63
64