Add trisquel-automatic-netinstall-qemu.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2024-07-02 18:33:11 +02:00
parent e7bda3409d
commit 647e421c21
Signed by: GNUtoo
GPG Key ID: 5F5DFCC14177E263
9 changed files with 381 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# You should have received a copy of the GNU General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
# Files produced by the build system.
/autom4te.cache/**
/gnupg/**
/grub/**
/grub.iso
/Makefile
/preseed.img
/rootfs.img
/rootfs.img.tmp

View File

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGNQMswBEACpaLnL36fWyve4zXHKrN7AjXl+g5cafQyei4j1saTLfQatdJed
ubvcscZ3yERB+R0+8xuH2UqvR0E57ohZZaTiwcUWJ3VemxCZhwKy+Xvt1ZUNxBrh
2qAJBcP0+UCskSfWb+QQ1twNIeQ8Raj+kRPGphlNmjYxF2CFOsw9c56Lz+jNyty9
RC3Bg4l+Kcdhw23w5XBUXpHOyL6lsG317PWgEHUIQzNhXZfHL9GzwtTVQV8tVPyu
MOQIa7KDFXUEEnRN31mVLzfNHqKtTgFfP2LnSiD3LsBYsqJUtAnFGyORHgKhddRg
AKLrn1h0dEzkN+XsMaAWPrJg87ks7qXhhNz3SEI+t7dL4ozfUryRY9/8t/rXuQK+
ffRO/63i8SaHdu1Sl8MgHsNZRFOlbYGPw73TpdJ3JvfmfPNrRcTzsU1arMML8GWs
q6/QYDTWVYBYXy0kEqJQmeb3yJRvnIdVfiAdu9fyDPY8FCTUTcsxKe88u2bgrIaY
pNdoNFXojIC9JvMUM5QakMeog+ocTrZFOyhRMKfq5KE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PGP PUBLIC KEY BLOCK-----

View File

@ -0,0 +1,79 @@
# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
dist_pkgdata_DATA = rootfs.img
EXTRA_QEMU_ARGS =
if WANT_KVM
EXTRA_QEMU_ARGS += -enable-kvm
endif # WANT_KVM
gnupg/pubring.kbx: ${srcdir}/D24DDAC9226D5BA5E9F3BED3F5DAAAF74AD4C938.asc
install -d gnupg
gpg \
--home=gnupg \
--import \
${srcdir}/D24DDAC9226D5BA5E9F3BED3F5DAAAF74AD4C938.asc || \
rm -rf gnupg
.PHONY: check-trisquel-installation-image
check-trisquel-installation-image: $(TRISQUEL_NETINSTALL) gnupg/pubring.kbx
gpg --home=gnupg \
--verify trisquel-netinst_11.0_amd64.iso.asc \
$(TRISQUEL_NETINSTALL)
grub/boot/linux: Makefile check-trisquel-installation-image
install -D -d grub/boot
xorriso -osirrox on \
-indev $(TRISQUEL_NETINSTALL) \
-extract /linux $@
chmod 770 $@
grub/boot/initrd.gz: Makefile check-trisquel-installation-image
install -D -d grub/boot
xorriso -osirrox on \
-indev $(TRISQUEL_NETINSTALL) \
-extract /initrd.gz $@
chmod 770 $@
grub/boot/grub/grub.cfg: Makefile grub.cfg
install -D -m 660 grub.cfg $@
# It is way more simple to just extract the kernel and initramfs and
# write some grub.cfg by hand than to somehow modify an existing
# installer iso.
grub.iso: Makefile grub/boot/linux grub/boot/initrd.gz grub/boot/grub/grub.cfg
grub-mkrescue -o $@ grub
preseed.img: Makefile preseed.cfg
dd if=/dev/zero of=$@.tmp count=2048
mkfs.vfat --mbr=y -n MEDIA $@.tmp
mcopy -i $@.tmp preseed.cfg ::/preseed.cfg
mv $@.tmp $@
rootfs.img.tmp: Makefile
qemu-img create -f qcow2 $@ 10G
rootfs.img: preseed.img rootfs.img.tmp grub.iso
install -m 644 rootfs.img.tmp rootfs.img || rm -f rootfs.img
qemu-system-x86_64 \
-M q35 \
-m 2048M \
-nographic \
-drive file=grub.iso,index=2,media=cdrom,if=ide \
-drive file=rootfs.img.tmp,index=1,media=disk,if=virtio \
-drive file=preseed.img,index=0,media=disk,if=none,format=raw,id=usb \
-usb -device usb-ehci,id=ehci -device usb-storage,bus=ehci.0,drive=usb \
$(EXTRA_QEMU_ARGS) || \
\
rm -f rootfs.img

View File

@ -0,0 +1,25 @@
Deployment and limitations.
===========================
Creating an image is similar to the build of other software as you use
similar commands:
$ ./autogen.sh
$ ./configure --prefix=/ \
--with-trisquel-netinstall=~/Downloads/trisquel-netinst_11.0_amd64.iso
$ make
License
=======
This project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This project is distributed in the hope that they will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this project. If not, see <http://www.gnu.org/licenses/>.

View File

@ -0,0 +1,11 @@
#!/bin/sh
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# You should have received a copy of the GNU General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
autoreconf -fi $@

View File

@ -0,0 +1,120 @@
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
AC_PREREQ([2.69])
AC_INIT([trisquel-automatic-netinstall-qemu], [0.1],
[GNUtoo@cyberdimension.org])
AC_CONFIG_SRCDIR([configure.ac])
AC_PROG_AWK
AC_PROG_MKDIR_P
AM_INIT_AUTOMAKE([foreign])
AC_SUBST([ENABLE_KVM], [])
AC_SUBST([TRISQUEL_NETINSTALL], [])
AC_ARG_ENABLE(kvm,
[AS_HELP_STRING([--disable-kvm],
[Use Kvm to obtain a public IP address (default=enabled)])],
[kvm="$enableval"],
[kvm="yes"])
AM_CONDITIONAL( [WANT_KVM], [test x"$kvm" = x"yes"])
AC_ARG_WITH(
[trisquel-netinstall],
[AS_HELP_STRING(
[--with-trisquel-netinstall=PATH],
[Path to trisquel netinstall image
(default=trisquel-netinst_11.0_amd64.iso). Note that at the moment
only trisquel-netinst_11.0_amd64.iso is supported. If you use
another image the signature verification will fail.])],
[TRISQUEL_NETINSTALL=$withval],
[TRISQUEL_NETINSTALL=trisquel-netinst_11.0_amd64.iso])
AC_CHECK_PROG([CHMOD], [chmod], [chmod])
AS_IF([test x"$CHMOD" = x""],
[AC_MSG_ERROR([chmod was not found in PATH ($PATH)])])
AC_CHECK_PROG([GPG], [gpg], [gpg])
AS_IF([test x"$GPG" = x""],
[AC_MSG_ERROR([gpg was not found in PATH ($PATH)])])
AC_CHECK_PROG([INSTALL], [install], [install])
AS_IF([test x"$INSTALL" = x""],
[AC_MSG_ERROR([install was not found in PATH ($PATH)])])
AC_CHECK_PROG([RM], [rm], [rm])
AS_IF([test x"$RM" = x""],
[AC_MSG_ERROR([rm was not found in PATH ($PATH)])])
AC_CHECK_PROG([XORRISO], [xorriso], [xorriso])
AS_IF([test x"$XORRISO" = x""],
[AC_MSG_ERROR([xorriso was not found in PATH ($PATH)])])
AC_CHECK_PROG([GRUB_MKRESCUE], [grub-mkrescue], [grub-mkrescue])
AS_IF([test x"$GRUB_MKRESCUE" = x""],
[AC_MSG_ERROR([grub-mkrescue was not found in PATH ($PATH)])])
AC_CHECK_PROG([DD], [dd], [dd])
AS_IF([test x"$DD" = x""],
[AC_MSG_ERROR([dd was not found in PATH ($PATH)])])
AC_CHECK_PROG([MKFS_VFAT], [mkfs.vfat], [mkfs.vfat])
AS_IF([test x"$MKFS_VFAT" = x""],
[AC_MSG_ERROR([mkfs.vfat was not found in PATH ($PATH)])])
AC_CHECK_PROG([MCOPY], [mcopy], [mcopy])
AS_IF([test x"$MCOPY" = x""],
[AC_MSG_ERROR([mcopy was not found in PATH ($PATH)])])
AC_CHECK_PROG([MV], [mv], [mv])
AS_IF([test x"$MV" = x""],
[AC_MSG_ERROR([mv was not found in PATH ($PATH)])])
AC_CHECK_PROG([QEMU_IMG], [qemu-img], [qemu-img])
AS_IF([test x"$QEMU_IMG" = x""],
[AC_MSG_ERROR([qemu-img was not found in PATH ($PATH)])])
AC_CHECK_PROG([QEMU_SYSTEM_X86_64], [qemu-system-x86_64], [qemu-system-x86_64])
AS_IF([test x"$QEMU_SYSTEM_X86_64" = x""],
[AC_MSG_ERROR([qemu-system-x86_64 was not found in PATH ($PATH)])])
# Check for the netinstall iso file
AS_IF([test x"`echo "$TRISQUEL_NETINSTALL" | cut -c1`" = x"~"],
[AC_MSG_ERROR([~ not supported in --with-trisquel-netinstall.
Use paths without '~'.])])
AC_CHECK_FILE([$TRISQUEL_NETINSTALL],
[],
[AC_MSG_ERROR([trisquel-netinst_11.0_amd64.iso was not found in
$TRISQUEL_NETINSTALL])])
AS_IF([test x"$kvm" = x"yes"],
[AS_IF([test -c /dev/kvm], [], AC_MSG_ERROR([/dev/kvm not found.]))
AS_IF([echo quit | qemu-system-x86_64 -display none -vga none -enable-kvm -monitor stdio],
[],
[AC_MSG_ERROR([KVM test with qemu-system-x86_64 failed.
Check permissions on /dev/kvm.])])])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
echo
echo "Configuration options:"
echo "======================"
AS_IF([test x"$kvm" = x"yes"],
[echo "- Kvm: enabled"],
[echo "- Kvm: disabled"])
echo "- Trisquel netinstall path: $TRISQUEL_NETINSTALL"

View File

@ -0,0 +1,18 @@
# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
set timeout=1
menuentry "Trisquel 11 netinstall with custom preseed" {
linux /boot/linux auto=true priority=critical preseed/file=/media/preseed.cfg --- console=ttyS0,115200 quiet
initrd /boot/initrd.gz
}

View File

@ -0,0 +1,63 @@
#_preseed_V1
# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Accounts
d-i passwd/root-login boolean false
d-i passwd/username string admin666
d-i passwd/user-fullname string admin666
d-i passwd/user-password password password
d-i passwd/user-password-again password password
# Keyboard layout
d-i keyboard-configuration/xkb-keymap select us
# Locales
d-i debian-installer/locale string en_US
# Network
d-i netcfg/choose_interface select auto
d-i netcfg/get_domain string test
d-i netcfg/get_hostname string test
# Package management
d-i mirror/country string manual
d-i mirror/http/directory string /trisquel
d-i mirror/http/hostname string mirror.fsf.org
d-i mirror/http/proxy string
popularity-contest popularity-contest/participate boolean false
# Partitioning
d-i grub-installer/bootdev string /dev/vda
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/disk string /dev/vda
d-i partman-auto/method string regular
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm_nooverwrite boolean true
# Timezone
d-i clock-setup/ntp boolean true
d-i clock-setup/utc boolean true
d-i time/zone string Europe/Paris
# Shutdown at the end
d-i finish-install/reboot_in_progress note
d-i debian-installer/exit/poweroff boolean true

View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE0k3aySJtW6Xp877T9dqq90rUyTgFAmQWV7cACgkQ9dqq90rU
yTg2Lw//Y6z8D0uKRl2ihiDqBWWaV1Q7urck/HcLYDYyfbemlLCm3lt3K9lU/CGS
Sa4viGLnfC9sXwBvDAAOHQI9zmlV5QmJtYzUv/oAT929qsIXFWRT4JerMdcpf/KK
i/DkQyu8VbgZbRMJihozTuArlCLmIBFjskTw0gQcl4okiaasrYFGCw0uLVFGInkD
2iiTgoi0EzuLEoJtITELUOuZRDbFwz/5Wn0lC0oDxVx9vH4keBz2RlyVtQmAhrKQ
Xt278M6E8N4vE8/euIYSTlRFfifLux9RLvq1sUXNc0fluU7D7ndqtWVO3fMCRu5M
q5Hd61K8HAlT3xO58VTsekvId1An0g/tGrRVle2Ny3jcPb4zpoGwD2bZbKvgSEZW
UMaDBLAvfUvzGEv8zU8j318ClBPcQUMzCISdbCaK/0GhszcxC4+RGPOum7vCHB4V
jbvkrjnGnfPam6p+KBDuYuYx9qYqMtJm3l0rsijThljBmBPTDqvpaAvfrk0sOxyD
PnqTSU35OVJCZWtQD4M855vxN0Y44BTVleklW6iS/56Jn29bVHofu/evZxFkNboe
USQELjuyRpAMQPUvkPlRYqrKMmgrV95GMEBWiPJz/7qOv7kMahSoHoOkAP6XtJjz
IW0eZ1wijG7pQRgpEZ3OQKNI9KFV0nzGNqbHI8ymtHvzQsTCSP8=
=/+sf
-----END PGP SIGNATURE-----