Skip to content

Commit

Permalink
Add plugin manager to debian build (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
drewhli authored Oct 23, 2024
1 parent 6069dc7 commit ebe4551
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packaging/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Maintainer: Google Cloud Team <[email protected]>
Section: misc
Priority: optional
Standards-Version: 3.9.8
Build-Depends: debhelper (>= 9.20160709), dh-golang (>= 1.1), golang-go
Build-Depends: debhelper (>= 9.20160709), dh-golang (>= 1.1), golang-go, protobuf-compiler

Package: google-guest-agent
Architecture: any
Expand Down
16 changes: 16 additions & 0 deletions packaging/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,40 @@ override_dh_auto_install:
install -p -m 0644 instance_configs.cfg debian/google-guest-agent/usr/share/google-guest-agent
install -d debian/google-guest-agent/lib/systemd/system
install -p -m 0644 gce-workload-cert-refresh.timer debian/google-guest-agent/lib/systemd/system/
if [[ -d google-guest-agent ]]; then\
install -p -m 0644 google-guest-agent/cmd/google_guest_agent/google_guest_agent debian/google-guest-agent/usr/bin/google_guest_agent_manager;\
fi

override_dh_golang:
# We don't use any packaged dependencies, so skip dh_golang step.

override_dh_auto_build:
dh_auto_build -O--buildsystem=golang -- -ldflags="-s -w -X main.version=$(VERSION)" -mod=readonly
if [[ -d google-guest-agent ]]; then\
VERSION=$(VERSION) make -C google-guest-agent cmd/google_guest_agent/google_guest_agent;\
fi

override_dh_installinit:
# We don't ship sysvinit files or need script changes for them.

override_dh_systemd_enable:
install -d debian/google-guest-agent/lib/systemd/system
install -p -m 0644 *.service debian/google-guest-agent/lib/systemd/system/
# Don't include guest agent manager if not building with it.
if [[ ! -d google-guest-agent ]]; then\
rm -f debian/google-guest-agent/lib/systemd/systemd/google-guest-agent-manager.service;\
fi
install -d debian/google-guest-agent/lib/systemd/system-preset
install -p -m 0644 *.preset debian/google-guest-agent/lib/systemd/system-preset/
dh_systemd_enable google-guest-agent.service google-startup-scripts.service google-shutdown-scripts.service gce-workload-cert-refresh.timer
if [[ -d google-guest-agent ]]; then\
dh_systemd_enable google-guest-agent-manager.service;\
fi

override_dh_systemd_start:
# Only perform start/stop actions for the guest agent and cert refresh timer.
dh_systemd_start google-guest-agent.service
dh_systemd_start gce-workload-cert-refresh.timer
if [[ -d google-guest-agent ]]; then\
dh_systemd_start google-guest-agent-manager.service;\
fi

0 comments on commit ebe4551

Please sign in to comment.