9706: Stop systemd services when their packages are uninstalled.
[arvados.git] / build / run-library.sh
index 9140ac1611bd05041bd99314015468497bc8cb5c..485e0d2974484c0e0927e69df36c97dd5dd9b97d 100755 (executable)
@@ -104,8 +104,10 @@ package_go_binary() {
     declare -a switches=()
     systemd_unit="$WORKSPACE/${src_path}/${prog}.service"
     if [[ -e "${systemd_unit}" ]]; then
-        switches+=("${systemd_unit}=/lib/systemd/system/${prog}.service")
-        switches+=(--after-install "$WORKSPACE/build/go-package-scripts/postinst")
+        switches+=(
+            --after-install "$WORKSPACE/build/go-package-scripts/postinst"
+            --before-remove "$WORKSPACE/build/go-package-scripts/prerm"
+            "${systemd_unit}=/lib/systemd/system/${prog}.service")
     fi
     switches+=("$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file")