#!/usr/bin/env python3
#
# NetBSD VM image
#
# Copyright 2017-2019 Red Hat Inc.
#
# Authors:
#  Fam Zheng <famz@redhat.com>
#  Gerd Hoffmann <kraxel@redhat.com>
#
# This code is licensed under the GPL version 2 or later.  See
# the COPYING file in the top-level directory.
#

import os
import sys
import time
import subprocess
import basevm

class NetBSDVM(basevm.BaseVM):
    name = "netbsd"
    arch = "x86_64"

    link = "https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/images/NetBSD-9.3-amd64.iso"
    csum = "2bfce544f762a579f61478e7106c436fc48731ff25cf6f79b392ba5752e6f5ec130364286f7471716290a5f033637cf56aacee7fedb91095face59adf36300c3"
    size = "20G"
    pkgs = [
        # tools
        "git-base",
        "pkgconf",
        "xz",
        "python310",
        "py310-expat",
        "ninja-build",

        # gnu tools
        "bash",
        "gmake",
        "gsed",
        "gettext-tools",

        # libs: basic
        "dtc",

        # libs: crypto
        "gnutls",

        # libs: images
        "jpeg",
        "png",

        # libs: ui
        "capstone",
        "SDL2",
        "gtk3+",
        "libxkbcommon",

        # libs: migration
        "zstd",

        # libs: networking
        "libslirp",
    ]

    BUILD_SCRIPT = """
        set -e;
        rm -rf /home/qemu/qemu-test.*
        cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
        mkdir src build; cd src;
        tar -xf /dev/rld1a;
        cd ../build
        ../src/configure --disable-opengl --extra-ldflags=-L/usr/pkg/lib \
                          --extra-cflags=-I/usr/pkg/include {configure_opts};
        gmake --output-sync -j{jobs} {target} {verbose};
    """
    poweroff = "/sbin/poweroff"

    # Workaround for NetBSD + IPv6 + slirp issues.
    # NetBSD seems to ignore the ICMPv6 Destination Unreachable
    # messages generated by slirp.  When the host has no IPv6
    # connectivity, this causes every connection to ftp.NetBSD.org
    # take more than a minute to be established.
    ipv6 = False

    def build_image(self, img):
        cimg = self._download_with_cache(self.link, sha512sum=self.csum)
        img_tmp = img + ".tmp"
        iso = img + ".install.iso"

        self.print_step("Preparing iso and disk image")
        subprocess.check_call(["ln", "-f", cimg, iso])
        self.exec_qemu_img("create", "-f", "qcow2", img_tmp, self.size)

        self.print_step("Booting installer")
        self.boot(img_tmp, extra_args = [
            "-machine", "graphics=off",
            "-cdrom", iso
        ])
        self.console_init()
        self.console_wait_send("3. Drop to boot prompt", "3")
        self.console_wait_send("> ", "consdev com0\n")
        self.console_wait_send("> ", "boot\n")

        self.console_wait_send("Terminal type",            "xterm\n")
        self.console_wait_send("a: Installation messages", "a\n")
        self.console_wait_send("a: Install NetBSD",        "a\n")
        self.console_wait("Shall we continue?")
        self.console_wait_send("b: Yes",                   "b\n")

        self.console_wait_send("a: ld0",                   "a\n")
        self.console_wait_send("a: Guid Partition Table",  "a\n")
        self.console_wait_send("a: This is the correct",   "a\n")
        self.console_wait_send("b: Use default part",      "b\n")
        self.console_wait_send("x: Partition sizes ok",    "x\n")
        self.console_wait("Shall we continue?")
        self.console_wait_send("b: Yes",                   "b\n")

        self.console_wait_send("b: Use serial port com0",  "b\n")
        self.console_wait_send("f: Set serial baud rate",  "f\n")
        self.console_wait_send("a: 9600",                  "a\n")
        self.console_wait_send("x: Continue",              "x\n")

        self.console_wait_send("a: Full installation",     "a\n")
        self.console_wait_send("a: CD-ROM",                "a\n")

        self.print_step("Installation started now, this will take a while")
        self.console_wait_send("Hit enter to continue",    "\n")

        self.console_wait_send("d: Change root password",  "d\n")
        self.console_wait_send("a: Yes",                   "a\n")
        self.console_wait("New password:")
        self.console_send("%s\n" % self._config["root_pass"])
        self.console_wait("New password:")
        self.console_send("%s\n" % self._config["root_pass"])
        self.console_wait("Retype new password:")
        self.console_send("%s\n" % self._config["root_pass"])

        self.console_wait_send("o: Add a user",            "o\n")
        self.console_wait("username")
        self.console_send("%s\n" % self._config["guest_user"])
        self.console_wait("to group wheel")
        self.console_wait_send("a: Yes",                   "a\n")
        self.console_wait_send("a: /bin/sh",               "a\n")
        self.console_wait("New password:")
        self.console_send("%s\n" % self._config["guest_pass"])
        self.console_wait("New password:")
        self.console_send("%s\n" % self._config["guest_pass"])
        self.console_wait("Retype new password:")
        self.console_send("%s\n" % self._config["guest_pass"])

        self.console_wait_send("a: Configure network",     "a\n")
        self.console_wait_send("a: vioif0",                "a\n")
        self.console_wait_send("Network media type",       "\n")
        self.console_wait("autoconfiguration")
        self.console_wait_send("a: Yes",                   "a\n")
        self.console_wait_send("DNS domain",               "localnet\n")
        self.console_wait("Are they OK?")
        self.console_wait_send("a: Yes",                   "a\n")
        self.console_wait("installed in /etc")
        self.console_wait_send("a: Yes",                   "a\n")

        self.console_wait_send("e: Enable install",        "e\n")
        proxy = os.environ.get("http_proxy")
        if not proxy is None:
            self.console_wait_send("f: Proxy",             "f\n")
            self.console_wait("Proxy")
            self.console_send("%s\n" % proxy)
        self.console_wait_send("x: Install pkgin",         "x\n")
        self.console_init(1200)
        self.console_wait_send("Hit enter to continue", "\n")
        self.console_init()

        self.console_wait_send("g: Enable sshd",           "g\n")
        self.console_wait_send("x: Finished conf",         "x\n")
        self.console_wait_send("Hit enter to continue",    "\n")

        self.print_step("Installation finished, rebooting")
        self.console_wait_send("d: Reboot the computer",   "d\n")

        # setup qemu user
        prompt = "localhost$"
        self.console_ssh_init(prompt, self._config["guest_user"],
                                      self._config["guest_pass"])
        self.console_wait_send(prompt, "exit\n")

        # setup root user
        prompt = "localhost#"
        self.console_ssh_init(prompt, "root", self._config["root_pass"])
        self.console_sshd_config(prompt)

        # setup virtio-blk #1 (tarfile)
        self.console_wait(prompt)
        self.console_send("echo 'chmod 666 /dev/rld1a' >> /etc/rc.local\n")

        # turn off mprotect (conflicts with tcg)
        self.console_wait(prompt)
        self.console_send("echo security.pax.mprotect.enabled=0 >> /etc/sysctl.conf\n")

        self.print_step("Configuration finished, rebooting")
        self.console_wait_send(prompt, "reboot\n")
        self.console_wait("login:")
        self.wait_ssh()

        self.print_step("Installing packages")
        self.ssh_root_check("pkgin update\n")
        self.ssh_root_check("pkgin -y install %s\n" % " ".join(self.pkgs))

        # shutdown
        self.ssh_root(self.poweroff)
        self.console_wait("entering state S5")
        self.wait()

        os.rename(img_tmp, img)
        os.remove(iso)
        self.print_step("All done")

if __name__ == "__main__":
    sys.exit(basevm.main(NetBSDVM))
