forked from PX4/PX4-gazebo-models
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fuel_upload.sh
executable file
·35 lines (24 loc) · 990 Bytes
/
fuel_upload.sh
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
#!/bin/bash
PREV=$1
CURR=$2
FUEL_TOKEN=$3
mod_list=$(git diff $PREV $CURR --name-status)
prev_model=
while IFS= read -r line; do
type=$(echo "$line" | awk -F'/' '{print $1}' | awk -F' ' '{print $2}')
model=$(echo "$line" | awk -F'/' '{print $2}')
# Delete the model from if it exists and is encountered for the first time.
if [[ $model != $prev_model ]] && ([[ $type == "models" ]] || [[ $type == "worlds" ]]); then
echo "Trying to delete $type/$model from fuel server"
gz fuel delete --header "Private-token: $FUEL_TOKEN" --url https://fuel.gazebosim.org/1.0/PX4/$type/$model -o PX4
# If you want to modify or add a model, reupload it.
if [[ "$line" == "A"* || "$line" == "M"* ]]; then
echo "Uploading $type/$model to fuel server"
gz fuel upload -m ./$type/$model -o PX4 --header "Private-token: $FUEL_TOKEN" --url https://fuel.gazebosim.org
fi
prev_model=$model
else
# If the model is just to be deleted, continue.
continue
fi
done <<< "$mod_list"