diff options
author | Otto Kekäläinen <otto@kekalainen.net> | 2019-06-02 12:05:53 +0300 |
---|---|---|
committer | Otto Kekäläinen <otto@kekalainen.net> | 2019-09-18 10:58:16 +0300 |
commit | 13c2fd36c18cbd23ae33bba538982ebceae04ac6 (patch) | |
tree | 5c2fe64cde0ff7f6b49ce207b1168fc41654e92e /debian | |
parent | 8a79fa0e4d0385818da056f7a4a39fde95d62fe3 (diff) | |
download | mariadb-git-13c2fd36c18cbd23ae33bba538982ebceae04ac6.tar.gz |
Deb: Implement proper version detection in maintainer scripts
Fixes bug introduced in commit 5415002.
Using script run-time filename does not always work. One cannot assume
that the filename is always the same as there might be temporary file
names used by dpkg in certain situations. See Debian #920415.
The same fix has been successfully in use in Debian official packages
since February 2019:
https://salsa.debian.org/mariadb-team/mariadb-10.3/commit/6440c0d6e75
Diffstat (limited to 'debian')
-rw-r--r-- | debian/mariadb-server-10.1.postinst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/debian/mariadb-server-10.1.postinst b/debian/mariadb-server-10.1.postinst index 5382d3d0690..2a92cbe81db 100644 --- a/debian/mariadb-server-10.1.postinst +++ b/debian/mariadb-server-10.1.postinst @@ -2,16 +2,16 @@ . /usr/share/debconf/confmodule -# assume the filename is /path/to/mariadb-server-##.#.postinst -VER=${0: -13:4} +# Automatically set version to ease maintenance of this file +MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}" if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } - + export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin # This command can be used as pipe to syslog. With "-s" it also logs to stderr. -ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i" +ERR_LOGGER="logger -p daemon.err -t mariadb-server-$MAJOR_VER.postinst -i" # This will make an error in a logged command immediately apparent by aborting # the install, rather than failing silently and leaving a broken install. set -o pipefail @@ -134,8 +134,8 @@ EOF db_set mysql-server/postrm_remove_database false || true # To avoid downgrades. - touch $mysql_statedir/debian-$VER.flag - + touch $mysql_statedir/debian-$MAJOR_VER.flag + ## On every reconfiguration the maintenance user is recreated. # # - It is easier to regenerate the password every time but as people |