refactor!: rename the project from Monitor to MoShiro [CI]
ci/woodpecker/push/main-amd64-build Pipeline was successful
ci/woodpecker/push/main-amd64-build Pipeline was successful
Namespaces, assemblies, solution, binaries, images, systemd units, config paths, environment variables, protocol methods and the Linux user are all renamed. Breaking: existing databases, node identities and installed units must be recreated.
This commit is contained in:
1 parent
27ac7fb787
commit
2e146d4da7
309 files changed
+1565
-1572
No files matched your search
@@ -30,8 +30,8 @@ case "$POLICY" in auto|manual) ;; *) echo "--policy must be auto or manual" >&2;
|
||||
case "$ENGINE" in podman|docker) ;; *) echo "--engine must be podman or docker" >&2; exit 2 ;; esac
|
||||
if [ -n "$DATA_VOLUME" ]; then
|
||||
[ -z "$DATA_DIR" ] || { echo "use --volume or --data-dir, not both" >&2; exit 2; }
|
||||
[ -n "$HELPER_IMAGE" ] || { echo "--volume needs --helper-image (an already pulled Monitor image)" >&2; exit 2; }
|
||||
STATUS_VOLUME="${STATUS_VOLUME:-monitor-$COMPONENT-status}"
|
||||
[ -n "$HELPER_IMAGE" ] || { echo "--volume needs --helper-image (an already pulled MoShiro image)" >&2; exit 2; }
|
||||
STATUS_VOLUME="${STATUS_VOLUME:-moshiro-$COMPONENT-status}"
|
||||
"$ENGINE" image inspect "$HELPER_IMAGE" >/dev/null
|
||||
"$ENGINE" volume inspect "$DATA_VOLUME" >/dev/null 2>&1 || "$ENGINE" volume create "$DATA_VOLUME" >/dev/null
|
||||
"$ENGINE" volume inspect "$STATUS_VOLUME" >/dev/null 2>&1 || "$ENGINE" volume create "$STATUS_VOLUME" >/dev/null
|
||||
@@ -42,15 +42,15 @@ fi
|
||||
if [ "$SERVICE_SCOPE" = user ]; then
|
||||
[ "$(id -u)" -ne 0 ] || { echo "--user must run as the rootless Podman user, without sudo" >&2; exit 1; }
|
||||
[ "$ENGINE" = podman ] || { echo "--user currently supports rootless Podman; Docker uses system services" >&2; exit 2; }
|
||||
CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/monitor"
|
||||
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/monitor-update"
|
||||
CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/moshiro"
|
||||
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/moshiro-update"
|
||||
UNIT_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
|
||||
BIN_DIR="$HOME/.local/bin"
|
||||
TARGET=default.target
|
||||
else
|
||||
[ "$(id -u)" -eq 0 ] || { echo "system installation needs root; use --user for rootless Podman" >&2; exit 1; }
|
||||
CONF_DIR=/etc/monitor-update
|
||||
STATE_DIR=/var/lib/monitor-update
|
||||
CONF_DIR=/etc/moshiro-update
|
||||
STATE_DIR=/var/lib/moshiro-update
|
||||
UNIT_DIR=/etc/systemd/system
|
||||
BIN_DIR=/usr/local/sbin
|
||||
TARGET=multi-user.target
|
||||
@@ -64,8 +64,8 @@ unit_escape() { printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g'; }
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
install -d -m 755 "$CONF_DIR" "$STATE_DIR" "$UNIT_DIR" "$BIN_DIR"
|
||||
BIN="$BIN_DIR/monitor-update"
|
||||
install -m 755 "$HERE/monitor-update.sh" "$BIN"
|
||||
BIN="$BIN_DIR/moshiro-update"
|
||||
install -m 755 "$HERE/moshiro-update.sh" "$BIN"
|
||||
install -m 644 "$HERE/release-key.pub.pem" "$CONF_DIR/release-key.pub.pem"
|
||||
if [ -n "$DATA_VOLUME" ]; then
|
||||
: # Named volumes are initialized by the image; no host directory or chown needed.
|
||||
@@ -92,49 +92,49 @@ PUBKEY="$CONF_DIR/release-key.pub.pem"
|
||||
chmod 600 "$CONF_DIR/$COMPONENT.conf"
|
||||
|
||||
if [ -n "$DATA_VOLUME" ]; then
|
||||
cat > "$UNIT_DIR/monitor-update-$COMPONENT.service" <<UNITFILE
|
||||
cat > "$UNIT_DIR/moshiro-update-$COMPONENT.service" <<UNITFILE
|
||||
[Unit]
|
||||
Description=Check/apply signed volume update for monitor-$COMPONENT
|
||||
Description=Check/apply signed volume update for moshiro-$COMPONENT
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
TimeoutStartSec=300
|
||||
Environment="MONITOR_UPDATE_CONF_DIR=$(unit_escape "$CONF_DIR")"
|
||||
Environment="MOSHIRO_UPDATE_CONF_DIR=$(unit_escape "$CONF_DIR")"
|
||||
ExecStart="$(unit_escape "$BIN")" check $COMPONENT
|
||||
UNITFILE
|
||||
cat > "$UNIT_DIR/monitor-update-$COMPONENT.timer" <<UNITFILE
|
||||
cat > "$UNIT_DIR/moshiro-update-$COMPONENT.timer" <<UNITFILE
|
||||
[Unit]
|
||||
Description=Poll the update volume for monitor-$COMPONENT
|
||||
Description=Poll the update volume for moshiro-$COMPONENT
|
||||
|
||||
[Timer]
|
||||
OnBootSec=10s
|
||||
OnUnitInactiveSec=30s
|
||||
Unit=monitor-update-$COMPONENT.service
|
||||
Unit=moshiro-update-$COMPONENT.service
|
||||
|
||||
[Install]
|
||||
WantedBy=$TARGET
|
||||
UNITFILE
|
||||
else
|
||||
for action in check apply; do
|
||||
cat > "$UNIT_DIR/monitor-update-$action-$COMPONENT.service" <<UNITFILE
|
||||
cat > "$UNIT_DIR/moshiro-update-$action-$COMPONENT.service" <<UNITFILE
|
||||
[Unit]
|
||||
Description=$action the signed update for monitor-$COMPONENT
|
||||
Description=$action the signed update for moshiro-$COMPONENT
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
TimeoutStartSec=300
|
||||
Environment="MONITOR_UPDATE_CONF_DIR=$(unit_escape "$CONF_DIR")"
|
||||
Environment="MOSHIRO_UPDATE_CONF_DIR=$(unit_escape "$CONF_DIR")"
|
||||
ExecStart="$(unit_escape "$BIN")" $action $COMPONENT
|
||||
UNITFILE
|
||||
watched=offer.sig
|
||||
[ "$action" != apply ] || watched=apply.request
|
||||
cat > "$UNIT_DIR/monitor-update-$action-$COMPONENT.path" <<UNITFILE
|
||||
cat > "$UNIT_DIR/moshiro-update-$action-$COMPONENT.path" <<UNITFILE
|
||||
[Unit]
|
||||
Description=Watch $action events for monitor-$COMPONENT
|
||||
Description=Watch $action events for moshiro-$COMPONENT
|
||||
|
||||
[Path]
|
||||
PathChanged=$DATA_DIR/update/$watched
|
||||
Unit=monitor-update-$action-$COMPONENT.service
|
||||
Unit=moshiro-update-$action-$COMPONENT.service
|
||||
|
||||
[Install]
|
||||
WantedBy=$TARGET
|
||||
@@ -144,11 +144,11 @@ fi
|
||||
if [ "$ENABLE" = true ]; then
|
||||
service_ctl daemon-reload
|
||||
if [ -n "$DATA_VOLUME" ]; then
|
||||
service_ctl disable --now "monitor-update-check-$COMPONENT.path" "monitor-update-apply-$COMPONENT.path" >/dev/null 2>&1 || true
|
||||
service_ctl enable --now "monitor-update-$COMPONENT.timer"
|
||||
service_ctl disable --now "moshiro-update-check-$COMPONENT.path" "moshiro-update-apply-$COMPONENT.path" >/dev/null 2>&1 || true
|
||||
service_ctl enable --now "moshiro-update-$COMPONENT.timer"
|
||||
else
|
||||
service_ctl disable --now "monitor-update-$COMPONENT.timer" >/dev/null 2>&1 || true
|
||||
service_ctl enable --now "monitor-update-check-$COMPONENT.path" "monitor-update-apply-$COMPONENT.path"
|
||||
service_ctl disable --now "moshiro-update-$COMPONENT.timer" >/dev/null 2>&1 || true
|
||||
service_ctl enable --now "moshiro-update-check-$COMPONENT.path" "moshiro-update-apply-$COMPONENT.path"
|
||||
fi
|
||||
fi
|
||||
echo "updater installed for $COMPONENT (engine: $ENGINE, scope: $SERVICE_SCOPE, policy: $POLICY)"
|
||||
|
||||
Reference in new issue
Block a user