osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-cbc/+/36802?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: Ic41d3ae2478c49aed222bfa978344727c5dc92a4
---
M debian/postinst
1 file changed, 31 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve




diff --git a/debian/postinst b/debian/postinst
index 922fa48..2e24c6a 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-cbc.cfg
-               chmod 0660 /etc/osmocom/osmo-cbc.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 "0.5.0"; then
+                       if [ -e /etc/osmocom/osmo-cbc.cfg ]; then
+                               chown -v osmocom:osmocom 
/etc/osmocom/osmo-cbc.cfg
+                               chmod -v 0660 /etc/osmocom/osmo-cbc.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


--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/36802?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: Ic41d3ae2478c49aed222bfa978344727c5dc92a4
Gerrit-Change-Number: 36802
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to