Get current from addon

This commit is contained in:
Alexandre
2021-01-31 04:17:26 +01:00
committed by GitHub
parent edae5ac0c5
commit 3f50208db1

View File

@@ -18,10 +18,21 @@ for addons in $(bashio::config "addon|keys"); do
SLUG=$(bashio::config "addon[${addons}].slug")
REPOSITORY=$(bashio::config "addon[${addons}].repository")
UPSTREAM=$(bashio::config "addon[${addons}].upstream")
CURRENT=$(bashio::config "addon[${addons}].current")
BETA=$(bashio::config "addon[${addons}].beta")
BASENAME=$(basename "https://github.com/$REPOSITORY")
bashio::log.info "... $SLUG : check started"
#Update local version
bashio::log.info "... $SLUG : cloning ${REPOSITORY}"
cd /
git clone "https://github.com/${REPOSITORY}" || cd "/${BASENAME}" && git fetch --all && git reset --hard origin/master
#Define the folder addon
bashio::log.info "... $SLUG : checking slug exists in repo"
cd /${BASENAME}/${SLUG} || bashio::log.error "$SLUG addon not found in this repository. Exiting." exit
#Find current version
bashio::log.info "... $SLUG : get current version"
CURRENT=$(jq .version config.json) || bashio::log.error "$SLUG addon version in config.json not found. Exiting." exit
#If beta flag, select beta version
if [ ${BETA} = true ]; then
@@ -35,15 +46,7 @@ for addons in $(bashio::config "addon|keys"); do
if [ ${CURRENT} != ${LASTVERSION} ]; then
bashio::log.info "... $SLUG : update from $CURRENT to $LASTVERSION"
#Update local version
bashio::log.info "... $SLUG : cloning base repo"
cd /
git clone "https://github.com/${REPOSITORY}" || cd "/${BASENAME}" && git fetch --all && git reset --hard origin/master
#Define the folder addon
bashio::log.info "... $SLUG : checking exists in repo"
cd /${BASENAME}/${SLUG} || bashio::log.error "$SLUG addon not found in this repository. Exiting." exit
#Change all instances of version
bashio::log.info "... $SLUG : updating files"