#!/bin/sh set -e case "$1" in configure) # Create system user and group if they don't exist. if ! getent group maglevd > /dev/null 2>&1; then addgroup --system --quiet maglevd fi if ! getent passwd maglevd > /dev/null 2>&1; then adduser --system --no-create-home --shell /usr/sbin/nologin \ --ingroup maglevd --quiet maglevd fi # Add maglevd to vpp group if it exists (needed for VPP API socket access). if getent group vpp > /dev/null 2>&1; then adduser --quiet maglevd vpp || true fi # Upgrade path: older versions of this package shipped the # daemon unit as vpp-maglevd.service. Stop and disable it so # the rename to vpp-maglev.service takes effect cleanly; the # old unit file itself is removed automatically because the # new package no longer owns it. if systemctl list-unit-files vpp-maglevd.service > /dev/null 2>&1; then systemctl stop vpp-maglevd.service || true systemctl disable vpp-maglevd.service || true fi systemctl daemon-reload || true systemctl enable vpp-maglev.service || true # vpp-maglev-frontend is intentionally NOT enabled here: the # operator decides whether to expose the web dashboard. Enable # with: systemctl enable --now vpp-maglev-frontend ;; esac