Skip to content

Commit

Permalink
Configs for new guest agent (#858)
Browse files Browse the repository at this point in the history
* Remove relevant files and configs for legacy python daemons
* Add dependency on guest-agent package
  • Loading branch information
hopkiw authored Jan 21, 2020
1 parent 1fd4dfb commit 276e520
Show file tree
Hide file tree
Showing 34 changed files with 56 additions and 855 deletions.
7 changes: 7 additions & 0 deletions packages/google-compute-engine/packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
google-compute-engine (1:20200113.00-g1) stable; urgency=medium

* Remove python daemon configs.
* Add dependency on guest-agent package.

-- Google Cloud Team <[email protected]> Mon, 13 Jan 2020 13:27:55 -0700

google-compute-engine (1:20190916.00-g2) stable; urgency=medium

* Update dependencies.
Expand Down
8 changes: 3 additions & 5 deletions packages/google-compute-engine/packaging/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ Homepage: https://github.com/GoogleCloudPlatform/compute-image-packages
Package: google-compute-engine
Architecture: all
Depends: google-compute-engine-oslogin,
python-google-compute-engine,
python3-google-compute-engine,
${misc:Depends},
systemd
google-guest-agent,
${misc:Depends}
Recommends: rsyslog | system-log-daemon
Provides: irqbalance
Conflicts: google-compute-engine-jessie,
Expand All @@ -33,5 +31,5 @@ Replaces: google-compute-engine-jessie,
google-compute-daemon,
google-startup-scripts
Description: Google Compute Engine guest environment.
This package contains scripts, configuration, and systemd init files for
This package contains scripts and configuration files for
features specific to the Google Compute Engine cloud environment.
2 changes: 0 additions & 2 deletions packages/google-compute-engine/packaging/debian/install
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ etc/apt/apt.conf.d/*
etc/modprobe.d/*
etc/rsyslog.d/*
etc/sysctl.d/*
lib/systemd/system/*
lib/systemd/system-preset/*
lib/udev/rules.d/*
usr/bin/*
33 changes: 0 additions & 33 deletions packages/google-compute-engine/packaging/debian/postinst

This file was deleted.

28 changes: 13 additions & 15 deletions packages/google-compute-engine/packaging/debian/preinst
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#DEBHELPER#

set -e
if [ -d /run/systemd/system ] ; then
if [ "$1" = upgrade ]; then
# Remove old services if they exist on upgrade.
if [ -f /lib/systemd/system/google-ip-forwarding-daemon.service ]; then
systemctl stop google-ip-forwarding-daemon.service
systemctl disable google-ip-forwarding-daemon.service
fi

if [ -f /lib/systemd/system/google-network-setup.service ]; then
systemctl stop google-network-setup.service
systemctl disable google-network-setup.service
fi
fi
if [ "$1" = upgrade ]; then
# Remove old services if they exist on upgrade.
for svc in google-ip-forwarding-daemon google-network-setup \
google-network-daemon google-accounts-daemon google-clock-skew-daemon \
google-instance-setup; do
if systemctl is-enabled ${svc}.service >/dev/null 2>&1; then
systemctl --no-reload disable ${svc}.service >/dev/null 2>&1 || :
if [ -d /run/systemd/system ]; then
systemctl stop ${svc}.service >/dev/null 2>&1 || :
fi
fi
done
systemdctl daemon-reload >/dev/null 2>&1 || :
fi
28 changes: 0 additions & 28 deletions packages/google-compute-engine/packaging/debian/prerm

This file was deleted.

6 changes: 3 additions & 3 deletions packages/google-compute-engine/packaging/debian/rules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/make -f

%:
dh $@ --with systemd
dh $@

override_dh_systemd_start:
# Configured in postinst.
override_dh_install:
dh_install --sourcedir=src
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Url: https://github.com/GoogleCloudPlatform/compute-image-packages
Source0: %{name}_%{version}.orig.tar.gz
Requires: curl
Requires: google-compute-engine-oslogin
Requires: python-google-compute-engine >= 1:20190916.00
Requires: google-guest-agent
Requires: rsyslog
# Old packages.
Obsoletes: google-compute-engine-init
Expand Down Expand Up @@ -53,36 +53,18 @@ ln -sf /usr/bin/google_set_hostname %{buildroot}/etc/dhcp/dhclient-exit-hooks
%attr(0755,-,-) %{_bindir}/*
%attr(0755,-,-) %{_sbindir}/*
/lib/udev/rules.d/*
/etc/init/*.conf
/etc/dhcp/dhclient-exit-hooks
%config /etc/modprobe.d/*
%config /etc/rsyslog.d/*
%config /etc/sysctl.d/*

%post
# On upgrade run instance setup again to handle any new configs and restart
# daemons.
if [ $1 -eq 2 ]; then
stop -q -n google-accounts-daemon
stop -q -n google-clock-skew-daemon
stop -q -n google-network-daemon
/usr/bin/google_instance_setup
start -q -n google-accounts-daemon
start -q -n google-clock-skew-daemon
start -q -n google-network-daemon
fi

if initctl status google-ip-forwarding-daemon | grep -q 'running'; then
stop -q -n google-ip-forwarding-daemon
fi

%preun
# On uninstall only.
if [ $1 -eq 0 ]; then
stop -q -n google-accounts-daemon
stop -q -n google-clock-skew-daemon
stop -q -n google-network-daemon
if initctl status google-ip-forwarding-daemon | grep -q 'running'; then
stop -q -n google-ip-forwarding-daemon
fi
%pre
if [ $1 -gt 1 ] ; then
# This is an upgrade. Stop services previously owned by this package, if any.
for svc in google-ip-forwarding-daemon google-network-setup \
google-network-daemon google-accounts-daemon google-clock-skew-daemon; do
if initctl status $svc >/dev/null 2>&1; then
initctl stop ${svc} || :
fi
done
fi
69 changes: 17 additions & 52 deletions packages/google-compute-engine/packaging/google-compute-engine.spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@ Url: https://github.com/GoogleCloudPlatform/compute-image-packages
Source0: %{name}_%{version}.orig.tar.gz
Requires: curl
Requires: google-compute-engine-oslogin
%if 0%{?rhel} == 8
Requires: python3-google-compute-engine >= 1:20190916.00
%else
Requires: python-google-compute-engine >= 1:20190916.00
%endif
Requires: google-guest-agent
Requires: rsyslog

BuildArch: noarch
BuildRequires: systemd

# Allow other files in the source that don't end up in the package.
%define _unpackaged_files_terminate_build 0
Expand All @@ -49,62 +44,32 @@ specific to the Google Compute Engine cloud environment.

%install
cp -a src/{etc,usr} %{buildroot}
install -d %{buildroot}/{%{_unitdir},%{_presetdir},%{_udevrulesdir}}
cp -a src/lib/systemd/system/* %{buildroot}/%{_unitdir}
cp -a src/lib/systemd/system-preset/* %{buildroot}/%{_presetdir}
install -d %{buildroot}/%{_udevrulesdir}
cp -a src/lib/udev/rules.d/* %{buildroot}/%{_udevrulesdir}

%files
%defattr(0644,root,root,0755)
%attr(0755,-,-) %{_bindir}/*
%attr(0755,-,-) /etc/dhcp/dhclient.d/google_hostname.sh
%{_udevrulesdir}/*
%{_unitdir}/*
%{_presetdir}/*
%config /etc/modprobe.d/*
%config /etc/rsyslog.d/*
%config /etc/sysctl.d/*

%post
if [ $1 -eq 2 ]; then
# New service might not be enabled during upgrade.
systemctl enable google-network-daemon.service
fi

# On upgrade run instance setup again to handle any new configs and restart
# daemons.
if [ $1 -eq 2 ]; then
/usr/bin/google_instance_setup
systemctl reload-or-restart google-accounts-daemon.service
systemctl reload-or-restart google-clock-skew-daemon.service
systemctl reload-or-restart google-network-daemon.service
%pre
if [ $1 -gt 1 ] ; then
# This is an upgrade. Stop and disable services previously owned by this
# package, if any.
for svc in google-ip-forwarding-daemon google-network-setup \
google-network-daemon google-accounts-daemon google-clock-skew-daemon \
google-instance-setup; do
if systemctl is-enabled ${svc}.service >/dev/null 2>&1; then
systemctl --no-reload disable ${svc}.service >/dev/null 2>&1 || :
if [ -d /run/systemd/system ]; then
systemctl stop ${svc}.service >/dev/null 2>&1 || :
fi
fi
done
systemctl daemon-reload >/dev/null 2>&1 || :
fi

%systemd_post google-accounts-daemon.service
%systemd_post google-clock-skew-daemon.service
%systemd_post google-instance-setup.service
%systemd_post google-network-daemon.service
%systemd_post google-shutdown-scripts.service
%systemd_post google-startup-scripts.service

# Remove old services.
if [ -f /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 /lib/systemd/system/google-network-setup.service ]; then
systemctl stop --no-block google-network-setup
systemctl disable google-network-setup.service
fi

%preun
# On uninstall only.
if [ $1 -eq 0 ]; then
%systemd_preun google-accounts-daemon.service
%systemd_preun google-clock-skew-daemon.service
%systemd_preun google-instance-setup.service
%systemd_preun google-network-daemon.service
%systemd_preun google-shutdown-scripts.service
%systemd_preun google-startup-scripts.service
fi
2 changes: 1 addition & 1 deletion packages/google-compute-engine/packaging/setup_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

NAME="google-compute-engine"
VERSION="20190916.00"
VERSION="20200113.00"

working_dir=${PWD}
if [[ $(basename "$working_dir") != $NAME ]]; then
Expand Down
2 changes: 1 addition & 1 deletion packages/google-compute-engine/packaging/setup_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

NAME="google-compute-engine"
VERSION="20190916.00"
VERSION="20200113.00"

rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION}
working_dir=${PWD}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 276e520

Please sign in to comment.