CI / test (push) Successful in 2m26s
- service.v: --install-service / --uninstall-service / --service-status Windows (sc.exe SCM), Linux systemd, Linux openrc — auto-détection OS - main.v: nouveaux flags service, help mis à jour - Dockerfile: multi-stage (V from source → alpine:3.20 minimal) - docker-compose.yml: prêt à l'emploi avec healthcheck - scripts/install.sh: one-liner Linux (detect OS/arch, build, install) - scripts/install.ps1: one-liner Windows PowerShell Docs: ROADMAP Phase 4.5 marqué DONE, version 0.4.5
99 lines
3.0 KiB
Bash
99 lines
3.0 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# ntfy-bridge one-liner installer
|
|
# Usage: curl -fsSL https://git.dracodev.net/bruno/ntfy-bridge/raw/branch/main/scripts/install.sh | bash
|
|
|
|
BINARY="ntfy-bridge"
|
|
REPO="https://git.dracodev.net/bruno/ntfy-bridge"
|
|
INSTALL_DIR="/usr/local/bin"
|
|
CONFIG_DIR="/etc/ntfy-bridge"
|
|
|
|
# Detect OS and architecture
|
|
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
ARCH=$(uname -m)
|
|
|
|
case "$ARCH" in
|
|
x86_64|amd64) ARCH="amd64" ;;
|
|
aarch64|arm64) ARCH="arm64" ;;
|
|
armv7l) ARCH="armv7" ;;
|
|
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
|
|
esac
|
|
|
|
echo "╔══════════════════════════════════════════════════════════════╗"
|
|
echo "║ ntfy-bridge installer ║"
|
|
echo "╚══════════════════════════════════════════════════════════════╝"
|
|
echo ""
|
|
echo " OS: $OS"
|
|
echo " Arch: $ARCH"
|
|
echo ""
|
|
|
|
# Check for required tools
|
|
if ! command -v git >/dev/null 2>&1 && ! command -v curl >/dev/null 2>&1; then
|
|
echo "Error: git or curl is required. Install one of them."
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v make >/dev/null 2>&1 || ! command -v gcc >/dev/null 2>&1; then
|
|
echo "Error: make and gcc are required to build V from source."
|
|
echo " Debian/Ubuntu: sudo apt install build-essential git"
|
|
echo " Alpine: sudo apk add gcc musl-dev make git"
|
|
exit 1
|
|
fi
|
|
|
|
# Build from source
|
|
TMPDIR=$(mktemp -d)
|
|
cd "$TMPDIR"
|
|
|
|
echo "Cloning ntfy-bridge..."
|
|
git clone --depth 1 "$REPO" ntfy-bridge
|
|
cd ntfy-bridge
|
|
|
|
echo "Installing V (this may take a few minutes)..."
|
|
if [ ! -d /opt/v ]; then
|
|
git clone --depth 1 https://github.com/vlang/v /opt/v
|
|
cd /opt/v && make
|
|
fi
|
|
|
|
echo "Building ntfy-bridge..."
|
|
/opt/v/v -prod -o "$BINARY" .
|
|
|
|
echo "Installing binary to $INSTALL_DIR..."
|
|
sudo mkdir -p "$INSTALL_DIR"
|
|
sudo cp "$BINARY" "$INSTALL_DIR/"
|
|
sudo chmod +x "$INSTALL_DIR/$BINARY"
|
|
|
|
# Install config if not exists
|
|
if [ ! -f "$CONFIG_DIR/ntfy-bridge.yaml" ]; then
|
|
echo "Installing example config..."
|
|
sudo mkdir -p "$CONFIG_DIR"
|
|
sudo cp ntfy-bridge.example.yaml "$CONFIG_DIR/ntfy-bridge.yaml"
|
|
sudo cp dashboard.html "$CONFIG_DIR/"
|
|
echo ""
|
|
echo " ⚠️ Edit $CONFIG_DIR/ntfy-bridge.yaml to configure your sources!"
|
|
fi
|
|
|
|
# Install as service
|
|
echo ""
|
|
echo "Installing as system service..."
|
|
sudo "$INSTALL_DIR/$BINARY" --install-service --config "$CONFIG_DIR/ntfy-bridge.yaml"
|
|
|
|
# Cleanup
|
|
cd /
|
|
rm -rf "$TMPDIR"
|
|
|
|
echo ""
|
|
echo "Done! ntfy-bridge is installed and running."
|
|
echo ""
|
|
echo " Config: $CONFIG_DIR/ntfy-bridge.yaml"
|
|
echo " Binary: $INSTALL_DIR/$BINARY"
|
|
echo " Dashboard: http://localhost:9090/"
|
|
echo " Health: http://localhost:9090/health"
|
|
echo ""
|
|
echo " Service:"
|
|
echo " systemctl status ntfy-bridge (systemd)"
|
|
echo " rc-service ntfy-bridge status (openrc)"
|
|
echo ""
|
|
echo " Tail logs:"
|
|
echo " journalctl -u ntfy-bridge -f (systemd)"
|