diff --git a/debian/postinst b/debian/postinst index 4ac99e443..25127b510 100755 --- a/debian/postinst +++ b/debian/postinst @@ -16,12 +16,20 @@ case "$1" in fi # Fix permissions of previous (root-owned) install (OS#4107) - chown osmocom:osmocom /etc/osmocom/osmo-sgsn.cfg - chmod 0660 /etc/osmocom/osmo-sgsn.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.12.0"; then + if [ -e /etc/osmocom/osmo-sgsn.cfg ]; then + chown -v osmocom:osmocom /etc/osmocom/osmo-sgsn.cfg + chmod -v 0660 /etc/osmocom/osmo-sgsn.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