Skip to content

Commit 08b4262

Browse files
authored
Merge pull request #17 from firecyberice/add-cloud-init
Add cloud init
2 parents 36d972d + 5393745 commit 08b4262

File tree

9 files changed

+43
-64
lines changed

9 files changed

+43
-64
lines changed

builder/chroot-script.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ curl -sSL https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/br
140140
# "libraspberrypi-dev=${KERNEL_BUILD}" \
141141
# "libraspberrypi-bin=${KERNEL_BUILD}"
142142

143-
# add user pirate to group video (for using the Raspberry Pi camera)
144-
usermod -a -G video pirate
145-
146143
# enable serial console
147144
printf "# Spawn a getty on Raspberry Pi serial line\nT0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100\n" >> /etc/inittab
148145

@@ -203,13 +200,13 @@ apt-get install -y \
203200
apt-get install -y \
204201
lsb-release
205202

206-
# install Device Init directly from GitHub releases
207-
curl -sSL "https://github.com/hypriot/device-init/releases/download/v$DEVICE_INIT_VERSION/device-init_linux_arm" \
208-
> /usr/local/bin/device-init
209-
chmod +x /usr/local/bin/device-init
210-
curl -sSL https://github.com/hypriot/device-init/raw/master/package/etc/systemd/system/device-init.service > /etc/systemd/system/device-init.service
211-
chmod +x /etc/systemd/system/device-init.service
212-
systemctl enable device-init.service
203+
# install cloud-init
204+
apt-get install -y \
205+
cloud-init
206+
207+
mkdir -p /var/lib/cloud/seed/nocloud-net
208+
ln -s /boot/user-data /var/lib/cloud/seed/nocloud-net/user-data
209+
ln -s /boot/meta-data /var/lib/cloud/seed/nocloud-net/meta-data
213210

214211
# install Docker Machine directly from GitHub releases
215212
curl -sSL "https://github.com/docker/machine/releases/download/v${DOCKER_MACHINE_VERSION}/docker-machine-Linux-aarch64" \

builder/files/boot/device-init.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

builder/files/boot/meta-data

Whitespace-only changes.

builder/files/boot/user-data

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#cloud-config
2+
# vim: syntax=yaml
3+
#
4+
hostname: black-pearl
5+
manage_etc_hosts: true
6+
7+
users:
8+
- name: pirate
9+
gecos: "Hypriot Pirate"
10+
sudo: ALL=(ALL) NOPASSWD:ALL
11+
shell: /bin/bash
12+
groups: users,docker,video
13+
plain_text_passwd: hypriot
14+
lock_passwd: false
15+
ssh_pwauth: true
16+
chpasswd: { expire: false }
17+
18+
package_upgrade: false
19+

builder/test-integration/spec/hypriotos-image/base/users_spec.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,10 @@
2424

2525
describe file('/etc/sudoers.d') do
2626
it { should be_directory }
27-
it { should be_mode 755 }
27+
it { should be_mode 750 }
2828
it { should be_owned_by 'root' }
2929
end
3030

31-
describe file('/etc/sudoers.d/user-pirate') do
32-
it { should be_file }
33-
it { should be_mode 440 }
34-
it { should be_owned_by 'root' }
35-
its(:content) { should match /pirate ALL=NOPASSWD: ALL/ }
36-
end
37-
3831
describe file('/root/.bashrc') do
3932
it { should be_file }
4033
it { should be_mode 644 }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'spec_helper'
2+
3+
describe package('cloud-init') do
4+
it { should be_installed }
5+
end
6+
7+
describe file('/boot/user-data') do
8+
it { should be_file }
9+
its(:content) { should match /hostname: / }
10+
end
11+
12+
describe file('/boot/meta-data') do
13+
it { should be_file }
14+
end

builder/test-integration/spec/hypriotos-image/device-init_spec.rb

Lines changed: 0 additions & 28 deletions
This file was deleted.

builder/test-integration/spec/hypriotos-image/docker_spec.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@
7272
it { should be_owned_by 'root' }
7373
end
7474

75-
describe file('/etc/bash_completion.d/docker') do
76-
it { should be_file }
77-
it { should be_mode 644 }
78-
it { should be_owned_by 'root' }
79-
it { should be_file }
80-
end
81-
8275
describe command('docker -v') do
8376
its(:stdout) { should match /Docker version 17.09.0-ce, build/ }
8477
its(:exit_status) { should eq 0 }

versions.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# config vars for the root file system
2-
HYPRIOT_OS_VERSION="v1.1.1"
3-
ROOTFS_TAR_CHECKSUM="5698b4f7363316d25ce735024836b499a4306802518b81d7231d457bbefd4f53"
2+
HYPRIOT_OS_VERSION="v1.2.1"
3+
ROOTFS_TAR_CHECKSUM="1b121bd2a0aa7478248979c3cddb00b74bb12f4cee1734a6ebff74491045397b"
44

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

0 commit comments

Comments
 (0)