mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-18 02:16:59 +02:00
fix(oem-rackspace): add coreos-setup-environment for rackspace
This commit is contained in:
parent
94e3404c2c
commit
f7aa6084b7
35
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-rackspace/files/coreos-setup-environment
vendored
Executable file
35
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-rackspace/files/coreos-setup-environment
vendored
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash +x
|
||||||
|
|
||||||
|
ENV=$1
|
||||||
|
|
||||||
|
if [ -z "$ENV" ]; then
|
||||||
|
echo usage: $0 /etc/environment
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# test for rw
|
||||||
|
touch $ENV
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo exiting, unable to modify: $ENV
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i -e '/^COREOS_PUBLIC_IPV4=/d' \
|
||||||
|
-e '/^COREOS_PRIVATE_IPV4=/d' \
|
||||||
|
"${ENV}"
|
||||||
|
|
||||||
|
# We spin loop until the nova-agent sets up the ip addresses
|
||||||
|
function get_ip () {
|
||||||
|
IF=$1
|
||||||
|
IP=
|
||||||
|
while [ 1 ]; do
|
||||||
|
IP=$(ifconfig $IF | awk '/inet /{print $2}')
|
||||||
|
if [ "$IP" != "" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep .1
|
||||||
|
done
|
||||||
|
echo $IP
|
||||||
|
}
|
||||||
|
|
||||||
|
echo COREOS_PUBLIC_IPV4=$(get_ip eth0) >> $ENV
|
||||||
|
echo COREOS_PRIVATE_IPV4=$(get_ip eth1) >> $ENV
|
@ -28,4 +28,7 @@ src_install() {
|
|||||||
rsync --exclude=".git" -aq ${S}/ ${D}/nova-agent/
|
rsync --exclude=".git" -aq ${S}/ ${D}/nova-agent/
|
||||||
insinto "/"
|
insinto "/"
|
||||||
doins ${FILESDIR}/cloud-config.yml
|
doins ${FILESDIR}/cloud-config.yml
|
||||||
|
|
||||||
|
into "/"
|
||||||
|
dobin ${FILESDIR}/coreos-setup-environment
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user