Skip to content

Commit d3b763a

Browse files
committed
debian: create fastrpc group and add user to it in postinstall
Signed-off-by: Shoudi Li <shoudil@qti.qualcomm.com>
1 parent 9c10b07 commit d3b763a

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

debian/fastrpc-support.postinst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
set -e
3+
4+
case "$1" in
5+
configure)
6+
# Create fastrpc group via systemd-sysusers
7+
if command -v systemd-sysusers >/dev/null 2>&1; then
8+
systemd-sysusers /usr/lib/sysusers.d/fastrpc.conf || true
9+
fi
10+
11+
# Fallback in case systemd-sysusers is unavailable or failed
12+
if ! getent group fastrpc >/dev/null; then
13+
addgroup --system fastrpc
14+
fi
15+
16+
# Add target user to fastrpc group
17+
#
18+
# Do NOT use $USER directly here:
19+
# during package installation, $USER is usually root.
20+
#
21+
# If package is installed via sudo apt install ./xxx.deb,
22+
# SUDO_USER may contain the real invoking user.
23+
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
24+
if getent passwd "$SUDO_USER" >/dev/null; then
25+
usermod -aG fastrpc "$SUDO_USER" || true
26+
fi
27+
fi
28+
;;
29+
esac
30+
31+
#DEBHELPER#
32+
33+
exit 0

0 commit comments

Comments
 (0)