mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-22 06:51:26 +02:00
commit
5278dc6ce2
41
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-packet/files/cloud-config.yml
vendored
Normal file
41
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-packet/files/cloud-config.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#cloud-config
|
||||||
|
|
||||||
|
coreos:
|
||||||
|
units:
|
||||||
|
- name: oem-reset-interfaces.service
|
||||||
|
command: start
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=Reset the bond.
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/share/oem/bin/reset-interfaces.sh
|
||||||
|
- name: oem-cloudinit.service
|
||||||
|
command: restart
|
||||||
|
runtime: yes
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=Cloudinit from Packet metadata
|
||||||
|
After=oem-reset-interfaces.service
|
||||||
|
Requires=oem-reset-interfaces.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/coreos-cloudinit --oem=packet
|
||||||
|
- name: oem-phone-home.service
|
||||||
|
command: start
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=Basic setup tasks to initialize the machine.
|
||||||
|
Wants=sys-devices-virtual-net-bond0.device
|
||||||
|
After=sys-devices-virtual-net-bond0.device
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/share/oem/bin/phone-home.sh
|
||||||
|
oem:
|
||||||
|
id: packet
|
||||||
|
name: Packet
|
||||||
|
version-id: @@OEM_VERSION_ID@@
|
||||||
|
home-url: https://packet.net
|
||||||
|
bug-report-url: https://github.com/coreos/bugs/issues
|
13
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-packet/files/phone-home.sh
vendored
Normal file
13
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-packet/files/phone-home.sh
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
API_URL=$(curl -s https://metadata.packet.net/metadata | jq ".api_url" | sed -e 's/^"//' -e 's/"$//')
|
||||||
|
|
||||||
|
while ! wget --inet4-only --spider --quiet "${API_URL}/build_info.txt"; do
|
||||||
|
echo "$0: API unavailable: $API_URL" >&2
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
logger "Making a call to tell the packet API this machine is online."
|
||||||
|
curl -X POST $API_URL/phone-home
|
||||||
|
logger "This device has been announced to the packet API."
|
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
logger "Hard reset of all network interfaces due to upstream systemd-networkd issue: https://github.com/coreos/bugs/issues/36 ."
|
||||||
|
ip link set enp1s0f0 down
|
||||||
|
ip link set enp1s0f1 down
|
||||||
|
ip link del bond0
|
||||||
|
systemctl restart systemd-networkd
|
29
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-packet/oem-packet-0.0.1.ebuild
vendored
Normal file
29
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-packet/oem-packet-0.0.1.ebuild
vendored
Normal 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
|
||||||
|
|
||||||
|
DESCRIPTION="OEM suite for Packet images"
|
||||||
|
HOMEPAGE=""
|
||||||
|
SRC_URI=""
|
||||||
|
|
||||||
|
LICENSE="Apache-2.0"
|
||||||
|
SLOT="0"
|
||||||
|
KEYWORDS="amd64 x86"
|
||||||
|
|
||||||
|
# no source directory
|
||||||
|
S="${WORKDIR}"
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
sed -e "s\\@@OEM_VERSION_ID@@\\${PVR}\\g" \
|
||||||
|
${FILESDIR}/cloud-config.yml > ${T}/cloud-config.yml || die
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
into "/usr/share/oem"
|
||||||
|
dobin ${FILESDIR}/phone-home.sh
|
||||||
|
dobin ${FILESDIR}/reset-interfaces.sh
|
||||||
|
|
||||||
|
insinto "/usr/share/oem"
|
||||||
|
doins ${T}/cloud-config.yml
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user