Skip to content

Commit

Permalink
Merge pull request #17 from firecyberice/add-cloud-init
Browse files Browse the repository at this point in the history
Add cloud init
  • Loading branch information
DieterReuter authored Oct 13, 2017
2 parents 36d972d + 5393745 commit 08b4262
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 64 deletions.
17 changes: 7 additions & 10 deletions builder/chroot-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ curl -sSL https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/br
# "libraspberrypi-dev=${KERNEL_BUILD}" \
# "libraspberrypi-bin=${KERNEL_BUILD}"

# add user pirate to group video (for using the Raspberry Pi camera)
usermod -a -G video pirate

# enable serial console
printf "# Spawn a getty on Raspberry Pi serial line\nT0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100\n" >> /etc/inittab

Expand Down Expand Up @@ -203,13 +200,13 @@ apt-get install -y \
apt-get install -y \
lsb-release

# install Device Init directly from GitHub releases
curl -sSL "https://github.com/hypriot/device-init/releases/download/v$DEVICE_INIT_VERSION/device-init_linux_arm" \
> /usr/local/bin/device-init
chmod +x /usr/local/bin/device-init
curl -sSL https://github.com/hypriot/device-init/raw/master/package/etc/systemd/system/device-init.service > /etc/systemd/system/device-init.service
chmod +x /etc/systemd/system/device-init.service
systemctl enable device-init.service
# install cloud-init
apt-get install -y \
cloud-init

mkdir -p /var/lib/cloud/seed/nocloud-net
ln -s /boot/user-data /var/lib/cloud/seed/nocloud-net/user-data
ln -s /boot/meta-data /var/lib/cloud/seed/nocloud-net/meta-data

# install Docker Machine directly from GitHub releases
curl -sSL "https://github.com/docker/machine/releases/download/v${DOCKER_MACHINE_VERSION}/docker-machine-Linux-aarch64" \
Expand Down
9 changes: 0 additions & 9 deletions builder/files/boot/device-init.yaml

This file was deleted.

Empty file added builder/files/boot/meta-data
Empty file.
19 changes: 19 additions & 0 deletions builder/files/boot/user-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#cloud-config
# vim: syntax=yaml
#
hostname: black-pearl
manage_etc_hosts: true

users:
- name: pirate
gecos: "Hypriot Pirate"
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
groups: users,docker,video
plain_text_passwd: hypriot
lock_passwd: false
ssh_pwauth: true
chpasswd: { expire: false }

package_upgrade: false

Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,10 @@

describe file('/etc/sudoers.d') do
it { should be_directory }
it { should be_mode 755 }
it { should be_mode 750 }
it { should be_owned_by 'root' }
end

describe file('/etc/sudoers.d/user-pirate') do
it { should be_file }
it { should be_mode 440 }
it { should be_owned_by 'root' }
its(:content) { should match /pirate ALL=NOPASSWD: ALL/ }
end

describe file('/root/.bashrc') do
it { should be_file }
it { should be_mode 644 }
Expand Down
14 changes: 14 additions & 0 deletions builder/test-integration/spec/hypriotos-image/cloud-init_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'spec_helper'

describe package('cloud-init') do
it { should be_installed }
end

describe file('/boot/user-data') do
it { should be_file }
its(:content) { should match /hostname: / }
end

describe file('/boot/meta-data') do
it { should be_file }
end
28 changes: 0 additions & 28 deletions builder/test-integration/spec/hypriotos-image/device-init_spec.rb

This file was deleted.

7 changes: 0 additions & 7 deletions builder/test-integration/spec/hypriotos-image/docker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@
it { should be_owned_by 'root' }
end

describe file('/etc/bash_completion.d/docker') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'root' }
it { should be_file }
end

describe command('docker -v') do
its(:stdout) { should match /Docker version 17.09.0-ce, build/ }
its(:exit_status) { should eq 0 }
Expand Down
4 changes: 2 additions & 2 deletions versions.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# config vars for the root file system
HYPRIOT_OS_VERSION="v1.1.1"
ROOTFS_TAR_CHECKSUM="5698b4f7363316d25ce735024836b499a4306802518b81d7231d457bbefd4f53"
HYPRIOT_OS_VERSION="v1.2.1"
ROOTFS_TAR_CHECKSUM="1b121bd2a0aa7478248979c3cddb00b74bb12f4cee1734a6ebff74491045397b"

# name of the ready made raw image for RPi
RAW_IMAGE="rpi-raw.img"
Expand Down

0 comments on commit 08b4262

Please sign in to comment.