Merge pull request #149 from polvi/etcd-bootstrap

feat(oem-service): make etcd bootstrapping optional, and only supported ...
This commit is contained in:
polvi 2013-08-01 19:29:28 -07:00
commit 8aac92d989
10 changed files with 35 additions and 4 deletions

View File

@ -20,4 +20,7 @@ src_install() {
exeinto "/" exeinto "/"
doexe ${FILESDIR}/run.sh doexe ${FILESDIR}/run.sh
insinto "/"
doins ${FILESDIR}/oem-release
} }

View File

@ -0,0 +1,13 @@
#!/bin/bash
OEM_RELEASE="/usr/share/oem/oem-release"
VIRT=
if [ -e "${OEM_RELEASE}" ]; then
VIRT=$(cat ${OEM_RELEASE})
else
VIRT=$(systemd-detect-virt)
fi
echo $VIRT

View File

@ -19,6 +19,7 @@ IUSE=""
src_install() { src_install() {
dobin ${FILESDIR}/run-oem.sh dobin ${FILESDIR}/run-oem.sh
dobin ${FILESDIR}/coreos-detect-virt
systemd_dounit "${FILESDIR}"/${PN}.service systemd_dounit "${FILESDIR}"/${PN}.service
systemd_enable_service multi-user.target ${PN}.service systemd_enable_service multi-user.target ${PN}.service

View File

@ -1,5 +1,12 @@
#!/bin/bash #!/bin/bash
VIRT=$(coreos-detect-virt)
if [ "${VIRT}" != "ec2" ]; then
# all of this is currently dependent on ec2, we'll refactor as we add more images
exit 0
fi
C10N_ENDPOINT=https://core-api.appspot.com/v1/c10n/group C10N_ENDPOINT=https://core-api.appspot.com/v1/c10n/group
META_URL="http://169.254.169.254/latest" META_URL="http://169.254.169.254/latest"

View File

@ -1,14 +1,21 @@
#!/bin/bash #!/bin/bash
STATE=/var/lib/etcd
mkdir -p $STATE
VIRT=$(coreos-detect-virt)
if [ "${VIRT}" != "ec2" ]; then
echo "Detected environment \"${VIRT}\", just starting solo master..."
exec /usr/bin/etcd -v -d $STATE
fi
/usr/bin/coreos-c10n /usr/bin/coreos-c10n
META_URL="http://169.254.169.254/latest" META_URL="http://169.254.169.254/latest"
MY_IP=$(curl -s $META_URL/meta-data/local-ipv4) MY_IP=$(curl -s $META_URL/meta-data/local-ipv4)
BOOTSTRAP="/var/run/etcd/bootstrap.config" BOOTSTRAP="/var/run/etcd/bootstrap.config"
# for etcd
STATE=/var/lib/etcd
mkdir -p $STATE
[ ! -e $BOOTSTRAP ] && echo bootstrap config missing && exit 1 [ ! -e $BOOTSTRAP ] && echo bootstrap config missing && exit 1