# Copyright (C) 2023 Denis 'GNUtoo' Carikli # # 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 . 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([MIRROR_HTTP_PROXY], []) AC_SUBST([TRISQUEL_ROOTFS_SIZE], []) 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( [mirror-http-proxy], [AS_HELP_STRING( [--with-mirror-http-proxy=URL], [URL to the mirror HTTP proxy (default: not set (no mirror)). The proxy configuration is then used during both the netinstall installation and after as well (it's added to /etc/apt/apt.conf). The chosen URL should be reachable from QEMU. As an example, if you use the apt-cacher-ng default configuration and make it listen on localhost, you should use http://10.0.2.2:3142 because localhost becomes 10.0.2.2 with the current QEMU configuration and because the port 3142 is the default port for apt-cacher-ng.])], [MIRROR_HTTP_PROXY=$withval], [MIRROR_HTTP_PROXY=]) AC_ARG_WITH( [--with-trisquel-target-rootfs-size], [AS_HELP_STRING( [--trisquel-target-rootfs-size=SIZE], [Size of the target image (default=3.5G). The size will be passed as-is to the 'qemu-img create' command. See 'man 1 qemu-img' for more details.])], [TRISQUEL_ROOTFS_SIZE=$withval], [TRISQUEL_ROOTFS_SIZE=3.5G]) dnl 3.4G: Fail, 3.5G: OK AC_ARG_WITH( [trisquel-netinstall], [AS_HELP_STRING( [--with-trisquel-netinstall=PATH], [Path to trisquel netinstall image (default=trisquel-netinst_11.0.1_amd64.iso). Note that at the moment only trisquel-netinst_11.0.1_amd64.iso is supported. If you use another image the signature verification will fail.])], [TRISQUEL_NETINSTALL=$withval], [TRISQUEL_NETINSTALL=trisquel-netinst_11.0.1_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.1_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" echo "- Trisquel target rootfs size: $TRISQUEL_ROOTFS_SIZE" AS_IF([test x"$MIRROR_HTTP_PROXY" = x""], [echo "- Trisquel mirror http proxy: disabled"], [echo "- Trisquel mirror http proxy: $MIRROR_HTTP_PROXY"])