2021-07-01 15:56:15 +02:00
|
|
|
#!/bin/bash
|
2022-11-11 17:31:21 +01:00
|
|
|
|
2021-07-01 15:56:15 +02:00
|
|
|
log="echo -e"
|
|
|
|
|
2021-07-07 16:15:55 +02:00
|
|
|
CURRENT_BRANCH=$(git --git-dir=/home/pi/PlanktoScope/.git rev-parse --abbrev-ref HEAD)
|
2021-07-01 15:56:15 +02:00
|
|
|
REMOTE_BRANCHES=$(git --git-dir=/home/pi/PlanktoScope/.git branch --remotes --list | awk '/HEAD/{next;} split($1, a, "/") {print a[2]}')
|
|
|
|
if [[ $# == 1 ]]; then
|
2021-07-07 16:15:55 +02:00
|
|
|
if [[ $REMOTE_BRANCHES =~ (^|[[:space:]])$1($|[[:space:]]) ]]; then
|
|
|
|
BRANCH="$1"
|
2021-07-01 15:56:15 +02:00
|
|
|
else
|
2021-07-07 16:15:55 +02:00
|
|
|
BRANCH="$CURRENT_BRANCH"
|
2021-07-01 15:56:15 +02:00
|
|
|
fi
|
|
|
|
else
|
2021-07-07 16:15:55 +02:00
|
|
|
BRANCH="$CURRENT_BRANCH"
|
2021-07-01 15:56:15 +02:00
|
|
|
fi
|
2021-07-07 16:15:55 +02:00
|
|
|
${log} "Updating the installer script from $BRANCH"
|
2021-07-01 15:56:15 +02:00
|
|
|
curl "https://raw.githubusercontent.com/PlanktonPlanet/PlanktoScope/$BRANCH/scripts/bash/update.sh" > /tmp/update.sh
|
2021-07-07 16:15:55 +02:00
|
|
|
chmod +x /tmp/update.sh
|
2023-01-19 22:23:42 +01:00
|
|
|
exec /tmp/update.sh "$BRANCH"
|