Skip to content

Commit a4c4887

Browse files
committed
Adding deps
1 parent 5142d7c commit a4c4887

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

scripts/update-data.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,30 @@ set -eo pipefail
44
readonly DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
readonly ROOT_DIR="$(dirname "$DIR")"
66
mkdir -p "$ROOT_DIR/public/data"
7+
78
readonly FEATURES_FILE="$ROOT_DIR/public/data/features.json"
89
readonly TEMPLATES_FILE="$ROOT_DIR/public/data/templates.json"
910
readonly 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

1821
if ! 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
2031
fi
2132

2233
readonly TMP_DIR=$(mktemp -d)

0 commit comments

Comments
 (0)