-
Notifications
You must be signed in to change notification settings - Fork 2
/
addmodel.sh
20 lines (16 loc) · 959 Bytes
/
addmodel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
if [ -z "$1" ]; then
echo "Please provide a model as an argument."
exit 1
fi
model="$1"
baseurl="https://raw.githubusercontent.com/PeterSuh-Q3/tcrp-modules/master" # Base URL
ls -d */ | while IFS= read -r dir; do
echo "Adding model $model for ${dir}rpext-index.json"
jsonfile="./${dir}rpext-index.json"
model_url="${baseurl}/${dir}recipes/universal.json"
jq --arg model "${model}_42218" --arg url "$model_url" '.releases += { ($model): $url }' "$jsonfile" > temp.json && mv temp.json "$jsonfile"
jq --arg model "${model}_42962" --arg url "$model_url" '.releases += { ($model): $url }' "$jsonfile" > temp.json && mv temp.json "$jsonfile"
jq --arg model "${model}_64570" --arg url "$model_url" '.releases += { ($model): $url }' "$jsonfile" > temp.json && mv temp.json "$jsonfile"
jq --arg model "${model}_69057" --arg url "$model_url" '.releases += { ($model): $url }' "$jsonfile" > temp.json && mv temp.json "$jsonfile"
done