mirror of
https://github.com/rancher/os.git
synced 2025-09-16 23:21:19 +00:00
machine support for rancherOS
This commit is contained in:
@@ -26,8 +26,9 @@ RUN rm /sbin/poweroff /sbin/reboot /sbin/halt && \
|
||||
addgroup -g 1101 docker && \
|
||||
addgroup -g 1103 sudo && \
|
||||
adduser -u 1100 -G rancher -D -h /home/rancher -s /bin/bash rancher && \
|
||||
adduser -u 1101 -G docker -D -h /home/docker -s /bin/bash docker && \
|
||||
sed -i 's/\(^docker.*\)/\1rancher/g' /etc/group && \
|
||||
sed -i 's/\(^sudo.*\)/\1rancher/g' /etc/group && \
|
||||
sed -i 's/\(^sudo.*\)/\1rancher,docker/g' /etc/group && \
|
||||
echo '%sudo ALL=(ALL) ALL' >> /etc/sudoers
|
||||
COPY scripts/dockerimages/scripts/inputrc /etc/inputrc
|
||||
COPY scripts/dockerimages/scripts/entry.sh /usr/sbin/entry.sh
|
||||
|
@@ -3,6 +3,9 @@ COPY scripts/dockerimages/scripts/console.sh /usr/sbin/
|
||||
COPY scripts/dockerimages/scripts/update-ssh-keys /usr/bin/
|
||||
COPY scripts/dockerimages/scripts/rancheros-install /usr/sbin/
|
||||
RUN sed -i 's/rancher:!/rancher:*/g' /etc/shadow && \
|
||||
sed -i 's/docker:!/docker:*/g' /etc/shadow && \
|
||||
echo '## allow password less for rancher user' >> /etc/sudoers && \
|
||||
echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
|
||||
echo '## allow password less for docker user' >> /etc/sudoers && \
|
||||
echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
CMD ["/usr/sbin/console.sh"]
|
||||
|
2
scripts/dockerimages/12-acpid
Normal file
2
scripts/dockerimages/12-acpid
Normal file
@@ -0,0 +1,2 @@
|
||||
FROM base
|
||||
ENTRYPOINT ["/usr/sbin/acpid", "-d"]
|
@@ -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
|
||||
|
||||
|
@@ -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=*)
|
||||
|
@@ -12,6 +12,7 @@ RUN addgroup --gid 1100 rancher && \
|
||||
addgroup --gid 1101 docker && \
|
||||
useradd -u 1100 -g rancher -G docker,sudo -m -s /bin/bash rancher && \
|
||||
echo '## allow password less for rancher user' >> /etc/sudoers && \
|
||||
echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
|
||||
echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
ENTRYPOINT ["/usr/sbin/entry.sh"]
|
||||
CMD ["/usr/sbin/console.sh"]
|
||||
|
Reference in New Issue
Block a user