2024-07-02 18:33:11 +02:00
|
|
|
# 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], [])
|
2024-07-06 03:04:46 +02:00
|
|
|
AC_SUBST([TRISQUEL_ROOTFS_SIZE], [])
|
2024-07-02 18:33:11 +02:00
|
|
|
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"])
|
|
|
|
|
2024-07-06 03:04:46 +02:00
|
|
|
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
|
|
|
|
|
2024-07-02 18:33:11 +02:00
|
|
|
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"
|
2024-07-06 03:04:46 +02:00
|
|
|
echo "- Trisquel target rootfs size: $TRISQUEL_ROOTFS_SIZE"
|