#!/bin/bash # # Purpose : Keep Supermarket current (run by CoreDesktop's `update` after it # pulls this repository, and by install.sh). Doesn't prompt. set -e SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=lib.sh source "$SELF/lib.sh" if ! command -v docker > /dev/null || ! docker info > /dev/null 2>&1; then echo "Supermarket: Docker isn't running, or you can't use it yet; skipping." echo " Start it with: sudo systemctl start docker (and log out and in once if you were just added to the docker group)." exit 1 fi write_compose_env copy_core_conf write_ai_servers # The `supermarket` command mkdir -p "$HOME/.local/bin" if [ -f "$COREDESKTOP/utils.sh" ]; then # shellcheck source=/dev/null source "$COREDESKTOP/utils.sh" install_script "$SELF/bin/supermarket" "$HOME/.local/bin/supermarket" else install -m 755 "$SELF/bin/supermarket" "$HOME/.local/bin/supermarket" fi echo "Supermarket $(version): building and starting its container..." compose up -d --build --remove-orphans --quiet-pull # Drop the image the rebuild replaced. docker image prune -f --filter label=org.opencontainers.image.title=supermarket > /dev/null if wait_until_up 60; then echo "Supermarket is running at $URL" else echo "Supermarket didn't start; see: supermarket logs" exit 1 fi