Skip to content

Commit

Permalink
debian/postinst: add checks, be verbose
Browse files Browse the repository at this point in the history
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: I2b01a7625cf66fbb7d203f939ddcc1cbab43cf33
  • Loading branch information
osmith42 committed May 14, 2024
1 parent 7ba62d3 commit 0a6fe97
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0a6fe97

Please sign in to comment.