Update Readme and cleanup raspi_master.yaml

This commit is contained in:
notplants 2021-02-03 11:48:55 +01:00
parent 086492de16
commit dca65df5b8
8 changed files with 62 additions and 84 deletions

4
.gitignore vendored
View File

@ -12,3 +12,7 @@ raspi_4.yaml
vmdb2/*
.idea
vmdb2
fetch.sh
compress.sh
deploy.sh
img

View File

@ -1,6 +1,34 @@
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,
as a starting point for building the peach image
This vmdb2 script runs:
`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 vmdb2 dosfstools qemu-user-static binfmt-support time kpartx
```
# 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/

View File

@ -1,5 +1,3 @@
#!/usr/bin/env bash
WD=/home/notplants/computer/projects/peachcloud/image-specs
cd $WD/vmdb2
sudo ./vmdb2 --verbose --rootfs-tarball=$WD/my_raspi.tar.gz --output $WD/my_raspi.img $WD/raspi_3.yaml --log $WD/my_raspi.log
rm -f raspi_3.img
rm -f raspi_3.log
v

View File

@ -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

View File

@ -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"'

View File

@ -1 +0,0 @@
scp -i /home/notplants/.ssh/do_rsa root@165.227.141.30:/srv/image-specs/raspi_3.img peach.img

View File

@ -2,7 +2,7 @@
steps:
- mkimg: "{{ output }}"
size: 1500M
size: 3000M
- mklabel: msdos
device: "{{ output }}"
@ -48,7 +48,6 @@ steps:
- non-free
unless: rootfs_unpacked
# for now it appears this is not actually running
- create-file: /etc/apt/sources.list
trailing-newline: '1'
contents: |
@ -78,13 +77,6 @@ steps:
tag: /
unless: rootfs_unpacked
- apt: install
packages:
- git
- python
tag: /
unless: rootfs_unpacked
- cache-rootfs: /
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/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"
#not needed for peach
#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 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*
root-fs: /
- shell: |
echo "another test" > "${ROOT?}/srv/secondtest.txt"
root-fs: /
# Copy the relevant device tree files to the boot partition
- chroot: /
shell: |
@ -140,27 +128,27 @@ steps:
ls -aR /boot
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
# clears /etc/resolv.conf on its own.
- shell: |
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: /