#!/bin/sh
set -eu
# sg checks /etc/group, so installation works in an already logged-in session.
# Keep mudfish-dns as a supplementary group, but restore the original primary
# group so /proc/<pid>/exe access checks allow discovery of the user's apps.
# The fixed command remains unprivileged and cannot be supplied by the caller.
mudfish_dns_primary_group=$(id -gn)
export mudfish_dns_primary_group
exec sg mudfish-dns -c 'exec sg "$mudfish_dns_primary_group" -c /usr/lib/mudfish-dns/mudfish-dns-ui'
