File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,19 +4,30 @@ set -eo pipefail
44readonly DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
55readonly ROOT_DIR=" $( dirname " $DIR " ) "
66mkdir -p " $ROOT_DIR /public/data"
7+
78readonly FEATURES_FILE=" $ROOT_DIR /public/data/features.json"
89readonly TEMPLATES_FILE=" $ROOT_DIR /public/data/templates.json"
910readonly IMAGE_TAGS_FILE=" $ROOT_DIR /public/data/imageTags.json"
1011
11- deploy_skopeo () {
12- echo " Skopeo could not be found. Installing via apt-get..."
12+ ensure_installed () {
13+ local pkg=" $1 "
14+ command -v " $pkg " & > /dev/null && return
15+ echo " $pkg could not be found. Installing via apt-get..."
1316 local apt_cmd=" apt-get"
1417 command -v sudo & > /dev/null && apt_cmd=" sudo apt-get"
15- DEBIAN_FRONTEND=noninteractive $apt_cmd update && $apt_cmd install -y skopeo
18+ DEBIAN_FRONTEND=noninteractive $apt_cmd update && $apt_cmd install -y " $pkg "
1619}
1720
1821if ! command -v skopeo & > /dev/null; then
19- deploy_skopeo
22+ ensure_installed skopeo
23+ fi
24+
25+ if ! command -v jq & > /dev/null; then
26+ ensure_installed jq
27+ fi
28+
29+ if ! command -v curl & > /dev/null; then
30+ ensure_installed jq
2031fi
2132
2233readonly TMP_DIR=$( mktemp -d)
You can’t perform that action at this time.
0 commit comments