feat(coreos-base/oem): add the initial oem partition support

this (great looking) code adds the oem partition and supporting scripts
and services. AMI is the first target use case.
This commit is contained in:
Alex Polvi 2013-07-17 13:46:40 -07:00
parent 50959ce3c9
commit 3cd7f13223
13 changed files with 87 additions and 0 deletions

View File

@ -152,6 +152,7 @@ RDEPEND="${RDEPEND}
sys-process/criu
app-misc/ca-certificates
virtual/udev
coreos-base/oem-service
"
# TODO(dianders):

View File

@ -105,6 +105,7 @@ RDEPEND="${RDEPEND}
dev-libs/protobuf-c
app-text/asciidoc
app-text/xmlto
sys-apps/gptfdisk
"
# Host dependencies that create usernames/groups we need to pull over to target.

View File

@ -0,0 +1,16 @@
#!/bin/bash
USER_DIR="/home/core/user"
if [ ! -d ${USER_DIR}/.ssh ] ; then
mkdir -p ${USER_DIR}/.ssh
chmod 700 ${USER_DIR}/.ssh
fi
# Fetch public key using HTTP
curl -s http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/my-key
if [ $? -eq 0 ] ; then
cat /tmp/my-key >> ${USER_DIR}/.ssh/authorized_keys
chmod 700 ${USER_DIR}/.ssh/authorized_keys
rm /tmp/my-key
fi
chown -R core: $USER_DIR/.ssh

View File

@ -0,0 +1,3 @@
[service]
Type=oneshot
ExecStart=/usr/share/oem/bin/install-ec2-key.sh

View File

@ -0,0 +1,3 @@
#!/bin/bash
/usr/share/oem/usr/bin/install-ec2-key.sh

View File

@ -0,0 +1 @@
oem-ami-0.0.1.ebuild

View File

@ -0,0 +1,24 @@
#
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Copyright (c) 2013 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
# $Header:$
#
EAPI=2
DESCRIPTION="oem suite for ami images"
HOMEPAGE=""
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""
src_install() {
dobin "${FILESDIR}"/install-ec2-key.sh
exeinto "/"
doexe ${FILESDIR}/run.sh
}

View File

@ -0,0 +1,6 @@
[Service]
Type=oneshot
ExecStart=/usr/bin/run-oem.sh
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,6 @@
#!/bin/bash
# Each oem implemenation has a run.sh that boostraps its OEM process for systemd
OEM_EXEC="/usr/share/oem/run.sh"
[ -e $OEM_EXEC ] && exec $OEM_EXEC || exit 0

View File

@ -0,0 +1 @@
oem-service-0.0.1.ebuild

View File

@ -0,0 +1,25 @@
#
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Copyright (c) 2013 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
# $Header:$
#
EAPI=2
inherit systemd
DESCRIPTION="oem service"
HOMEPAGE=""
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""
src_install() {
dobin ${FILESDIR}/run-oem.sh
systemd_dounit "${FILESDIR}"/${PN}.service
systemd_enable_service multi-user.target ${PN}.service
}