From dca65df5b868e57969b2f8b44d92bc7a21c9b0a9 Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 3 Feb 2021 11:48:55 +0100 Subject: [PATCH] Update Readme and cleanup raspi_master.yaml --- .gitignore | 4 ++ README.md | 36 +++++++++++++-- build.sh | 8 ++-- compress.sh | 34 -------------- deploy.sh | 5 -- fetch.sh | 1 - original-reamde.md => original-readme.md | 0 raspi_master.yaml | 58 ++++++++++-------------- 8 files changed, 62 insertions(+), 84 deletions(-) delete mode 100755 compress.sh delete mode 100755 deploy.sh delete mode 100755 fetch.sh rename original-reamde.md => original-readme.md (100%) diff --git a/.gitignore b/.gitignore index c55daa4..499639a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,7 @@ raspi_4.yaml vmdb2/* .idea vmdb2 +fetch.sh +compress.sh +deploy.sh +img \ No newline at end of file diff --git a/README.md b/README.md index 49f1a57..24554f4 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file +# 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/ \ No newline at end of file diff --git a/build.sh b/build.sh index 50b6850..5bab78d 100755 --- a/build.sh +++ b/build.sh @@ -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 \ No newline at end of file diff --git a/compress.sh b/compress.sh deleted file mode 100755 index 368eb1b..0000000 --- a/compress.sh +++ /dev/null @@ -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 diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index e0a74ae..0000000 --- a/deploy.sh +++ /dev/null @@ -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"' diff --git a/fetch.sh b/fetch.sh deleted file mode 100755 index dfb2f33..0000000 --- a/fetch.sh +++ /dev/null @@ -1 +0,0 @@ -scp -i /home/notplants/.ssh/do_rsa root@165.227.141.30:/srv/image-specs/raspi_3.img peach.img \ No newline at end of file diff --git a/original-reamde.md b/original-readme.md similarity index 100% rename from original-reamde.md rename to original-readme.md diff --git a/raspi_master.yaml b/raspi_master.yaml index 086e56e..c683596 100644 --- a/raspi_master.yaml +++ b/raspi_master.yaml @@ -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: / \ No newline at end of file