#!/usr/bin/env bash # Download this file and run it with sudo; no existing checkout is needed. set -euo pipefail [[ $EUID == 0 ]] || { echo 'Run with sudo bash bootstrap.sh' >&2; exit 1; } # Existing installations keep their identity; only fresh hosts need prompts. if [[ ! -f /etc/roverd.json && ! -f /etc/roverd.yaml ]]; then read -r -p 'Rover name: ' rover_name &2; exit 1; } export ROVERD_INITIAL_NAME="$rover_name" ROVERD_INITIAL_SERVER="$server_address" fi apt-get update apt-get install -y git ca-certificates python3 python3-yaml # The old installer used /opt/roverd for speech assets, not a checkout. if [[ -d /opt/roverd && ! -e /opt/roverd/.git ]]; then rm -rf -- /opt/roverd/googletts # Refuse to erase unrelated contents in a directory that is not a checkout. rmdir /opt/roverd fi if [[ ! -e /opt/roverd ]]; then git clone https://github.com/legop3/MultiRoombaRover.git /opt/roverd fi [[ -d /opt/roverd/.git ]] || { echo '/opt/roverd must be a repository checkout' >&2; exit 1; } git -C /opt/roverd pull --ff-only export ROVERD_MIGRATE=1 bash /opt/roverd/rover/install_roverd.sh systemctl restart roverd