diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a454c06 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +iso diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0718097 --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +.PHONY: deploy +deploy: + ./deploy-workbench.sh + +# faster deploy for debugging/development purposes +# on pedro's laptop the difference is around 14s vs 1min20s +deploy_dev: + DEBUG=1 ./deploy-workbench.sh + +# force deploy of bullseye +deploy_bookworm: + VERSION_CODENAME='bookworm' ./deploy-workbench.sh + +# remove all files generated by deploy process +deploy_clean: + rm -rf iso + +install_dependencies: + # Install debian requirements + cat requirements.debian.txt | grep -v '^#' | sudo xargs apt install -y + +boot_iso: + sudo qemu-system-x86_64 \ + -enable-kvm -m 2G -vga qxl -netdev user,id=wan -device virtio-net,netdev=wan,id=nic1 \ + -drive format=raw,file=iso/workbench.iso,cache=none,if=virtio + +# src https://www.ubuntubuzz.com/2021/04/how-to-boot-uefi-on-qemu.html +# needs `sudo apt-get install ovmf` +boot_iso_uefi: + sudo qemu-system-x86_64 \ + -bios /usr/share/ovmf/OVMF.fd \ + -enable-kvm -m 2G -vga qxl -netdev user,id=wan -device virtio-net,netdev=wan,id=nic1 \ + -drive format=raw,file=deploy/iso/WORKBENCH_debug.iso,cache=none,if=virtio + +boot_iso_uefi_secureboot: + # For ovmf 2020.08-1, the change of boot order is usually necessary because the UEFI shell has the highest boot priority in OVMF_VARS*.ms.fd. + sudo cp /usr/share/OVMF/OVMF_VARS_4M.ms.fd /tmp/efivars_4M.fd + # src https://wiki.debian.org/SecureBoot/VirtualMachine + sudo qemu-system-x86_64 \ + -machine q35,smm=on -global driver=cfi.pflash01,property=secure,value=on \ + -drive if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd,readonly=on \ + -drive if=pflash,format=raw,unit=1,file=/tmp/efivars_4M.fd \ + -enable-kvm -m 2G -vga qxl -netdev user,id=wan -device virtio-net,netdev=wan,id=nic1 \ + -drive file=deploy/iso/workbench_debug.iso,cache=none,if=virtio,format=raw,index=0,media=disk \ + -boot menu=on diff --git a/deploy-workbench.sh b/deploy-workbench.sh new file mode 100755 index 0000000..882e676 --- /dev/null +++ b/deploy-workbench.sh @@ -0,0 +1,495 @@ +#!/bin/sh + +# Copyright (c) 2022 pangea.org AssociaciĆ³ Pangea - Coordinadora ComunicaciĆ³ per a la CooperaciĆ³ +# SPDX-License-Identifier: AGPL-3.0-or-later +# Description: This program attaches workbench-script to a ISO + +# debug +set -x +# exit on failure +set -e +# fail and exit when it cannot substitute a variable +set -u + +# inspired from Ander in https://code.ungleich.ch/ungleich-public/cdist/issues/4 +# this is a way to reuse a function used inside and outside of chroot +# this function is used both in shell and chroot +decide_if_update_str="$(cat <