From 575c21ff5a40fe3f56005119ab5f48501354faf4 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Tue, 1 Apr 2014 16:00:02 -0700 Subject: [PATCH] feat(app-emulation/google-startup-scripts): initial commit --- ...up-scripts-use-GOOGLE_STARTUP_SCRIPT.patch | 63 +++++++++++++++++++ .../google-startup-scripts-1.1.1.ebuild | 29 +++++++++ .../oem-gce/files/cloud-config.yml | 18 ++++++ 3 files changed, 110 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/google-startup-scripts/files/0001-fix-google-startup-scripts-use-GOOGLE_STARTUP_SCRIPT.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/google-startup-scripts/google-startup-scripts-1.1.1.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/google-startup-scripts/files/0001-fix-google-startup-scripts-use-GOOGLE_STARTUP_SCRIPT.patch b/sdk_container/src/third_party/coreos-overlay/app-emulation/google-startup-scripts/files/0001-fix-google-startup-scripts-use-GOOGLE_STARTUP_SCRIPT.patch new file mode 100644 index 0000000000..8ed5827817 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/google-startup-scripts/files/0001-fix-google-startup-scripts-use-GOOGLE_STARTUP_SCRIPT.patch @@ -0,0 +1,63 @@ +From 2748f99730e699b2597653ddef1c4109cae976b2 Mon Sep 17 00:00:00 2001 +From: Brandon Philips +Date: Tue, 1 Apr 2014 16:35:28 -0700 +Subject: [PATCH] fix(google-startup-scripts): use + ${GOOGLE_STARTUP_SCRIPTS_PREFIX} in onboot + +We can't install these scripts into /usr/share/google. So, take a PREFIX +environment variable. +--- + google-startup-scripts/usr/share/google/onboot | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/google-startup-scripts/usr/share/google/onboot b/google-startup-scripts/usr/share/google/onboot +index d740d07..f65b5ab 100755 +--- a/google-startup-scripts/usr/share/google/onboot ++++ b/google-startup-scripts/usr/share/google/onboot +@@ -33,7 +33,7 @@ else + declare -r LOGGER=/bin/logger + fi + +-declare -r BOTO_SETUP_SCRIPT=/usr/share/google/boto/boot_setup.py ++declare -r BOTO_SETUP_SCRIPT=${GOOGLE_STARTUP_SCRIPTS_PREFIX}/boto/boot_setup.py + + declare -r CURL_RETRY_LIMIT=10 + declare -r CURL_TIMEOUT=10 +@@ -105,13 +105,13 @@ function download_url() { + + function get_metadata_value() { + local readonly varname=$1 +- /usr/share/google/get_metadata_value ${varname} ++ ${GOOGLE_STARTUP_SCRIPTS_PREFIX}/get_metadata_value ${varname} + return $? + } + + function get_metadata_attribute() { + local readonly varname=$1 +- /usr/share/google/get_metadata_value "attributes/${varname}" ++ ${GOOGLE_STARTUP_SCRIPTS_PREFIX}/get_metadata_value "attributes/${varname}" + return $? + } + +@@ -129,14 +129,14 @@ function run_command_with_retry() { + } + + function first_boot() { +- if [[ -x /usr/share/google/first-boot ]]; then +- /usr/share/google/first-boot ++ if [[ -x ${GOOGLE_STARTUP_SCRIPTS_PREFIX}/first-boot ]]; then ++ ${GOOGLE_STARTUP_SCRIPTS_PREFIX}/first-boot + fi + } + + function virtionet_irq_affinity() { +- if [[ -x /usr/share/google/virtionet-irq-affinity ]]; then +- /usr/share/google/virtionet-irq-affinity ++ if [[ -x ${GOOGLE_STARTUP_SCRIPTS_PREFIX}/virtionet-irq-affinity ]]; then ++ ${GOOGLE_STARTUP_SCRIPTS_PREFIX}/virtionet-irq-affinity + fi + } + +-- +1.8.5.2 (Apple Git-48) + diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/google-startup-scripts/google-startup-scripts-1.1.1.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/google-startup-scripts/google-startup-scripts-1.1.1.ebuild new file mode 100644 index 0000000000..2036649778 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/google-startup-scripts/google-startup-scripts-1.1.1.ebuild @@ -0,0 +1,29 @@ +# +# Copyright (c) 2014 CoreOS, Inc. All rights reserved. +# Distributed under the terms of the GNU General Public License v2 +# + +EAPI=5 +inherit toolchain-funcs systemd + +DESCRIPTION="Google Startup Scripts for Compute Engine" +HOMEPAGE="https://github.com/GoogleCloudPlatform/compute-image-packages" +SRC_URI="https://github.com/GoogleCloudPlatform/compute-image-packages/releases/download/${PV}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="amd64 x86" +IUSE="" + +RDEPEND="dev-lang/python-oem" + +S="${WORKDIR}" + +src_prepare() { + epatch "${FILESDIR}"/0001-fix-google-startup-scripts-use-GOOGLE_STARTUP_SCRIPT.patch +} + +src_install() { + mkdir -p ${D}/usr/share/oem/google-startup-scripts/usr/share/google/ + cp -Ra ${WORKDIR}/usr/share/google/. ${D}/usr/share/oem/google-startup-scripts/ || die +} diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/cloud-config.yml b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/cloud-config.yml index f69a6b996f..21d1fbaa43 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/cloud-config.yml +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/cloud-config.yml @@ -36,6 +36,7 @@ coreos: StandardOutput=journal+console ExecStart=/usr/share/oem/bin/gce-ssh-key - name: google-accounts-manager.service + command: start runtime: yes content: | [Unit] @@ -51,6 +52,7 @@ coreos: [Install] WantedBy=multi-user.target - name: google-address-manager.service + command: start runtime: yes content: | [Unit] @@ -62,5 +64,21 @@ coreos: Type=simple ExecStart=/usr/share/oem/python/bin/python2.7 /usr/share/oem/google-compute-daemon/manage_addresses.py + [Install] + WantedBy=multi-user.target + - name: google-startup-scripts.service + command: start + runtime: yes + content: | + [Unit] + Description=Google Compute Engine Startup Scripts + After=network.target + Requires=network.target + + [Service] + Type=oneshot + Environment=PREFIX=/usr/share/oem/google-startup-scripts + ExecStart=/usr/share/oem/google-startup-scripts/usr/share/google/onboot + [Install] WantedBy=multi-user.target