osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/36799?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: I36d4837cb9a1ae87df3ee457c6031295cf2083ca
---
M debian/postinst
1 file changed, 27 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/99/36799/1

diff --git a/debian/postinst b/debian/postinst
index 46d7c78..be12373 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -17,10 +17,16 @@

                # Fix permissions of previous (root-owned) install (OS#4107)
                if dpkg --compare-versions "$2" le "1.13.0"; then
-                       chown -v osmocom:osmocom /etc/osmocom/osmo-mgw.cfg
-                       chmod -v 0660 /etc/osmocom/osmo-mgw.cfg
-                       chown -v root:osmocom /etc/osmocom
-                       chmod -v 2775 /etc/osmocom
+                       if [ -e /etc/osmocom/osmo-mgw.cfg ]; then
+                               chown -v osmocom:osmocom 
/etc/osmocom/osmo-mgw.cfg
+                               chmod -v 0660 /etc/osmocom/osmo-mgw.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

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I36d4837cb9a1ae87df3ee457c6031295cf2083ca
Gerrit-Change-Number: 36799
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>
Gerrit-MessageType: newchange

Reply via email to