diff --git a/scripts/app b/scripts/app index 3979b23..42f046a 100755 --- a/scripts/app +++ b/scripts/app @@ -18,6 +18,7 @@ Commands: stop Stops an installed app start Starts an installed app compose Passes all arguments to docker-compose + ls-installed Lists installed apps EOF } @@ -31,7 +32,7 @@ check_dependencies () { } list_installed_apps() { - cat "${USER_FILE}" | jq -r 'if has("installedApps") then .installedApps else [] end | join("\n")' || true + cat "${USER_FILE}" 2> /dev/null | jq -r 'if has("installedApps") then .installedApps else [] end | join("\n")' || true } # Check dependencies @@ -43,6 +44,13 @@ else command="$1" fi +# Lists installed apps +if [[ "$command" = "ls-installed" ]]; then + list_installed_apps + + exit +fi + if [ -z ${2+x} ]; then show_help exit 1 diff --git a/scripts/update/01-run.sh b/scripts/update/01-run.sh index 890432e..151fafc 100755 --- a/scripts/update/01-run.sh +++ b/scripts/update/01-run.sh @@ -81,6 +81,22 @@ cat < "$UMBREL_ROOT"/statuses/update-status.json EOF docker-compose pull +echo "Updating installed apps" +cat < "$UMBREL_ROOT"/statuses/update-status.json +{"state": "installing", "progress": 60, "description": "Updating installed apps", "updateTo": "$RELEASE"} +EOF +# We can just loop over this once everyone has the latest app script +# "$UMBREL_ROOT/scripts/app" ls-installed +# but for now we need to implement it here manually +USER_FILE="${UMBREL_ROOT}/db/user.json" +list_installed_apps() { + cat "${USER_FILE}" 2> /dev/null | jq -r 'if has("installedApps") then .installedApps else [] end | join("\n")' || true +} +list_installed_apps | while read app; do + echo "${app}..." + scripts/app compose "${app}" pull +done + # Stop existing containers echo "Stopping existing containers" cat < "$UMBREL_ROOT"/statuses/update-status.json