Added optional command line parameter (-h) to specify an alternative config file.
intrigeri
18 years ago
65 | 65 | |
66 | 66 | " |
67 | 67 | |
68 | if [ -f /etc/metche.conf ]; then | |
69 | . /etc/metche.conf | |
68 | function display_usage { | |
69 | ( echo "Usage: $0 [-h HOST] list" | |
70 | echo " $0 [-h HOST] report [milestone]" | |
71 | echo " $0 [-h HOST] cron" | |
72 | echo "If -h is specified, /etc/metche/HOST.conf is used instead of /etc/metche.conf and" | |
73 | echo "./metche.conf, which are tried in this order before falling back to the hardcoded" | |
74 | echo "defaults." | |
75 | ) >&2 | |
76 | } | |
77 | ||
78 | if [ "x$1" == "x-h" ]; then | |
79 | if [ -f /etc/metche/$2.conf ]; then | |
80 | . /etc/metche/$2.conf | |
81 | CMD="$3" | |
82 | MILESTONE="$4" | |
83 | else | |
84 | display_usage | |
85 | exit 1 | |
86 | fi | |
70 | 87 | else |
71 | . metche.conf | |
88 | if [ -f /etc/metche.conf ]; then | |
89 | . /etc/metche.conf | |
90 | elif [ -f metche.conf ]; then | |
91 | . metche.conf | |
92 | fi | |
93 | CMD="$1" | |
94 | MILESTONE="$2" | |
72 | 95 | fi |
73 | 96 | |
74 | 97 | PATH="/bin:/usr/bin" |
207 | 230 | save_state "testing" |
208 | 231 | fi |
209 | 232 | |
210 | case "$1" in | |
233 | case "$CMD" in | |
211 | 234 | report) |
212 | if [ "x$2" == "x" ]; then | |
235 | if [ "x$MILESTONE" == "x" ]; then | |
213 | 236 | report_changes "testing-latest" |
214 | 237 | else |
215 | report_changes "testing-$2" | |
238 | report_changes "testing-$MILESTONE" | |
216 | 239 | fi |
217 | 240 | exit 0 |
218 | 241 | ;; |
251 | 274 | fi |
252 | 275 | ;; |
253 | 276 | *) |
254 | (echo "Usage: $0 list" | |
255 | echo " $0 report [milestone]" | |
256 | echo " $0 cron" | |
257 | ) >&2 | |
277 | display_usage | |
258 | 278 | exit 1 |
259 | 279 | ;; |
260 | 280 | esac |