Attention is currently required from: osmith.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/36714?usp=email )
Change subject: osmo-trx-uhd: Make sure HOME environment variable is set
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/36714?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx
Gerrit-Branch: osmith/1.6.2
Gerrit-Change-Id: I1816013c507da28719590f063da0a397da656a10
Gerrit-Change-Number: 36714
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 08 May 2024 08:13:16 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/36714?usp=email )
Change subject: osmo-trx-uhd: Make sure HOME environment variable is set
......................................................................
osmo-trx-uhd: Make sure HOME environment variable is set
It turns out that uhd versions >= 4.0.0.0 *require* that either the
HOME or the XDG_CONFIG_HOME variables are set, and otherwise will
terminate the program.
Change-Id: I1816013c507da28719590f063da0a397da656a10
Closes: OS#6269
(cherry picked from commit 6ee9dccddb916e44b6bb3e2c967d8a37078206b4)
---
M contrib/systemd/osmo-trx-uhd.service
1 file changed, 16 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/14/36714/1
diff --git a/contrib/systemd/osmo-trx-uhd.service b/contrib/systemd/osmo-trx-uhd.service
index 34ba74a..6c5c2de 100644
--- a/contrib/systemd/osmo-trx-uhd.service
+++ b/contrib/systemd/osmo-trx-uhd.service
@@ -8,6 +8,7 @@
Restart=always
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
+Environment=HOME=%h
ExecStart=/usr/bin/osmo-trx-uhd -C /etc/osmocom/osmo-trx-uhd.cfg
RestartSec=2
# CPU scheduling policy:
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/36714?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx
Gerrit-Branch: osmith/1.6.2
Gerrit-Change-Id: I1816013c507da28719590f063da0a397da656a10
Gerrit-Change-Number: 36714
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/36659?usp=email )
Change subject: .deb/.rpm: various fixes related to non-root
......................................................................
.deb/.rpm: various fixes related to non-root
* Explicitly chown /var/lib/osmocom to osmocom:osmocom, instead of
relying on systemd to do it when the service starts up. This does not
work with the systemd versions in debian 10 and almalinux 8.
* deb: Use "useradd" instead of the interactive "adduser" perl script
from Debian. This makes it consistent with how we do it in rpm, and
avoids the dependency on "adduser".
* deb: Remove support for the "dpkg-statoverride --list" logic. This
seems to be a rather obscure feature to override permissions for
certain files or directories. Let's rather remove this complexity to
make the postinst script more maintainable and more similar to the
rpm spec file. If users need this, they can achieve something similar
by using their own Osmocom config file in a different path with
different permissions.
* deb: Consistently use tabs throughout postinst, instead of mixing
tabs and spaces.
Related: OS#4107
Change-Id: Ib20406dd253f5e8720552e92e9002e45591218fa
---
M contrib/osmo-hlr.spec.in
M debian/control
M debian/postinst
3 files changed, 51 insertions(+), 32 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
diff --git a/contrib/osmo-hlr.spec.in b/contrib/osmo-hlr.spec.in
index a1f92ef..ebf6ee6 100644
--- a/contrib/osmo-hlr.spec.in
+++ b/contrib/osmo-hlr.spec.in
@@ -155,6 +155,8 @@
chmod 0660 /etc/osmocom/osmo-hlr.cfg
chown root:osmocom /etc/osmocom
chmod 2775 /etc/osmocom
+mkdir -p /var/lib/osmocom
+chown -R osmocom:osmocom /var/lib/osmocom
%post -n libosmo-gsup-client0 -p /sbin/ldconfig
%postun -n libosmo-gsup-client0 -p /sbin/ldconfig
diff --git a/debian/control b/debian/control
index 56457c9..ec234a3 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,7 @@
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..5dedec4 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -4,39 +4,30 @@
# 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
- 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
+ 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)
+ chown osmocom:osmocom /etc/osmocom/osmo-hlr.cfg
+ chmod 0660 /etc/osmocom/osmo-hlr.cfg
+ chown root:osmocom /etc/osmocom
+ chmod 2775 /etc/osmocom
+ mkdir -p /var/lib/osmocom
+ chown -R osmocom:osmocom /var/lib/osmocom
+ ;;
esac
# dh_installdeb(1) will replace this with shell code automatically
--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/36659?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: Ib20406dd253f5e8720552e92e9002e45591218fa
Gerrit-Change-Number: 36659
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-smlc/+/36665?usp=email )
Change subject: .deb/.rpm: various fixes related to non-root
......................................................................
.deb/.rpm: various fixes related to non-root
* Explicitly chown /var/lib/osmocom to osmocom:osmocom, instead of
relying on systemd to do it when the service starts up. This does not
work with the systemd versions in debian 10 and almalinux 8.
* deb: Use "useradd" instead of the interactive "adduser" perl script
from Debian. This makes it consistent with how we do it in rpm, and
avoids the dependency on "adduser".
* deb: Consistently use tabs through the file, instead of mixing tabs
and spaces.
* deb: Remove support for the "dpkg-statoverride --list" logic. This
seems to be a rather obscure feature to override permissions for
certain files or directories, for which it does not seem to be a good
idea to make the postinst script less maintainable. Something similar
can be achieved by using your own Osmocom config file in a different
path with different permissions.
Related: OS#4107
Change-Id: Ib129217f6aff713d1d0e7aa831b4b54823e9bade
---
M contrib/osmo-smlc.spec.in
M debian/control
M debian/postinst
3 files changed, 50 insertions(+), 32 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/contrib/osmo-smlc.spec.in b/contrib/osmo-smlc.spec.in
index 6a6dc4b..6b19a17 100644
--- a/contrib/osmo-smlc.spec.in
+++ b/contrib/osmo-smlc.spec.in
@@ -84,6 +84,8 @@
chmod 0660 /etc/osmocom/osmo-smlc.cfg
chown root:osmocom /etc/osmocom
chmod 2775 /etc/osmocom
+mkdir -p /var/lib/osmocom
+chown -R osmocom:osmocom /var/lib/osmocom
%check
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
diff --git a/debian/control b/debian/control
index bdfe6e9..242a797 100644
--- a/debian/control
+++ b/debian/control
@@ -23,7 +23,7 @@
Package: osmo-smlc
Architecture: any
Multi-Arch: foreign
-Depends: ${misc:Depends}, ${shlibs:Depends}, libdbd-sqlite3, adduser
+Depends: ${misc:Depends}, ${shlibs:Depends}, libdbd-sqlite3
Description: OsmoSMLC: Osmocom's Location Services Center
FIXME
.
diff --git a/debian/postinst b/debian/postinst
index ae5fcb4..faecd26 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -1,37 +1,28 @@
#!/bin/sh -e
-# 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
- 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-smlc.cfg
- chperms root osmocom 2775 /etc/osmocom
+ 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)
+ chown osmocom:osmocom /etc/osmocom/osmo-smlc.cfg
+ chmod 0660 /etc/osmocom/osmo-smlc.cfg
+ chown root:osmocom /etc/osmocom
+ chmod 2775 /etc/osmocom
+ mkdir -p /var/lib/osmocom
+ chown -R osmocom:osmocom /var/lib/osmocom
+ ;;
esac
# dh_installdeb(1) will replace this with shell code automatically
--
To view, visit https://gerrit.osmocom.org/c/osmo-smlc/+/36665?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-smlc
Gerrit-Branch: master
Gerrit-Change-Id: Ib129217f6aff713d1d0e7aa831b4b54823e9bade
Gerrit-Change-Number: 36665
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged