diff options
Diffstat (limited to 'debian')
-rw-r--r-- | debian/control | 2 | ||||
-rwxr-xr-x | debian/postinst | 59 |
2 files changed, 30 insertions, 31 deletions
diff --git a/debian/control b/debian/control index 56457c9..ec234a3 100644 --- a/debian/control +++ b/debian/control @@ -20,7 +20,7 @@ Homepage: https://projects.osmocom.org/projects/osmo-hlr Package: osmo-hlr Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser +Depends: ${shlibs:Depends}, ${misc:Depends} Description: Osmocom Home Location Register OsmoHLR is a Osmocom implementation of HLR (Home Location Registrar) which works over GSUP protocol. The subscribers are store in sqlite DB. diff --git a/debian/postinst b/debian/postinst index 96734df..34fb79d 100755 --- a/debian/postinst +++ b/debian/postinst @@ -4,39 +4,38 @@ # to do. /usr/share/osmocom/osmo-hlr-post-upgrade.sh -# Create 'osmocom' user and group (if it doesn't exist yet) and adjust permissions -# of directories which are not automatically adjusted by systemd from previous (root-owned) -# install. - -# N. B: the user is intentionally NOT removed during package uninstall: -# see https://wiki.debian.org/AccountHandlingInMaintainerScripts for reasoning. -chperms() { - # chperms <user> <group> <perms> <file> - if ! OVERRIDE=`dpkg-statoverride --list $4 2>&1`; then - if [ -e $4 ]; then - chown $1:$2 $4 - chmod $3 $4 +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 - fi -} -case "$1" in - configure) - if ! getent passwd osmocom > /dev/null; then - adduser --quiet \ - --system \ - --group \ - --no-create-home \ - --disabled-password \ - --home /var/lib/osmocom \ - --gecos "Open Source Mobile Communications" \ - osmocom - fi -# Set permissions according to https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners - chperms osmocom osmocom 0660 /etc/osmocom/osmo-hlr.cfg - chperms root osmocom 2775 /etc/osmocom + # Fix permissions of previous (root-owned) install (OS#4107) + if dpkg --compare-versions "$2" le "1.8.0"; then + if [ -e /etc/osmocom/osmo-hlr.cfg ]; then + chown -v osmocom:osmocom /etc/osmocom/osmo-hlr.cfg + chmod -v 0660 /etc/osmocom/osmo-hlr.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 |