File google-guest-agent-new.spec of Package google-guest-agent-new
#
# spec file for package google-guest-agent
#
# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global provider github
%global provider_tld com
%global project GoogleCloudPlatform
%global repo google-guest-agent
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
Name: google-guest-agent
Version: 0.0.0+20260205_26bd96c
Release: 0
Summary: Google Cloud Guest Agent
License: Apache-2.0
Group: System/Daemons
URL: https://%{provider_prefix}
Source0: %{repo}-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: rpmlintrc
BuildRequires: protobuf-devel
BuildRequires: golang-packaging
BuildRequires: golang(API) = 1.25
BuildRequires: protoc-gen-go
BuildRequires: protoc-gen-go-grpc
Requires: google-guest-configs
Requires: google-guest-oslogin >= 20231003
Provides: google-compute-engine-init = %{version}
Obsoletes: google-compute-engine-init < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{go_nostrip}
%{go_provides}
%description
Google Cloud Guest Agent
%prep
%setup -n %{repo}-%{version} -a1
%build
%goprep %{import_path}
make
%install
# binaries
install -d %{buildroot}%{_bindir}
install -p -m 0755 cmd/core_plugin/core_plugin %{buildroot}%{_bindir}/core_plugin
install -p -m 0755 cmd/gce_metadata_script_runner/gce_metadata_script_runner %{buildroot}%{_bindir}/gce_metadata_script_runner
install -p -m 0755 cmd/ggactl/ggactl_plugin %{buildroot}%{_bindir}/ggactl_plugin
install -p -m 0755 cmd/google_authorized_keys/google_authorized_keys %{buildroot}%{_bindir}/google_authorized_keys
install -p -m 0755 cmd/google_authorized_keys_compat/google_authorized_keys_compat %{buildroot}%{_bindir}/google_authorized_keys_compat
install -p -m 0755 cmd/google_guest_agent/google_guest_agent %{buildroot}%{_bindir}/google_guest_agent
install -p -m 0755 cmd/google_guest_compat_manager/google_guest_compat_manager %{buildroot}%{_bindir}/google_guest_compat_manager
install -p -m 0755 cmd/gce_metadata_script_runner/gce_metadata_script_runner %{buildroot}%{_bindir}/gce_metadata_script_runner
# configuration files
install -d %{buildroot}/usr/share/google-guest-agent
install -p -m 0644 build/configs/usr/share/google-guest-agent/instance_configs.cfg %{buildroot}/usr/share/google-guest-agent/instance_configs.cfg
# systemd unit files
install -d %{buildroot}%{_unitdir}
install -p -m 0644 build/configs/usr/lib/systemd/system/google-shutdown-scripts.service %{buildroot}%{_unitdi}r
install -p -m 0644 build/configs/usr/lib/systemd/system/google-guest-agent.service %{buildroot}%{_unitdir}
install -p -m 0644 build/configs/usr/lib/systemd/system/google-startup-scripts.service %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_sbindir}
for srv_name in %{buildroot}%{_unitdir}/*.service; do rc_name=$(basename -s '.service' $srv_name); ln -s service %{buildroot}%{_sbindir}/rc$rc_name; done
%pre
# if [ -f /usr/lib/systemd/system/google-ip-forwarding-daemon.service ]; then
# systemctl stop --no-block google-ip-forwarding-daemon
# systemctl disable google-ip-forwarding-daemon.service
# fi
# if [ -f /usr/lib/systemd/system/google-network-setup.service ]; then
# systemctl stop --no-block google-network-setup
# systemctl disable google-network-setup.service
# fi
%service_add_pre google-guest-agent.service google-shutdown-scripts.service google-startup-scripts.service
%preun
%service_del_preun google-guest-agent.service google-shutdown-scripts.service google-startup-scripts.service
%post
# # Handle enabling of services during an upgrade from the old google-compute-engine-init package
# if [ "$1" = "1" ] && ! [ -e /.buildenv ] && systemctl is-enabled -q google-accounts-daemon.service 2>/dev/null ; then
# mktemp --suffix ".google-accounts-daemon-enabled"
# if systemctl is-active --quiet google-accounts-daemon.service ; then
# mktemp --suffix ".google-accounts-daemon-active"
# fi
# fi
# if [ "$1" = "1" ] && ! [ -e /.buildenv ] && systemctl is-enabled -q google-startup-scripts.service 2>/dev/null ; then
# mktemp --suffix ".google-startup-scripts"
# fi
# if [ "$1" = "1" ] && ! [ -e /.buildenv ] && systemctl is-enabled -q google-shutdown-scripts.service 2>/dev/null ; then
# mktemp --suffix ".google-shutdown-scripts"
# fi
%service_add_post google-guest-agent.service google-shutdown-scripts.service google-startup-scripts.service
#%%posttrans
# if ! [ -e /.buildenv ] && [ -f /tmp/tmp\.[A-Z,a-z,0-9]*\.google-accounts-daemon-enabled ] ; then
# systemctl enable google-guest-agent.service
# rm -f /tmp/tmp\.[A-Z,a-z,0-9]*\.google-accounts-daemon-enabled
# if [ -f /tmp/tmp\.[A-Z,a-z,0-9]*\.google-accounts-daemon-enabled ] ; then
# systemctl stop google-accounts-daemon.service
# systemctl start google-guest-agent.service
# rm -f /tmp/tmp\.[A-Z,a-z,0-9]*\.google-accounts-daemon-active
# fi
# fi
# if ! [ -e /.buildenv ] && [ -f /tmp/tmp\.[A-Z,a-z,0-9]*\.google-startup-scripts ] ; then
# rm -f /tmp/tmp\.[A-Z,a-z,0-9]*\.google-startup-scripts
# systemctl enable google-startup-scripts.service
# fi
# if ! [ -e /.buildenv ] && [ -f /tmp/tmp\.[A-Z,a-z,0-9]*\.google-shutdown-scripts ] ; then
# rm -f /tmp/tmp\.[A-Z,a-z,0-9]*\.google-shutdown-scripts
# systemctl enable google-shutdown-scripts.service
# fi
%postun
%service_del_postun google-guest-agent.service google-shutdown-scripts.service google-startup-scripts.service
%files
%defattr(0644,root,root,0755)
%license LICENSE
%attr(0755,root,root) %{_bindir}/*
%{_datadir}/google-guest-agent
%{_sbindir}/*
%{_unitdir}/*
%changelog