summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO17
-rw-r--r--PKGBUILD58
-rw-r--r--google-guest-agent.install23
3 files changed, 98 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..26e19b9b26a9
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,17 @@
+pkgbase = google-guest-agent
+ pkgdesc = Guest Agent for Google Compute Engine
+ pkgver = 20200819.00
+ pkgrel = 1
+ url = https://github.com/GoogleCloudPlatform/guest-agent
+ install = google-guest-agent.install
+ arch = x86_64
+ license = Apache
+ makedepends = go
+ backup = etc/default/instance_configs.cfg
+ source = google-guest-agent-20200819.00.tar.gz::https://github.com/GoogleCloudPlatform/guest-agent/archive/20200819.00.tar.gz
+ source = google-guest-agent.install
+ sha256sums = 00478324cb19edbf83a36ded0baed6509cf3b68966e56c985b40836c1b2dd5fb
+ sha256sums = bf8dd6ae04242160cd78e781015fd456c73c208ba09049fc56cc0f716038c5f2
+
+pkgname = google-guest-agent
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..f5c2b16fa031
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,58 @@
+# Copyright 2020 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Maintainer: Lorenzo Castelli <lcastelli@google.com>
+# Maintainer: Samuel Littley <samuellittley@google.com>
+
+pkgname='google-guest-agent'
+pkgver=20200819.00
+pkgrel=1
+pkgdesc='Guest Agent for Google Compute Engine'
+arch=('x86_64')
+url='https://github.com/GoogleCloudPlatform/guest-agent'
+license=('Apache')
+makedepends=('go')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/GoogleCloudPlatform/guest-agent/archive/$pkgver.tar.gz"
+ 'google-guest-agent.install')
+sha256sums=('00478324cb19edbf83a36ded0baed6509cf3b68966e56c985b40836c1b2dd5fb'
+ 'bf8dd6ae04242160cd78e781015fd456c73c208ba09049fc56cc0f716038c5f2')
+install='google-guest-agent.install'
+backup=('etc/default/instance_configs.cfg')
+
+export CGO_CPPFLAGS="$CPPFLAGS"
+export CGO_CFLAGS="$CFLAGS"
+export CGO_CXXFLAGS="$CXXFLAGS"
+export CGO_LDFLAGS="$LDFLAGS"
+export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
+
+build() {
+ cd "guest-agent-$pkgver"
+ go build -o google_guest_agent ./google_guest_agent
+ go build -o google_metadata_script_runner ./google_metadata_script_runner
+}
+
+check() {
+ cd "guest-agent-$pkgver"
+ go test ./google_guest_agent ./google_metadata_script_runner
+}
+
+package() {
+ cd "guest-agent-$pkgver"
+ install -m755 -Dt "$pkgdir/usr/bin" google_guest_agent/google_guest_agent
+ install -m755 -Dt "$pkgdir/usr/bin" google_metadata_script_runner/google_metadata_script_runner
+ install -m644 -Dt "$pkgdir/usr/lib/systemd/system" *.service
+ install -m644 -Dt "$pkgdir/usr/lib/systemd/system-preset" *.preset
+ install -m644 -Dt "$pkgdir/usr/share/google-guest-agent" instance_configs.cfg
+ install -m644 -Dt "$pkgdir/etc/default" instance_configs.cfg
+}
diff --git a/google-guest-agent.install b/google-guest-agent.install
new file mode 100644
index 000000000000..e640ca295695
--- /dev/null
+++ b/google-guest-agent.install
@@ -0,0 +1,23 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+post_install() {
+ systemctl enable --now google-guest-agent.service
+ systemctl enable google-startup-scripts.service google-shutdown-scripts.service
+}
+
+pre_remove() {
+ systemctl disable --now google-guest-agent.service
+ systemctl disable google-startup-scripts.service google-shutdown-scripts.service
+}