installer / updates

This commit is contained in:
legop3
2026-11-16 23:08:30 -05:00
parent 91c9194856
commit 9626389dbe
16 changed files with 156 additions and 116 deletions
+23 -6
View File
@@ -1,18 +1,35 @@
#!/usr/bin/env bash
# Installs from an existing checkout. Standalone bootstrap is a later stage.
# Shared installation path for bootstrap and self-update.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "$REPO_ROOT"
[[ $EUID == 0 ]] || { echo 'Run as root' >&2; exit 1; }
case "$(dpkg --print-architecture)" in
amd64) arch=amd64 ;; arm64) arch=arm64 ;; armhf) arch=armv6 ;;
amd64) arch=amd64 ;; arm64) arch=arm64 ;;
armhf) case "$(uname -m)" in armv6*) arch=armv6 ;; *) arch=armv7 ;; esac ;;
*) echo 'Unsupported OS architecture' >&2; exit 1 ;;
esac
install -m 0755 "dist/roverd-linux-$arch" /usr/local/bin/roverd
# Rename avoids overwriting an executable that the running service has mapped.
install -m 0755 "dist/roverd-linux-$arch" /usr/local/bin/roverd.new
mv -f /usr/local/bin/roverd.new /usr/local/bin/roverd
apt-get update
apt-get install -y git ca-certificates python3 util-linux
install -d /etc/roverd/profiles /var/lib/roverd
if [[ ! -f /etc/roverd.json ]]; then
/usr/local/bin/roverd -print-default-config > /etc/roverd.json
chmod 600 /etc/roverd.json
/usr/local/bin/roverd -print-default-config > /etc/roverd.json.new
chmod 600 /etc/roverd.json.new
python3 - <<'PYCONFIG'
import json, os
path = '/etc/roverd.json.new'
with open(path) as f:
config = json.load(f)
config['name'] = os.environ.get('ROVERD_INITIAL_NAME', config['name'])
config['serverUrl'] = os.environ.get('ROVERD_INITIAL_SERVER', config['serverUrl'])
with open(path, 'w') as f:
json.dump(config, f, indent=2)
PYCONFIG
/usr/local/bin/roverd -config /etc/roverd.json.new -check-config
mv /etc/roverd.json.new /etc/roverd.json
echo 'Set name, serverUrl, devices, and enabled profiles in /etc/roverd.json before starting roverd.'
fi
install -m 0644 rover/systemd/roverd.service /etc/systemd/system/roverd.service
@@ -26,4 +43,4 @@ source rover/install/self_update.sh
install_self_update_support
systemctl daemon-reload
systemctl enable roverd.service
echo 'Installed. Run systemctl restart roverd after configuring this rover.'
echo 'Installation complete; caller can now restart roverd.'