feat(app-emulation/google-startup-scripts): initial commit

This commit is contained in:
Brandon Philips 2014-04-01 16:00:02 -07:00
parent a709850af8
commit 575c21ff5a
3 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,63 @@
From 2748f99730e699b2597653ddef1c4109cae976b2 Mon Sep 17 00:00:00 2001
From: Brandon Philips <brandon@ifup.co>
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)

View File

@ -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
}

View File

@ -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