diff options
author | Oliver Smith <osmith@sysmocom.de> | 2024-05-14 15:21:04 +0200 |
---|---|---|
committer | osmith <osmith@sysmocom.de> | 2024-05-15 11:47:40 +0000 |
commit | 6b771e34bd5c9b6581f085f855589467d753b6e0 (patch) | |
tree | 874dfdfebc136c598c8da1dd97bc4683190e8d79 /debian/postinst | |
parent | a005ad64951550623102a9888e018035554c0cc5 (diff) |
debian/postinst: add checks, be verbose
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: I1bcbe414fd18101e4d875a16539deab7baf9cb5f
Diffstat (limited to 'debian/postinst')
-rwxr-xr-x | debian/postinst | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/debian/postinst b/debian/postinst index 5dedec4..34fb79d 100755 --- a/debian/postinst +++ b/debian/postinst @@ -21,12 +21,20 @@ case "$1" in 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 + 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 |