]> /dev/null || true ]]> /dev/null 2>&1 && [ "$attempts" -gt 0 ]; do sleep 1 attempts=$((attempts - 1)) done if pidof vault >/dev/null 2>&1; then echo "Vault daemon did not exit gracefully; forcing shutdown..." killall -9 vault 2>/dev/null || true sleep 1 fi # Stale pidfile would block the post-install start step. rm -f /var/run/vault.pid ]]> &bundleURL; &sha256; "$CONFIG" <<'CFGEOF' PORT=24085 BIND_ADDRESS=127.0.0.1 # SNAPSHOT_PATH – Custom snapshot location (set by the daemon; do not edit manually) CFGEOF fi # Create data directory mkdir -p /boot/config/plugins/vault # Ensure permissions chmod 755 /usr/local/sbin/vault chmod 755 /etc/rc.d/rc.vault # Restart cleanly: stop any leftover daemon (e.g. from an aborted previous # upgrade) before starting the new binary. This guarantees the user is # running the just-installed version without requiring a server reboot. /etc/rc.d/rc.vault stop 2>/dev/null || true /etc/rc.d/rc.vault start echo "Vault plugin installed successfully" ]]> /dev/null || true # Wait for the daemon to finish any final snapshot flush before cleanup. attempts=20 while pidof vault >/dev/null 2>&1 && [ "$attempts" -gt 0 ]; do sleep 1 attempts=$((attempts - 1)) done if pidof vault >/dev/null 2>&1; then killall -9 vault 2>/dev/null || true sleep 1 fi # Remove installed package files PACKAGE="" for pkg in /var/log/packages/vault-*; do [ -e "$pkg" ] || continue PACKAGE="$(basename "$pkg")" done if [ -z "$PACKAGE" ]; then for pkg in /boot/config/plugins/vault/vault-*.txz /boot/config/plugins/vault/vault-*.tgz; do [ -e "$pkg" ] || continue case "$pkg" in *.txz) PACKAGE="$(basename "$pkg" .txz)" ;; *.tgz) PACKAGE="$(basename "$pkg" .tgz)" ;; esac done fi if [ -x "$DAEMON" ]; then "$DAEMON" cleanup-uninstall \ --db="$DB" \ --config-dir="$CONFIG_DIR" \ --binary-path="$DAEMON" \ --rc-script="/etc/rc.d/rc.vault" \ --plugin-dir="/usr/local/emhttp/plugins/vault" \ --log-path="/var/log/vault.log" \ --pid-file="/var/run/vault.pid" \ --hybrid-working-dir="/var/local/vault" \ --snapshot-path="/mnt/cache/.vault/vault.db" \ || echo "Vault uninstall cleanup reported a warning; continuing with package removal" fi if [ -n "$PACKAGE" ]; then removepkg "$PACKAGE" 2>/dev/null || true fi # Fallback cleanup if the binary was already missing. rm -f "$DAEMON" rm -f /etc/rc.d/rc.vault rm -rf /usr/local/emhttp/plugins/vault rm -f /var/log/vault.log rm -f /var/run/vault.pid rm -rf /boot/config/plugins/vault/*.txz rm -rf /boot/config/plugins/vault/*.tgz echo "Vault plugin removed" ]]>