[ARVADOS] updated: 26e2fafd86c2b3241ff98747fa1795dbf00e72d1
Git user
git at public.curoverse.com
Thu Aug 4 18:43:34 EDT 2016
Summary of changes:
build/go-package-scripts/postinst | 15 +++++++++++++++
build/run-library.sh | 9 +++++----
2 files changed, 20 insertions(+), 4 deletions(-)
create mode 100755 build/go-package-scripts/postinst
via 26e2fafd86c2b3241ff98747fa1795dbf00e72d1 (commit)
from 902e38e8489642d581b6157837fd24fcb57a14f0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 26e2fafd86c2b3241ff98747fa1795dbf00e72d1
Author: Tom Clegg <tom at curoverse.com>
Date: Thu Aug 4 18:43:17 2016 -0400
9706: Add postinst script to Go packages that have systemd unit files, so (on Debian) the service starts up without manual intervention.
diff --git a/build/go-package-scripts/postinst b/build/go-package-scripts/postinst
new file mode 100755
index 0000000..137f898
--- /dev/null
+++ b/build/go-package-scripts/postinst
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e
+
+script="${0##*/}"
+pkg="${script%.postinst}"
+
+case "${1}" in
+ configure)
+ if which systemctl >/dev/null && [[ -e "/lib/systemd/system/${pkg}.service" ]]; then
+ systemctl enable "${pkg}"
+ systemctl start "${pkg}"
+ fi
+ ;;
+esac
diff --git a/build/run-library.sh b/build/run-library.sh
index aee579c..9140ac1 100755
--- a/build/run-library.sh
+++ b/build/run-library.sh
@@ -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() {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list