1
0
mirror of https://github.com/rancher/os.git synced 2025-09-08 02:01:27 +00:00

machine support for rancherOS

This commit is contained in:
wlan0
2015-04-28 04:34:32 -07:00
parent 9c7663b0d3
commit 1626247f48
8 changed files with 93 additions and 8 deletions

View File

@@ -1,5 +1,47 @@
#!/bin/bash
set -ex
if [ -n "$1" ]; then
exec mkfs.ext4 -L RANCHER_STATE $1
# Test for our magic string (it means that the disk was made by ./boot2docker init)
HEADER=`dd if=$1 bs=1 count=${#MAGIC} 2>/dev/null`
if [ "$HEADER" = "$MAGIC" ]; then
# save the preload userdata.tar file
dd if=$1 of=/userdata.tar bs=1 count=8192
fi
mkfs.ext4 -L RANCHER_STATE $1
if [ -e "/userdata.tar" ]; then
mount -t ext4 $1 /var/
mkdir -p /var/lib/rancher/conf/cloud-config.d
echo $(tar -xvf /userdata.tar)
AUTHORIZED_KEY1=$(cat /.ssh/authorized_keys)
AUTHORIZED_KEY2=$(cat /.ssh/authorized_keys2)
tee /var/lib/rancher/conf/cloud-config.d/machine.yml << EOF
#cloud-config
rancher:
network:
interfaces:
eth0:
dhcp: true
eth1:
dhcp: true
lo:
address: 127.0.0.1/8
ssh_authorized_keys:
- $AUTHORIZED_KEY1
- $AUTHORIZED_KEY2
users:
- name: docker
ssh_authorized_keys:
- $AUTHORIZED_KEY1
- $AUTHORIZED_KEY2
EOF
fi
fi

View File

@@ -33,6 +33,13 @@ if [ ! -d ${RANCHER_HOME} ]; then
chmod 2755 ${RANCHER_HOME}
fi
DOCKER_HOME=/home/docker
if [ ! -d ${DOCKER_HOME} ]; then
mkdir -p ${DOCKER_HOME}
chown docker:docker ${DOCKER_HOME}
chmod 2755 ${DOCKER_HOME}
fi
for i in $(</proc/cmdline); do
case $i in
rancher.password=*)