From d1132bb18826908e40e14eda1111c80409787e51 Mon Sep 17 00:00:00 2001 From: Kostya Vasilyev Date: Fri, 26 Jul 2019 12:38:59 +0300 Subject: [PATCH] deb packaging fixes: 1) stop the service in prerm 2) reload services in postrm (#123) --- package/deb/postrm | 5 +++++ package/deb/prerm | 5 +++++ package/package_deb.sh | 6 +++--- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 package/deb/prerm diff --git a/package/deb/postrm b/package/deb/postrm index e69de29bb..c913aa083 100644 --- a/package/deb/postrm +++ b/package/deb/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + +# Reload systemd unit +systemctl daemon-reload diff --git a/package/deb/prerm b/package/deb/prerm new file mode 100644 index 000000000..32ea7d4ca --- /dev/null +++ b/package/deb/prerm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + +# Reload systemd unit +systemctl stop victoria-metrics diff --git a/package/package_deb.sh b/package/package_deb.sh index d3e2272c4..545a082c9 100755 --- a/package/package_deb.sh +++ b/package/package_deb.sh @@ -46,7 +46,6 @@ echo "*** Out .deb : ${OUT_DEB}" # Copy the binary cp "./bin/${EXENAME_SRC}" "${TEMPDIR}/usr/sbin/${EXENAME_DST}" -file "${TEMPDIR}/usr/sbin/${EXENAME_DST}" # Copy supporting files @@ -70,6 +69,7 @@ cp "${PACKDIR}/deb/conffile" "${TEMPDIR}/conffile" # Copy postinst and postrm cp "${PACKDIR}/deb/postinst" "${TEMPDIR}/postinst" +cp "${PACKDIR}/deb/prerm" "${TEMPDIR}/prerm" cp "${PACKDIR}/deb/postrm" "${TEMPDIR}/postrm" ( @@ -84,8 +84,8 @@ cp "${PACKDIR}/deb/postrm" "${TEMPDIR}/postrm" # Archive control chmod 644 control md5sums - chmod 755 postrm postinst - fakeroot -- tar -c --xz -f ./control.tar.xz ./control ./md5sums ./postinst ./postrm + chmod 755 postinst postrm prerm + fakeroot -- tar -c --xz -f ./control.tar.xz ./control ./md5sums ./postinst ./prerm ./postrm # Archive data