summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Marano <zmarano@google.com>2016-07-19 13:06:27 -0700
committerGitHub <noreply@github.com>2016-07-19 13:06:27 -0700
commit5a249e940b1799633f6299d0772980697189af3a (patch)
tree1176d5994fda2ad7913adf3476a3bb961730d36d
parent73d121fbb186e12aab6ca576fa2432a2f95bfc10 (diff)
downloadgoogle-compute-image-packages-5a249e940b1799633f6299d0772980697189af3a.tar.gz
Fix migration from existing guest environment to new guest environment. (#302)
-rwxr-xr-xgoogle_compute_engine_init/build_packages.sh2
-rwxr-xr-xgoogle_compute_engine_init/systemd/postinst.sh4
-rwxr-xr-xgoogle_compute_engine_init/systemd/rpm_replace17
-rwxr-xr-xgoogle_compute_engine_init/sysvinit/rpm_replace4
-rwxr-xr-xgoogle_compute_engine_init/upstart/postinst.sh4
-rwxr-xr-xgoogle_compute_engine_init/upstart/rpm_replace9
6 files changed, 36 insertions, 4 deletions
diff --git a/google_compute_engine_init/build_packages.sh b/google_compute_engine_init/build_packages.sh
index f2ccff0..240d66e 100755
--- a/google_compute_engine_init/build_packages.sh
+++ b/google_compute_engine_init/build_packages.sh
@@ -55,6 +55,8 @@ function build_distro() {
--replaces 'google-compute-daemon' \
--replaces 'google-startup-scripts' \
--rpm-dist "${distro}" \
+ --rpm-trigger-after-target-uninstall \
+ "google-compute-daemon: ${init_config}/rpm_replace" \
--url 'https://github.com/GoogleCloudPlatform/compute-image-packages' \
--vendor 'Google Compute Engine Team' \
--version '2.0.1' \
diff --git a/google_compute_engine_init/systemd/postinst.sh b/google_compute_engine_init/systemd/postinst.sh
index 5913706..485e27e 100755
--- a/google_compute_engine_init/systemd/postinst.sh
+++ b/google_compute_engine_init/systemd/postinst.sh
@@ -26,8 +26,8 @@ systemctl enable google-ip-forwarding-daemon.service
systemctl enable google-shutdown-scripts.service
systemctl enable google-startup-scripts.service
-# Run instance setup.
-systemctl start --no-block google-instance-setup
+# Run instance setup manually to prevent startup script execution.
+/usr/bin/google_instance_setup
# Start daemons.
systemctl start --no-block google-accounts-daemon
diff --git a/google_compute_engine_init/systemd/rpm_replace b/google_compute_engine_init/systemd/rpm_replace
new file mode 100755
index 0000000..2e7d562
--- /dev/null
+++ b/google_compute_engine_init/systemd/rpm_replace
@@ -0,0 +1,17 @@
+# Replace existing guest in EL7.
+
+# Enable systemd services.
+systemctl enable google-accounts-daemon.service
+systemctl enable google-clock-skew-daemon.service
+systemctl enable google-instance-setup.service
+systemctl enable google-ip-forwarding-daemon.service
+systemctl enable google-shutdown-scripts.service
+systemctl enable google-startup-scripts.service
+
+# Run instance setup manually.
+/usr/bin/google_instance_setup
+
+# Start daemons.
+systemctl start --no-block google-accounts-daemon
+systemctl start --no-block google-clock-skew-daemon
+systemctl start --no-block google-ip-forwarding-daemon
diff --git a/google_compute_engine_init/sysvinit/rpm_replace b/google_compute_engine_init/sysvinit/rpm_replace
new file mode 100755
index 0000000..85aee43
--- /dev/null
+++ b/google_compute_engine_init/sysvinit/rpm_replace
@@ -0,0 +1,4 @@
+# Replace existing guest.
+
+# Run instance setup.
+/usr/bin/google_instance_setup
diff --git a/google_compute_engine_init/upstart/postinst.sh b/google_compute_engine_init/upstart/postinst.sh
index 0790b7e..5904b22 100755
--- a/google_compute_engine_init/upstart/postinst.sh
+++ b/google_compute_engine_init/upstart/postinst.sh
@@ -18,8 +18,8 @@ stop --no-wait google-accounts-daemon
stop --no-wait google-clock-skew-daemon
stop --no-wait google-ip-forwarding-daemon
-# Run instance setup
-start --no-wait google-instance-setup
+# Run instance setup manually to prevent startup script execution.
+/usr/bin/google_instance_setup
# Start daemons
start --no-wait google-accounts-daemon
diff --git a/google_compute_engine_init/upstart/rpm_replace b/google_compute_engine_init/upstart/rpm_replace
new file mode 100755
index 0000000..80f3a5a
--- /dev/null
+++ b/google_compute_engine_init/upstart/rpm_replace
@@ -0,0 +1,9 @@
+# Replace existing guest in EL6.
+
+# Run instance setup
+/usr/bin/google_instance_setup
+
+# Manually start daemon's
+start --no-wait google-accounts-daemon
+start --no-wait google-clock-skew-daemon
+start --no-wait google-ip-forwarding-daemon