9706: Add postinst script to Go packages that have systemd unit files, so (on Debian...
[arvados.git] / build / run-library.sh
index aee579c7c1532ce77c00a6b84ad553988e0b2b48..9140ac1611bd05041bd99314015468497bc8cb5c 100755 (executable)
@@ -101,14 +101,15 @@ package_go_binary() {
     cd $WORKSPACE/packages/$TARGET
     go get "git.curoverse.com/arvados.git/$src_path"
 
-    declare -a addfiles=()
+    declare -a switches=()
     systemd_unit="$WORKSPACE/${src_path}/${prog}.service"
     if [[ -e "${systemd_unit}" ]]; then
-        addfiles+=("${systemd_unit}=/lib/systemd/system/${prog}.service")
+        switches+=("${systemd_unit}=/lib/systemd/system/${prog}.service")
+        switches+=(--after-install "$WORKSPACE/build/go-package-scripts/postinst")
     fi
-    addfiles+=("$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file")
+    switches+=("$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file")
 
-    fpm_build "$GOPATH/bin/$basename=/usr/bin/$prog" "$prog" 'Curoverse, Inc.' dir "$version" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=$description" "${addfiles[@]}"
+    fpm_build "$GOPATH/bin/$basename=/usr/bin/$prog" "$prog" 'Curoverse, Inc.' dir "$version" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=$description" "${switches[@]}"
 }
 
 default_iteration() {