mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-upf.git
synced 2025-10-23 00:02:03 +00:00
Do not attempt to change permissions/ownership if the package gets upgraded from a version higher than the next release. Do not fail if the user deleted the config file. Be verbose when changing permissions. Related: OS#4107 Change-Id: I8994759df644d6edd8f937051b95690537b749be
39 lines
993 B
Bash
Executable File
39 lines
993 B
Bash
Executable File
#!/bin/sh -e
|
|
case "$1" in
|
|
configure)
|
|
# Create the osmocom group and user (if it doesn't exist yet)
|
|
if ! getent group osmocom >/dev/null; then
|
|
groupadd --system osmocom
|
|
fi
|
|
if ! getent passwd osmocom >/dev/null; then
|
|
useradd \
|
|
--system \
|
|
--gid osmocom \
|
|
--home-dir /var/lib/osmocom \
|
|
--shell /sbin/nologin \
|
|
--comment "Open Source Mobile Communications" \
|
|
osmocom
|
|
fi
|
|
|
|
# Fix permissions of previous (root-owned) install (OS#4107)
|
|
if dpkg --compare-versions "$2" le "0.2.0"; then
|
|
if [ -e /etc/osmocom/osmo-upf.cfg ]; then
|
|
chown -v osmocom:osmocom /etc/osmocom/osmo-upf.cfg
|
|
chmod -v 0660 /etc/osmocom/osmo-upf.cfg
|
|
fi
|
|
|
|
if [ -d /etc/osmocom ]; then
|
|
chown -v root:osmocom /etc/osmocom
|
|
chmod -v 2775 /etc/osmocom
|
|
fi
|
|
|
|
mkdir -p /var/lib/osmocom
|
|
chown -R -v osmocom:osmocom /var/lib/osmocom
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
# dh_installdeb(1) will replace this with shell code automatically
|
|
# generated by other debhelper scripts.
|
|
#DEBHELPER#
|