osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36805?usp=email )
Change subject: debian/postinst: add checks, be verbose ......................................................................
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 --- M debian/postinst 1 file changed, 31 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/05/36805/1
diff --git a/debian/postinst b/debian/postinst index d5bf871..616c969 100755 --- a/debian/postinst +++ b/debian/postinst @@ -16,12 +16,20 @@ fi
# Fix permissions of previous (root-owned) install (OS#4107) - chown osmocom:osmocom /etc/osmocom/osmo-hnbgw.cfg - chmod 0660 /etc/osmocom/osmo-hnbgw.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.6.0"; then + if [ -e /etc/osmocom/osmo-hnbgw.cfg ]; then + chown -v osmocom:osmocom /etc/osmocom/osmo-hnbgw.cfg + chmod -v 0660 /etc/osmocom/osmo-hnbgw.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