diff --git a/addons_updater/rootfs/etc/cont-init.d/run b/addons_updater/rootfs/etc/cont-init.d/run index 3ab28792a..e6e07386e 100644 --- a/addons_updater/rootfs/etc/cont-init.d/run +++ b/addons_updater/rootfs/etc/cont-init.d/run @@ -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"