mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-16 19:10:32 +02:00
Better script to check if repo up to date
This commit is contained in:
@@ -22,10 +22,19 @@ for addons in $(bashio::config "addon|keys"); do
|
|||||||
FULLTAG=$(bashio::config "addon[${addons}].fulltag")
|
FULLTAG=$(bashio::config "addon[${addons}].fulltag")
|
||||||
BASENAME=$(basename "https://github.com/$REPOSITORY")
|
BASENAME=$(basename "https://github.com/$REPOSITORY")
|
||||||
|
|
||||||
#Update local version
|
#Create or update local version
|
||||||
|
if [ ! -d /data/$BASENAME ]; then
|
||||||
bashio::log.info "... $SLUG : cloning ${REPOSITORY}"
|
bashio::log.info "... $SLUG : cloning ${REPOSITORY}"
|
||||||
cd /data/
|
cd /data/
|
||||||
git clone "https://github.com/${REPOSITORY}" || cd "/data/${BASENAME}" && git fetch --all && git reset --hard origin/master
|
git clone "https://github.com/${REPOSITORY}"
|
||||||
|
else
|
||||||
|
bashio::log.info "... $SLUG : updating ${REPOSITORY}"
|
||||||
|
cd "/data/$BASENAME"
|
||||||
|
git fetch
|
||||||
|
if [ $(git rev-parse HEAD) !== $(git rev-parse @{u}) ]; then
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#Define the folder addon
|
#Define the folder addon
|
||||||
bashio::log.info "... $SLUG : checking slug exists in repo"
|
bashio::log.info "... $SLUG : checking slug exists in repo"
|
||||||
|
|||||||
Reference in New Issue
Block a user