commit
0552e838e2
|
@ -12,3 +12,7 @@ raspi_4.yaml
|
||||||
vmdb2/*
|
vmdb2/*
|
||||||
.idea
|
.idea
|
||||||
vmdb2
|
vmdb2
|
||||||
|
fetch.sh
|
||||||
|
compress.sh
|
||||||
|
deploy.sh
|
||||||
|
img
|
44
README.md
44
README.md
|
@ -1,6 +1,42 @@
|
||||||
This is a fork of https://salsa.debian.org/raspi-team/image-specs/-/tree/master
|
This is a fork of the [vmdb2 script](https://salsa.debian.org/raspi-team/image-specs/-/tree/master) for building a [debian image for raspberry pi](https://wiki.debian.org/RaspberryPi),
|
||||||
|
which uses vmdb2 to build a disc image for PeachCloud
|
||||||
|
for the Raspberry pi with all configuration and peach microservices pre-installed.
|
||||||
|
|
||||||
been playing around with using their vmdb2 specfile to build debian image for raspberry pi,
|
This vmdb2 script runs:
|
||||||
as a starting point for building the peach image
|
`python setup_dev_env.py -i -n peach`,
|
||||||
|
the python setup script from [peach-config](https://github.com/peachcloud/peach-config).
|
||||||
|
|
||||||
not sure this is the best way yet, but its working
|
# Installing vmdb2
|
||||||
|
|
||||||
|
Run,
|
||||||
|
```shell
|
||||||
|
sudo apt install -y dosfstools qemu-user-static binfmt-support time kpartx
|
||||||
|
```
|
||||||
|
|
||||||
|
This script requires the latest version of vmdb2 which is not currently available via apt.
|
||||||
|
After installing the above, clone the vmdb2 repository and add it to your path.
|
||||||
|
```shell
|
||||||
|
git clone https://gitlab.com/larswirzenius/vmdb2.git
|
||||||
|
cd vmdb2; ln -s vmdb2 /usr/local/bin/vmdb2
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# To Build A New Image
|
||||||
|
|
||||||
|
Run,
|
||||||
|
```shell
|
||||||
|
make raspi_3.img
|
||||||
|
```
|
||||||
|
|
||||||
|
Theoretically, you could also use this script to build images for other pi versions,
|
||||||
|
by running the same command with `raspi_0w.img` or `raspi_2.img` or `raspi_3.img`
|
||||||
|
|
||||||
|
|
||||||
|
# Installing The Image
|
||||||
|
|
||||||
|
This image can then be flashed to an SD card using dd or etcher.
|
||||||
|
|
||||||
|
|
||||||
|
# Publishing The Image
|
||||||
|
|
||||||
|
PeachCloud images are versioned and published for release at http://releases.peachcloud.org/
|
8
build.sh
8
build.sh
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
rm -f raspi_3.img
|
||||||
WD=/home/notplants/computer/projects/peachcloud/image-specs
|
rm -f raspi_3.log
|
||||||
cd $WD/vmdb2
|
v
|
||||||
sudo ./vmdb2 --verbose --rootfs-tarball=$WD/my_raspi.tar.gz --output $WD/my_raspi.img $WD/raspi_3.yaml --log $WD/my_raspi.log
|
|
||||||
|
|
34
compress.sh
34
compress.sh
|
@ -1,34 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Copies raspi3.img into compr.img, resulting in many consecutive zero bytes
|
|
||||||
# which are nicely compressible.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
qemu-img create -f raw compr.img 1100M
|
|
||||||
|
|
||||||
# copy partition table from raspi3.img
|
|
||||||
sfdisk --quiet --dump raspi3.img | sfdisk --quiet compr.img
|
|
||||||
|
|
||||||
readarray rmappings < <(sudo kpartx -asv raspi3.img)
|
|
||||||
readarray cmappings < <(sudo kpartx -asv compr.img)
|
|
||||||
|
|
||||||
# copy the vfat boot partition as-is
|
|
||||||
set -- ${rmappings[0]}
|
|
||||||
rboot="$3"
|
|
||||||
set -- ${cmappings[0]}
|
|
||||||
cboot="$3"
|
|
||||||
sudo dd if=/dev/mapper/${rboot?} of=/dev/mapper/${cboot?} bs=5M status=none
|
|
||||||
|
|
||||||
# copy the ext4 root partition in a space-saving way
|
|
||||||
set -- ${rmappings[1]}
|
|
||||||
rroot="$3"
|
|
||||||
set -- ${cmappings[1]}
|
|
||||||
croot="$3"
|
|
||||||
sudo e2fsck -y -f /dev/mapper/${rroot?}
|
|
||||||
sudo resize2fs /dev/mapper/${rroot?} 800M
|
|
||||||
sudo e2image -rap /dev/mapper/${rroot?} /dev/mapper/${croot?}
|
|
||||||
|
|
||||||
sudo kpartx -ds raspi3.img
|
|
||||||
sudo kpartx -ds compr.img
|
|
||||||
|
|
||||||
xz -8 -f compr.img
|
|
|
@ -1,5 +0,0 @@
|
||||||
KEY_PATH=/home/notplants/.ssh/do_rsa
|
|
||||||
|
|
||||||
rsync -avzh --exclude target --exclude .idea --exclude .git --exclude *.img -e "ssh -i $KEY_PATH" . root@165.227.141.30:/srv/image-specs/
|
|
||||||
|
|
||||||
ssh -i $KEY_PATH root@165.227.141.30 'cd /srv/image-specs; echo "hi"'
|
|
1
fetch.sh
1
fetch.sh
|
@ -1 +0,0 @@
|
||||||
scp -i /home/notplants/.ssh/do_rsa root@165.227.141.30:/srv/image-specs/raspi_3.img peach.img
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- mkimg: "{{ output }}"
|
- mkimg: "{{ output }}"
|
||||||
size: 1500M
|
size: 3000M
|
||||||
|
|
||||||
- mklabel: msdos
|
- mklabel: msdos
|
||||||
device: "{{ output }}"
|
device: "{{ output }}"
|
||||||
|
@ -48,7 +48,6 @@ steps:
|
||||||
- non-free
|
- non-free
|
||||||
unless: rootfs_unpacked
|
unless: rootfs_unpacked
|
||||||
|
|
||||||
# for now it appears this is not actually running
|
|
||||||
- create-file: /etc/apt/sources.list
|
- create-file: /etc/apt/sources.list
|
||||||
trailing-newline: '1'
|
trailing-newline: '1'
|
||||||
contents: |
|
contents: |
|
||||||
|
@ -78,13 +77,6 @@ steps:
|
||||||
tag: /
|
tag: /
|
||||||
unless: rootfs_unpacked
|
unless: rootfs_unpacked
|
||||||
|
|
||||||
- apt: install
|
|
||||||
packages:
|
|
||||||
- git
|
|
||||||
- python
|
|
||||||
tag: /
|
|
||||||
unless: rootfs_unpacked
|
|
||||||
|
|
||||||
- cache-rootfs: /
|
- cache-rootfs: /
|
||||||
unless: rootfs_unpacked
|
unless: rootfs_unpacked
|
||||||
|
|
||||||
|
@ -96,8 +88,9 @@ steps:
|
||||||
|
|
||||||
install -m 644 -o root -g root rootfs/etc/fstab "${ROOT?}/etc/fstab"
|
install -m 644 -o root -g root rootfs/etc/fstab "${ROOT?}/etc/fstab"
|
||||||
|
|
||||||
install -m 644 -o root -g root rootfs/etc/network/interfaces.d/eth0 "${ROOT?}/etc/network/interfaces.d/eth0"
|
#not needed for peach
|
||||||
install -m 600 -o root -g root rootfs/etc/network/interfaces.d/wlan0 "${ROOT?}/etc/network/interfaces.d/wlan0"
|
#install -m 644 -o root -g root rootfs/etc/network/interfaces.d/eth0 "${ROOT?}/etc/network/interfaces.d/eth0"
|
||||||
|
#install -m 600 -o root -g root rootfs/etc/network/interfaces.d/wlan0 "${ROOT?}/etc/network/interfaces.d/wlan0"
|
||||||
|
|
||||||
install -m 755 -o root -g root rootfs/usr/local/sbin/rpi-set-sysconf "${ROOT?}/usr/local/sbin/rpi-set-sysconf"
|
install -m 755 -o root -g root rootfs/usr/local/sbin/rpi-set-sysconf "${ROOT?}/usr/local/sbin/rpi-set-sysconf"
|
||||||
install -m 644 -o root -g root rootfs/etc/systemd/system/rpi-set-sysconf.service "${ROOT?}/etc/systemd/system/"
|
install -m 644 -o root -g root rootfs/etc/systemd/system/rpi-set-sysconf.service "${ROOT?}/etc/systemd/system/"
|
||||||
|
@ -116,11 +109,6 @@ steps:
|
||||||
rm -f "${ROOT?}"/etc/ssh/ssh_host_*_key*
|
rm -f "${ROOT?}"/etc/ssh/ssh_host_*_key*
|
||||||
root-fs: /
|
root-fs: /
|
||||||
|
|
||||||
|
|
||||||
- shell: |
|
|
||||||
echo "another test" > "${ROOT?}/srv/secondtest.txt"
|
|
||||||
root-fs: /
|
|
||||||
|
|
||||||
# Copy the relevant device tree files to the boot partition
|
# Copy the relevant device tree files to the boot partition
|
||||||
- chroot: /
|
- chroot: /
|
||||||
shell: |
|
shell: |
|
||||||
|
@ -140,27 +128,27 @@ steps:
|
||||||
ls -aR /boot
|
ls -aR /boot
|
||||||
sed -i 's/.dev.mmcblk0p2/LABEL=RASPIROOT/' /boot/firmware/cmdline.txt
|
sed -i 's/.dev.mmcblk0p2/LABEL=RASPIROOT/' /boot/firmware/cmdline.txt
|
||||||
|
|
||||||
|
# BEGINNING OF PEACH CONFIG
|
||||||
|
- shell: |
|
||||||
|
echo "This peach base image was configured on $(date +%Y%m%d) with peach-img-builder version 0.1.0" > "${ROOT?}/srv/peach-img-provenance.log"
|
||||||
|
root-fs: /
|
||||||
|
|
||||||
|
- apt: install
|
||||||
|
packages:
|
||||||
|
- git
|
||||||
|
- python
|
||||||
|
- wget
|
||||||
|
tag: /
|
||||||
|
|
||||||
|
- chroot: /
|
||||||
|
shell: |
|
||||||
|
git clone -b no-input https://github.com/peachcloud/peach-config.git /srv/peach-config
|
||||||
|
cd /srv/peach-config/ && python3 /srv/peach-config/scripts/setup_dev_env.py -i -n peach
|
||||||
|
|
||||||
|
# END OF PEACH CONFIG
|
||||||
|
|
||||||
# TODO(https://github.com/larswirzenius/vmdb2/issues/24): remove once vmdb
|
# TODO(https://github.com/larswirzenius/vmdb2/issues/24): remove once vmdb
|
||||||
# clears /etc/resolv.conf on its own.
|
# clears /etc/resolv.conf on its own.
|
||||||
- shell: |
|
- shell: |
|
||||||
rm "${ROOT?}/etc/resolv.conf"
|
rm "${ROOT?}/etc/resolv.conf"
|
||||||
root-fs: /
|
|
||||||
|
|
||||||
|
|
||||||
- create-file: /srv/hi.txt
|
|
||||||
trailing-newline: '1'
|
|
||||||
contents: |
|
|
||||||
hello
|
|
||||||
here
|
|
||||||
are
|
|
||||||
some
|
|
||||||
lines
|
|
||||||
unless: rootfs_unpacked
|
|
||||||
|
|
||||||
|
|
||||||
- shell: |
|
|
||||||
echo "does this work?" > /srv/turtle.txt
|
|
||||||
|
|
||||||
echo "and also this?" > /srv/cat.txt
|
|
||||||
|
|
||||||
root-fs: /
|
root-fs: /
|
Loading…
Reference in New Issue