forked from turnkeylinux/buildtasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bt-batch
executable file
·44 lines (35 loc) · 1.17 KB
/
bt-batch
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
#!/bin/bash -e
# Copyright (c) 2011-2015 TurnKey GNU/Linux - http://www.turnkeylinux.org
#
# This file is part of buildtasks.
#
# Buildtasks is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
fatal() { echo "FATAL [$(basename $0)]: $@" 1>&2; exit 1; }
info() { echo "INFO [$(basename $0)]: $@"; }
usage() {
cat<<EOF
Syntax: $(basename $0) task appliance.list
Batch processing (used pre-cloudtasks)
Arguments:
task - build task to execute (e.g. bt-maintenance)
appliance.list - path to file containing appliance names
one appliance name per line
lines starting with # are ignored
EOF
exit 1
}
if [[ "$#" != "2" ]]; then
usage
fi
task=$1
list=$2
[ -x "$task" ] || fatal "$task does not exist or not executable"
[ -e "$list" ] || fatal "$list does not exist"
for appname in $(cat $list | grep -v "^#"); do
info "STARTING: $task $appname"
./$task --publish $appname
info "FINISHED: $task $appname"
done