summaryrefslogtreecommitdiffstats
path: root/src/VBox/Main/UnattendedTemplates
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
commitf215e02bf85f68d3a6106c2a1f4f7f063f819064 (patch)
tree6bb5b92c046312c4e95ac2620b10ddf482d3fa8b /src/VBox/Main/UnattendedTemplates
parentInitial commit. (diff)
downloadvirtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.tar.xz
virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.zip
Adding upstream version 7.0.14-dfsg.upstream/7.0.14-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Main/UnattendedTemplates')
-rw-r--r--src/VBox/Main/UnattendedTemplates/Makefile.kmk76
-rwxr-xr-xsrc/VBox/Main/UnattendedTemplates/debian_postinstall.sh331
-rw-r--r--src/VBox/Main/UnattendedTemplates/debian_preseed.cfg86
-rw-r--r--src/VBox/Main/UnattendedTemplates/fedora_ks.cfg90
-rw-r--r--src/VBox/Main/UnattendedTemplates/freebsd_installer.cfg30
-rwxr-xr-xsrc/VBox/Main/UnattendedTemplates/freebsd_postinstall.sh29
-rw-r--r--src/VBox/Main/UnattendedTemplates/lgw_ks.cfg91
-rwxr-xr-xsrc/VBox/Main/UnattendedTemplates/lgw_postinstall.sh524
-rw-r--r--src/VBox/Main/UnattendedTemplates/ol8_ks.cfg109
-rw-r--r--src/VBox/Main/UnattendedTemplates/ol9_ks.cfg115
-rw-r--r--src/VBox/Main/UnattendedTemplates/ol_ks.cfg108
-rwxr-xr-xsrc/VBox/Main/UnattendedTemplates/ol_postinstall.sh340
-rw-r--r--src/VBox/Main/UnattendedTemplates/os2_cid_install.cmd498
-rw-r--r--src/VBox/Main/UnattendedTemplates/os2_response_files.rsp325
-rw-r--r--src/VBox/Main/UnattendedTemplates/os2_util.exebin0 -> 7854 bytes
-rw-r--r--src/VBox/Main/UnattendedTemplates/redhat67_ks.cfg108
-rwxr-xr-xsrc/VBox/Main/UnattendedTemplates/redhat_postinstall.sh328
-rw-r--r--src/VBox/Main/UnattendedTemplates/rhel3_ks.cfg141
-rw-r--r--src/VBox/Main/UnattendedTemplates/rhel4_ks.cfg120
-rw-r--r--src/VBox/Main/UnattendedTemplates/rhel5_ks.cfg119
-rw-r--r--src/VBox/Main/UnattendedTemplates/suse_autoinstall.xml93
-rw-r--r--src/VBox/Main/UnattendedTemplates/ubuntu_preseed.cfg101
-rw-r--r--src/VBox/Main/UnattendedTemplates/win_nt5_unattended.sif60
-rw-r--r--src/VBox/Main/UnattendedTemplates/win_nt6_unattended.xml300
-rw-r--r--src/VBox/Main/UnattendedTemplates/win_postinstall.cmd164
25 files changed, 4286 insertions, 0 deletions
diff --git a/src/VBox/Main/UnattendedTemplates/Makefile.kmk b/src/VBox/Main/UnattendedTemplates/Makefile.kmk
new file mode 100644
index 00000000..7c11ea2b
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/Makefile.kmk
@@ -0,0 +1,76 @@
+# $Id: Makefile.kmk $
+## @file
+# Top-level makefile for src/VBox/Main/UnattendedTemplates.
+#
+
+#
+# Copyright (C) 2017-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.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, in version 3 of the
+# License.
+#
+# 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>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+ifdef VBOX_WITH_UNATTENDED
+
+ # Note! When updating the source list here, VBOX_UNATTENDED_TEMPLATES in
+ # ../../Installer/Config.kmk must be updated too!
+ INSTALLS += VBoxUnattendedTemplates
+ VBoxUnattendedTemplates_INST = $(INST_UNATTENDED_TEMPLATES)
+ VBoxUnattendedTemplates_MODE = a+r,u+w
+ VBoxUnattendedTemplates_SOURCES = \
+ debian_preseed.cfg \
+ ubuntu_preseed.cfg \
+ rhel3_ks.cfg \
+ rhel4_ks.cfg \
+ rhel5_ks.cfg \
+ redhat67_ks.cfg \
+ ol_ks.cfg \
+ ol8_ks.cfg \
+ ol9_ks.cfg \
+ fedora_ks.cfg \
+ suse_autoinstall.xml \
+ os2_response_files.rsp \
+ win_nt5_unattended.sif \
+ win_nt6_unattended.xml \
+ \
+ debian_postinstall.sh \
+ redhat_postinstall.sh \
+ ol_postinstall.sh \
+ os2_cid_install.cmd \
+ win_postinstall.cmd \
+ freebsd_installer.cfg \
+ freebsd_postinstall.sh
+
+ ifndef VBOX_WITH_OPEN_WATCOM
+ VBoxUnattendedTemplates_SOURCES += \
+ os2_util.exe
+ endif
+
+ ifndef VBOX_OSE
+ VBoxUnattendedTemplates_SOURCES += \
+ lgw_ks.cfg \
+ lgw_postinstall.sh
+ endif
+
+endif # VBOX_WITH_UNATTENDED
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/Main/UnattendedTemplates/debian_postinstall.sh b/src/VBox/Main/UnattendedTemplates/debian_postinstall.sh
new file mode 100755
index 00000000..5ae65a72
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/debian_postinstall.sh
@@ -0,0 +1,331 @@
+#!/bin/bash
+## @file
+# Post installation script template for debian-like distros.
+#
+# Note! This script expects to be running w/o chroot.
+# Note! When using ubiquity, this is run after installation logs have
+# been copied to /var/log/installation.
+#
+
+#
+# Copyright (C) 2017-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.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, in version 3 of the
+# License.
+#
+# 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>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+
+#
+# Globals.
+#
+MY_TARGET="/target"
+MY_LOGFILE="${MY_TARGET}/var/log/vboxpostinstall.log"
+MY_CHROOT_CDROM="/cdrom"
+MY_CDROM_NOCHROOT="/cdrom"
+MY_EXITCODE=0
+MY_DEBUG="" # "yes"
+
+@@VBOX_COND_HAS_PROXY@@
+PROXY="@@VBOX_INSERT_PROXY@@"
+export http_proxy="${PROXY}"
+export https_proxy="${PROXY}"
+echo "HTTP proxy is ${http_proxy}" | tee -a "${MY_LOGFILE}"
+echo "HTTPS proxy is ${https_proxy}" | tee -a "${MY_LOGFILE}"
+@@VBOX_COND_END@@
+
+#
+# Do we need to exec using target bash? If so, we must do that early
+# or ash will bark 'bad substitution' and fail.
+#
+if [ "$1" = "--need-target-bash" ]; then
+ # Try figure out which directories we might need in the library path.
+ if [ -z "${LD_LIBRARY_PATH}" ]; then
+ LD_LIBRARY_PATH="${MY_TARGET}/lib"
+ fi
+ for x in \
+ ${MY_TARGET}/lib \
+ ${MY_TARGET}/usr/lib \
+ ${MY_TARGET}/lib/*linux-gnu/ \
+ ${MY_TARGET}/lib32/ \
+ ${MY_TARGET}/lib64/ \
+ ${MY_TARGET}/usr/lib/*linux-gnu/ \
+ ${MY_TARGET}/usr/lib32/ \
+ ${MY_TARGET}/usr/lib64/ \
+ ;
+ do
+ if [ -e "$x" ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${x}"; fi;
+ done
+ export LD_LIBRARY_PATH
+
+ # Append target bin directories to the PATH as busybox may not have tee.
+ PATH="${PATH}:${MY_TARGET}/bin:${MY_TARGET}/usr/bin:${MY_TARGET}/sbin:${MY_TARGET}/usr/sbin"
+ export PATH
+
+ # Drop the --need-target-bash argument and re-exec.
+ shift
+ echo "******************************************************************************" >> "${MY_LOGFILE}"
+ echo "** Relaunching using ${MY_TARGET}/bin/bash $0 $*" >> "${MY_LOGFILE}"
+ echo "** LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "${MY_LOGFILE}"
+ echo "** PATH=${PATH}" >> "${MY_LOGFILE}"
+ exec "${MY_TARGET}/bin/bash" "$0" "$@"
+fi
+
+
+#
+# Commands.
+#
+
+# Logs execution of a command.
+log_command()
+{
+ echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+ echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+ echo "** Executing: $*" >> "${MY_LOGFILE}"
+ "$@" 2>&1 | tee -a "${MY_LOGFILE}"
+ MY_TMP_EXITCODE="${PIPESTATUS[0]}"
+ if [ "${MY_TMP_EXITCODE}" != "0" ]; then
+ if [ "${MY_TMP_EXITCODE}" != "${MY_IGNORE_EXITCODE}" ]; then
+ echo "** exit code: ${MY_TMP_EXITCODE}" | tee -a "${MY_LOGFILE}"
+ MY_EXITCODE=1;
+ else
+ echo "** exit code: ${MY_TMP_EXITCODE} (ignored)" | tee -a "${MY_LOGFILE}"
+ fi
+ fi
+}
+
+# Logs execution of a command inside the target.
+log_command_in_target()
+{
+ #
+ # We should be using in-target here, however we don't get any stderr output
+ # from it because of log-output. We can get stdout by --pass-stdout, but
+ # that's not helpful for failures.
+ #
+ # So, we try do the chroot prepping that in-target does at the start of the
+ # script (see below) and just use chroot here.
+ #
+ log_command chroot "${MY_TARGET}" "$@"
+ # log_command in-target --pass-stdout "$@" # No stderr output... :-(
+}
+
+# Checks if $1 is a command on the PATH inside the target jail.
+chroot_which()
+{
+ for dir in /bin /usr/bin /sbin /usr/sbin;
+ do
+ if [ -x "${MY_TARGET}${dir}/$1" ]; then
+ return 0;
+ fi
+ done
+ return 1;
+}
+
+#
+# Log header.
+#
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+echo "** VirtualBox Unattended Guest Installation - Late installation actions" >> "${MY_LOGFILE}"
+echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+echo "** Started: $0 $*" >> "${MY_LOGFILE}"
+
+
+#
+# Setup the target jail ourselves since in-target steals all the output.
+#
+if [ -f /lib/chroot-setup.sh ]; then
+ MY_HAVE_CHROOT_SETUP="yes"
+ . /lib/chroot-setup.sh
+ if chroot_setup; then
+ echo "** chroot_setup: done" | tee -a "${MY_LOGFILE}"
+ else
+ echo "** chroot_setup: failed $?" | tee -a "${MY_LOGFILE}"
+ fi
+else
+ MY_HAVE_CHROOT_SETUP=""
+fi
+
+
+#
+# We want the ISO available inside the target jail.
+#
+if [ -d "${MY_TARGET}${MY_CHROOT_CDROM}" ]; then
+ MY_RMDIR_TARGET_CDROM=
+else
+ MY_RMDIR_TARGET_CDROM="yes"
+ log_command mkdir -p ${MY_TARGET}${MY_CHROOT_CDROM}
+fi
+
+if [ -f "${MY_TARGET}${MY_CHROOT_CDROM}/vboxpostinstall.sh" ]; then
+ MY_UNMOUNT_TARGET_CDROM=
+ echo "** binding cdrom into jail: already done" | tee -a "${MY_LOGFILE}"
+else
+ MY_UNMOUNT_TARGET_CDROM="yes"
+ log_command mount -o bind "${MY_CDROM_NOCHROOT}" "${MY_TARGET}${MY_CHROOT_CDROM}"
+ if [ -f "${MY_TARGET}${MY_CHROOT_CDROM}/vboxpostinstall.sh" ]; then
+ echo "** binding cdrom into jail: success" | tee -a "${MY_LOGFILE}"
+ else
+ echo "** binding cdrom into jail: failed" | tee -a "${MY_LOGFILE}"
+ fi
+ if [ "${MY_DEBUG}" = "yes" ]; then
+ log_command find "${MY_TARGET}${MY_CHROOT_CDROM}"
+ fi
+fi
+
+
+#
+# Debug
+#
+if [ "${MY_DEBUG}" = "yes" ]; then
+ log_command id
+ log_command ps
+ log_command ps auxwwwf
+ log_command env
+ log_command df
+ log_command mount
+ log_command_in_target df
+ log_command_in_target mount
+ #log_command find /
+ MY_EXITCODE=0
+fi
+
+
+#
+# Packages needed for GAs.
+#
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing packages for building kernel modules...' | tee -a "${MY_LOGFILE}"
+log_command_in_target apt-get -y install build-essential
+log_command_in_target apt-get -y install linux-headers-$(uname -r)
+
+
+#
+# GAs
+#
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing VirtualBox Guest Additions...' | tee -a "${MY_LOGFILE}"
+MY_IGNORE_EXITCODE=2 # returned if modules already loaded and reboot required.
+log_command_in_target /bin/bash "${MY_CHROOT_CDROM}/vboxadditions/VBoxLinuxAdditions.run" --nox11
+log_command_in_target /bin/bash -c "udevadm control --reload-rules" # GAs doesn't yet do this.
+log_command_in_target /bin/bash -c "udevadm trigger" # (ditto)
+MY_IGNORE_EXITCODE=
+log_command_in_target usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@"
+@@VBOX_COND_END@@
+
+
+#
+# Test Execution Service.
+#
+@@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing Test Execution Service...' | tee -a "${MY_LOGFILE}"
+log_command_in_target test "${MY_CHROOT_CDROM}/vboxvalidationkit/linux/@@VBOX_INSERT_OS_ARCH@@/TestExecService"
+log_command mkdir -p "${MY_TARGET}/opt/validationkit" "${MY_TARGET}/media/cdrom"
+log_command cp -R ${MY_CDROM_NOCHROOT}/vboxvalidationkit/* "${MY_TARGET}/opt/validationkit/"
+log_command chmod -R u+rw,a+xr "${MY_TARGET}/opt/validationkit/"
+if [ -e "${MY_TARGET}/usr/bin/chcon" -o -e "${MY_TARGET}/bin/chcon" -o -e "${MY_TARGET}/usr/sbin/chcon" -o -e "${MY_TARGET}/sbin/chcon" ]; then
+ MY_IGNORE_EXITCODE=1
+ log_command_in_target chcon -R -t usr_t "/opt/validationkit/"
+ MY_IGNORE_EXITCODE=
+fi
+
+# systemd service config:
+MY_UNIT_PATH="${MY_TARGET}/lib/systemd/system"
+test -d "${MY_TARGET}/usr/lib/systemd/system" && MY_UNIT_PATH="${MY_TARGET}/usr/lib/systemd/system"
+if [ -d "${MY_UNIT_PATH}" ]; then
+ log_command cp "${MY_TARGET}/opt/validationkit/linux/vboxtxs.service" "${MY_UNIT_PATH}/vboxtxs.service"
+ log_command chmod 644 "${MY_UNIT_PATH}/vboxtxs.service"
+ log_command_in_target systemctl -q enable vboxtxs
+
+# System V like:
+elif [ -e "${MY_TARGET}/etc/init.d/" ]; then
+
+ # Install the script. On rhel6 scripts are under /etc/rc.d/ with /etc/init.d and /etc/rc?.d being symlinks.
+ if [ -d "${MY_TARGET}/etc/rc.d/init.d/" ]; then
+ MY_INIT_D_PARENT_PATH="${MY_TARGET}/etc/rc.d"
+ log_command ln -s "../../../opt/validationkit/linux/vboxtxs" "${MY_INIT_D_PARENT_PATH}/init.d/"
+ else
+ MY_INIT_D_PARENT_PATH="${MY_TARGET}/etc"
+ log_command ln -s "../../opt/validationkit/linux/vboxtxs" "${MY_INIT_D_PARENT_PATH}/init.d/"
+ fi
+
+ # Use runlevel management script if found.
+ if chroot_which chkconfig; then # Redhat based sysvinit systems
+ log_command_in_target chkconfig --add vboxtxs
+ elif chroot_which insserv; then # SUSE-based sysvinit systems
+ log_command_in_target insserv vboxtxs
+ elif chroot_which update-rc.d; then # Debian/Ubuntu-based systems
+ log_command_in_target update-rc.d vboxtxs defaults
+ elif chroot_which rc-update; then # Gentoo Linux
+ log_command_in_target rc-update add vboxtxs default
+ # Fall back on hardcoded symlinking.
+ else
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc0.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc1.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc6.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc2.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc3.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc4.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc5.d/S35vboxtxs"
+ fi
+else
+ echo "** error: Unknown init script system." | tee -a "${MY_LOGFILE}"
+fi
+
+@@VBOX_COND_END@@
+
+#
+# Run user command.
+#
+@@VBOX_COND_HAS_POST_INSTALL_COMMAND@@
+echo '** Running custom user command ...' | tee -a "${MY_LOGFILE}"
+log_command @@VBOX_INSERT_POST_INSTALL_COMMAND@@
+@@VBOX_COND_END@@
+
+
+#
+# Unmount the cdrom if we bound it and clean up the chroot if we set it up.
+#
+if [ -n "${MY_UNMOUNT_TARGET_CDROM}" ]; then
+ echo "** unbinding cdrom from jail..." | tee -a "${MY_LOGFILE}"
+ log_command umount "${MY_TARGET}${MY_CHROOT_CDROM}"
+fi
+
+if [ -n "${MY_RMDIR_TARGET_CDROM}" ]; then
+ log_command rmdir "${MY_TARGET}${MY_CHROOT_CDROM}"
+fi
+
+if [ -n "${MY_HAVE_CHROOT_SETUP}" ]; then
+ if chroot_cleanup; then
+ echo "** chroot_cleanup: done" | tee -a "${MY_LOGFILE}"
+ else
+ echo "** chroot_cleanup: failed $?" | tee -a "${MY_LOGFILE}"
+ fi
+fi
+
+
+#
+# Log footer.
+#
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+echo "** Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}"
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+
+exit ${MY_EXITCODE}
+
diff --git a/src/VBox/Main/UnattendedTemplates/debian_preseed.cfg b/src/VBox/Main/UnattendedTemplates/debian_preseed.cfg
new file mode 100644
index 00000000..5d5bc900
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/debian_preseed.cfg
@@ -0,0 +1,86 @@
+### Partitioning
+d-i partman-auto/disk string /dev/sda
+d-i partman-auto/method string regular
+d-i partman-lvm/device_remove_lvm boolean true
+d-i partman-md/device_remove_md boolean true
+d-i partman-auto/choose_recipe select atomic
+
+# This makes partman automatically partition without confirmation
+d-i partman-partitioning/confirm_write_new_label boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+
+# Locale
+d-i debian-installer/locale string @@VBOX_INSERT_LOCALE@@
+d-i console-setup/ask_detect boolean false
+d-i console-setup/layoutcode string us
+d-i keyboard-configuration/xkb-keymap select us
+
+# Network
+d-i netcfg/get_hostname string @@VBOX_INSERT_HOSTNAME_WITHOUT_DOMAIN@@
+d-i netcfg/get_domain string @@VBOX_INSERT_HOSTNAME_DOMAIN@@
+d-i netcfg/choose_interface select auto
+
+# Clock
+@@VBOX_COND_IS_RTC_USING_UTC@@
+d-i clock-setup/utc-auto boolean true
+d-i clock-setup/utc boolean true
+@@VBOX_COND_END@@
+@@VBOX_COND_IS_NOT_RTC_USING_UTC@@
+d-i clock-setup/utc-auto boolean false
+d-i clock-setup/utc boolean false
+@@VBOX_COND_END@@
+d-i time/zone string @@VBOX_INSERT_TIME_ZONE_UX@@
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@d-i clock-setup/ntp boolean false@@VBOX_COND_END@@
+@@VBOX_COND_IS_NOT_INSTALLING_ADDITIONS@@d-i clock-setup/ntp boolean true@@VBOX_COND_END@@
+
+# Packages, Mirrors, Image
+d-i base-installer/kernel/override-image string linux-server
+d-i base-installer/kernel/override-image string linux-image-amd64
+d-i pkgsel/install-language-support boolean false
+
+@@VBOX_COND_AVOID_UPDATES_OVER_NETWORK@@
+d-i apt-setup/use_mirror boolean false
+d-i netcfg/no_default_route true
+d-i netcfg/get_nameservers ""
+@@VBOX_COND_END@@
+
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+d-i apt-setup/restricted boolean true
+d-i apt-setup/universe boolean true
+@@VBOX_COND_END@@@@VBOX_COND_IS_MINIMAL_INSTALLATION@@
+tasksel tasksel/first multiselect minimal
+d-i pkgsel/include string openssh-server
+d-i pkgsel/upgrade select none
+@@VBOX_COND_END@@
+
+# Users
+d-i passwd/user-fullname string @@VBOX_INSERT_USER_FULL_NAME@@
+d-i passwd/username string @@VBOX_INSERT_USER_LOGIN@@
+d-i passwd/user-password password @@VBOX_INSERT_USER_PASSWORD@@
+d-i passwd/user-password-again password @@VBOX_INSERT_USER_PASSWORD@@
+d-i passwd/root-login boolean true
+d-i passwd/root-password password @@VBOX_INSERT_ROOT_PASSWORD@@
+d-i passwd/root-password-again password @@VBOX_INSERT_ROOT_PASSWORD@@
+d-i user-setup/allow-password-weak boolean true
+d-i passwd/user-default-groups string admin
+
+# Grub
+d-i grub-installer/grub2_instead_of_grub_legacy boolean true
+d-i grub-installer/only_debian boolean true
+
+# Due notably to potential USB sticks, the location of the MBR can not be
+# determined safely in general, so this needs to be specified:
+#d-i grub-installer/bootdev string /dev/sda
+# To install to the first device (assuming it is not a USB stick):
+d-i grub-installer/bootdev string default
+
+d-i finish-install/reboot_in_progress note
+
+# Custom Commands.
+# Note! Debian netboot images use busybox, so no bash.
+# Tell script to use target bash.
+d-i preseed/late_command string cp /cdrom/vboxpostinstall.sh /target/root/vboxpostinstall.sh \
+ && chmod +x /target/root/vboxpostinstall.sh \
+ && /bin/sh /target/root/vboxpostinstall.sh --need-target-bash --preseed-late-command
diff --git a/src/VBox/Main/UnattendedTemplates/fedora_ks.cfg b/src/VBox/Main/UnattendedTemplates/fedora_ks.cfg
new file mode 100644
index 00000000..c4c44c63
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/fedora_ks.cfg
@@ -0,0 +1,90 @@
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+# Firewall configuration
+firewall --disabled
+
+# Install OS instead of upgrade
+install
+
+# Use CDROM installation media
+cdrom
+
+# Root password
+rootpw --plaintext @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# System authorization information
+auth --useshadow --passalgo=sha512
+
+# Use text mode install
+text
+
+# System keyboard
+keyboard us
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@
+
+# SELinux configuration
+selinux --enforcing
+
+# Installation logging level
+logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# Network information
+network --bootproto=dhcp --device=eth0 --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information
+part / --fstype ext4 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@
+
+# Reboot after installation
+# Note! the --eject option requires Fedora 6 or later. Doesn't seem to work tough.
+# Note! doesn't really work. Maybe related to https://bugzilla.redhat.com/show_bug.cgi?id=810553 ??
+reboot --eject
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@standard
+@hardware-support
+@@VBOX_COND_END@@@@VBOX_COND_IS_MINIMAL_INSTALLATION@@
+@core
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from the cdrom:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+dkms
+make
+bzip2
+perl
+
+%end
+
+# Post install happens in a different script.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+mkdir -p /tmp/vboxcdrom
+mount /dev/cdrom /tmp/vboxcdrom
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/bash /mnt/sysimage/root/vboxpostinstall.sh --fedora
+umount /tmp/vboxcdrom
+%end
+
diff --git a/src/VBox/Main/UnattendedTemplates/freebsd_installer.cfg b/src/VBox/Main/UnattendedTemplates/freebsd_installer.cfg
new file mode 100644
index 00000000..06c3b97b
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/freebsd_installer.cfg
@@ -0,0 +1,30 @@
+### Partitioning
+PARTITIONS=ada0
+
+### Distribution files to install
+DISTRIBUTIONS="kernel.txz base.txz"
+
+################userad
+# Begin post installation modifications
+################
+#!/bin/sh
+
+# Set up Networking
+sysrc ifconfig_em0=DHCP
+sysrc sshd_enable=YES
+
+# Set Time Zone
+/bin/cp /usr/share/zoneinfo/UTC /etc/localtime
+/usr/bin/touch /etc/wall_cmos_clock
+/sbin/adjkerntz -a
+/usr/sbin/ntpdate -u 0.pool.ntp.org
+
+#Set Default Root Password
+echo @@VBOX_INSERT_ROOT_PASSWORD_SH@@|pw usermod root -h 0
+
+#Add configured user
+echo @@VBOX_INSERT_USER_PASSWORD_SH@@|pw useradd -c @@VBOX_INSERT_USER_FULL_NAME@@ -n @@VBOX_INSERT_USER_LOGIN_SH@@ -m -u 1001 -G wheel -s csh -h 0
+
+#Reboot System
+reboot
+
diff --git a/src/VBox/Main/UnattendedTemplates/freebsd_postinstall.sh b/src/VBox/Main/UnattendedTemplates/freebsd_postinstall.sh
new file mode 100755
index 00000000..91e374af
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/freebsd_postinstall.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+## @file
+# Post installation script template for FreeBSD.
+#
+
+#
+# Copyright (C) 2020-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.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, in version 3 of the
+# License.
+#
+# 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>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+exit 0
+
diff --git a/src/VBox/Main/UnattendedTemplates/lgw_ks.cfg b/src/VBox/Main/UnattendedTemplates/lgw_ks.cfg
new file mode 100644
index 00000000..c45c597f
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/lgw_ks.cfg
@@ -0,0 +1,91 @@
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+# Firewall configuration
+firewall --disabled
+
+# Install OS instead of upgrade
+install
+
+# Use DVD
+cdrom
+
+# Root password
+rootpw --plaintext @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# System authorization information
+auth --useshadow --passalgo=sha512
+
+# Use text mode install
+text
+
+# System keyboard
+keyboard us
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@
+
+# Disable the unsupported hardware popup (vmmdev?).
+unsupported_hardware
+
+# SELinux configuration
+# selinux --enforcing
+
+# Installation logging level
+logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# Network information
+network --bootproto=dhcp --device=enp0s3 --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information
+part / --fstype ext4 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@
+
+# Shut down after installation
+poweroff
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+@base
+@core
+
+# Prepare building the additions kernel module, try get what we can from the cdrom as it may be impossible
+# to install anything from the post script:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+dkms
+make
+bzip2
+perl
+
+%end
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs between fedora 26 to rhel5
+# and apparently there isn't any way to be certain that anaconda didn't unmount it already.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+df -h
+mkdir -p /tmp/vboxcdrom
+mount /dev/cdrom /tmp/vboxcdrom
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/bash /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+%end
+
diff --git a/src/VBox/Main/UnattendedTemplates/lgw_postinstall.sh b/src/VBox/Main/UnattendedTemplates/lgw_postinstall.sh
new file mode 100755
index 00000000..2f58bd95
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/lgw_postinstall.sh
@@ -0,0 +1,524 @@
+#!/bin/bash
+## @file
+# Post installation script template for local gateway image.
+#
+# Note! This script expects to be running chrooted (inside new sytem).
+#
+
+#
+# Copyright (C) 2020-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.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, in version 3 of the
+# License.
+#
+# 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>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+
+#
+# Globals.
+#
+MY_TARGET="/mnt/sysimage"
+MY_LOGFILE="${MY_TARGET}/var/log/vboxpostinstall.log"
+MY_CHROOT_CDROM="/cdrom"
+MY_CDROM_NOCHROOT="/tmp/vboxcdrom"
+MY_EXITCODE=0
+MY_DEBUG="" # "yes"
+
+@@VBOX_COND_HAS_PROXY@@
+PROXY="@@VBOX_INSERT_PROXY@@"
+export http_proxy="${PROXY}"
+export https_proxy="${PROXY}"
+echo "HTTP proxy is ${http_proxy}" | tee -a "${MY_LOGFILE}"
+echo "HTTPS proxy is ${https_proxy}" | tee -a "${MY_LOGFILE}"
+@@VBOX_COND_END@@
+
+#
+# Do we need to exec using target bash? If so, we must do that early
+# or ash will bark 'bad substitution' and fail.
+#
+if [ "$1" = "--need-target-bash" ]; then
+ # Try figure out which directories we might need in the library path.
+ if [ -z "${LD_LIBRARY_PATH}" ]; then
+ LD_LIBRARY_PATH="${MY_TARGET}/lib"
+ fi
+ for x in \
+ ${MY_TARGET}/lib \
+ ${MY_TARGET}/usr/lib \
+ ${MY_TARGET}/lib/*linux-gnu/ \
+ ${MY_TARGET}/lib32/ \
+ ${MY_TARGET}/lib64/ \
+ ${MY_TARGET}/usr/lib/*linux-gnu/ \
+ ${MY_TARGET}/usr/lib32/ \
+ ${MY_TARGET}/usr/lib64/ \
+ ;
+ do
+ if [ -e "$x" ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${x}"; fi;
+ done
+ export LD_LIBRARY_PATH
+
+ # Append target bin directories to the PATH as busybox may not have tee.
+ PATH="${PATH}:${MY_TARGET}/bin:${MY_TARGET}/usr/bin:${MY_TARGET}/sbin:${MY_TARGET}/usr/sbin"
+ export PATH
+
+ # Drop the --need-target-bash argument and re-exec.
+ shift
+ echo "******************************************************************************" >> "${MY_LOGFILE}"
+ echo "** Relaunching using ${MY_TARGET}/bin/bash $0 $*" >> "${MY_LOGFILE}"
+ echo "** LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "${MY_LOGFILE}"
+ echo "** PATH=${PATH}" >> "${MY_LOGFILE}"
+ exec "${MY_TARGET}/bin/bash" "$0" "$@"
+fi
+
+
+#
+# Commands.
+#
+
+# Logs execution of a command.
+log_command()
+{
+ echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+ echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+ echo "** Executing: $*" >> "${MY_LOGFILE}"
+ "$@" 2>&1 | tee -a "${MY_LOGFILE}"
+ MY_TMP_EXITCODE="${PIPESTATUS[0]}" # bashism - whatever.
+ if [ "${MY_TMP_EXITCODE}" != "0" ]; then
+ if [ "${MY_TMP_EXITCODE}" != "${MY_IGNORE_EXITCODE}" ]; then
+ echo "** exit code: ${MY_TMP_EXITCODE}" | tee -a "${MY_LOGFILE}"
+ MY_EXITCODE=1;
+ else
+ echo "** exit code: ${MY_TMP_EXITCODE} (ignored)" | tee -a "${MY_LOGFILE}"
+ fi
+ fi
+}
+
+# Logs execution of a command inside the target.
+log_command_in_target()
+{
+ log_command chroot "${MY_TARGET}" "$@"
+}
+
+# Checks if $1 is a command on the PATH inside the target jail.
+chroot_which()
+{
+ for dir in /bin /usr/bin /sbin /usr/sbin;
+ do
+ if [ -x "${MY_TARGET}${dir}/$1" ]; then
+ return 0;
+ fi
+ done
+ return 1;
+}
+
+#
+# Log header.
+#
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+echo "** VirtualBox Unattended Guest Installation - Late installation actions" >> "${MY_LOGFILE}"
+echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+echo "** Started: $0 $*" >> "${MY_LOGFILE}"
+
+
+#
+# We want the ISO available inside the target jail.
+#
+if [ -d "${MY_TARGET}${MY_CHROOT_CDROM}" ]; then
+ MY_RMDIR_TARGET_CDROM=
+else
+ MY_RMDIR_TARGET_CDROM="yes"
+ log_command mkdir -p ${MY_TARGET}${MY_CHROOT_CDROM}
+fi
+
+if [ -f "${MY_TARGET}${MY_CHROOT_CDROM}/vboxpostinstall.sh" ]; then
+ MY_UNMOUNT_TARGET_CDROM=
+ echo "** binding cdrom into jail: already done" | tee -a "${MY_LOGFILE}"
+else
+ MY_UNMOUNT_TARGET_CDROM="yes"
+ log_command mount -o bind "${MY_CDROM_NOCHROOT}" "${MY_TARGET}${MY_CHROOT_CDROM}"
+ if [ -f "${MY_TARGET}${MY_CHROOT_CDROM}/vboxpostinstall.sh" ]; then
+ echo "** binding cdrom into jail: success" | tee -a "${MY_LOGFILE}"
+ else
+ echo "** binding cdrom into jail: failed" | tee -a "${MY_LOGFILE}"
+ fi
+ if [ "${MY_DEBUG}" = "yes" ]; then
+ log_command find "${MY_TARGET}${MY_CHROOT_CDROM}"
+ fi
+fi
+
+
+#
+# Debug
+#
+if [ "${MY_DEBUG}" = "yes" ]; then
+ log_command id
+ log_command ps
+ log_command ps auxwwwf
+ log_command env
+ log_command df
+ log_command mount
+ log_command_in_target df
+ log_command_in_target mount
+ #log_command find /
+ MY_EXITCODE=0
+fi
+
+
+#
+# Proxy hack for yum
+#
+@@VBOX_COND_HAS_PROXY@@
+echo "" >> "${MY_TARGET}/etc/yum.conf"
+echo "proxy=@@VBOX_INSERT_PROXY@@" >> "${MY_TARGET}/etc/yum.conf"
+@@VBOX_COND_END@@
+
+#
+# Packages needed for GAs.
+#
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing packages for building kernel modules...' | tee -a "${MY_LOGFILE}"
+log_command_in_target yum -y install "kernel-devel-$(uname -r)"
+log_command_in_target yum -y install "kernel-headers-$(uname -r)"
+log_command_in_target yum -y install gcc
+log_command_in_target yum -y install binutils
+log_command_in_target yum -y install make
+log_command_in_target yum -y install dkms
+log_command_in_target yum -y install make
+log_command_in_target yum -y install bzip2
+log_command_in_target yum -y install perl
+
+
+#
+# GAs
+#
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing VirtualBox Guest Additions...' | tee -a "${MY_LOGFILE}"
+MY_IGNORE_EXITCODE=2 # returned if modules already loaded and reboot required.
+log_command_in_target /bin/bash "${MY_CHROOT_CDROM}/vboxadditions/VBoxLinuxAdditions.run" --nox11
+log_command_in_target /bin/bash -c "udevadm control --reload-rules" # GAs doesn't yet do this.
+log_command_in_target /bin/bash -c "udevadm trigger" # (ditto)
+MY_IGNORE_EXITCODE=
+log_command_in_target usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@"
+@@VBOX_COND_END@@
+
+#
+# Local gateway support
+#
+log_command_in_target yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+#log_command_in_target yum -y update
+log_command_in_target yum -y install openvpn
+log_command_in_target yum -y install connect-proxy
+log_command_in_target usermod -a -G wheel "@@VBOX_INSERT_USER_LOGIN@@"
+
+echo "** Creating ${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/cloud-bridge.conf..." | tee -a "${MY_LOGFILE}"
+cat >"${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/cloud-bridge.conf" <<'EOT'
+# port 1194
+# proto udp
+port 443
+proto tcp-server
+dev tap0
+secret static.key
+keepalive 10 120
+compress lz4-v2
+push "compress lz4-v2"
+persist-key
+persist-tun
+status /var/log/openvpn-status.log
+log-append /var/log/openvpn.log
+verb 3
+EOT
+
+echo "** Creating ${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/cloud-bridge.sh..." | tee -a "${MY_LOGFILE}"
+cat >"${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/cloud-bridge.sh" <<'EOT'
+# Initialize variables
+br="br0"
+tap="tap0"
+vnic1=$1
+vnic2=$2
+vnic2_gw=$3
+target_mac=$4
+
+# Install openvpn if it is missing
+if ! yum list installed openvpn; then
+ sudo yum -y install openvpn
+fi
+
+# Let openvpn traffic through Linux firewall
+#sudo iptables -I INPUT -p udp --dport 1194 -j ACCEPT
+sudo iptables -I INPUT -p tcp --dport 443 -j ACCEPT
+
+# Switch to secondary VNIC
+sudo ip route change default via $vnic2_gw dev $vnic2
+sudo ip link set dev $vnic1 down
+
+# Bring up the cloud end of the tunnel
+sudo openvpn --config cloud-bridge.conf --daemon
+
+# Use target MAC for primary VNIC
+sudo ip link set dev $vnic1 address $target_mac
+
+# Bridge tap and primary VNIC
+sudo ip link add name $br type bridge
+sudo ip link set dev $vnic1 master $br
+sudo ip link set dev $tap master $br
+
+# Bring up all interfaces
+sudo ip link set dev $tap up
+sudo ip link set dev $vnic1 up
+sudo ip link set dev $br up
+EOT
+log_command chmod +x "${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/cloud-bridge.sh"
+
+echo "** Creating ${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/local-bridge.conf..." | tee -a "${MY_LOGFILE}"
+cat >"${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/local-bridge.conf" <<'EOT'
+dev tap0
+# proto udp
+# port 1194
+proto tcp-client
+port 443
+persist-key
+persist-tun
+secret static.key
+compress lz4-v2
+log-append /var/log/openvpn.log
+verb 3
+EOT
+
+echo "** Creating ${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/local-bridge.sh..." | tee -a "${MY_LOGFILE}"
+cat >"${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/local-bridge.sh" <<'EOT'
+echo Complete command line for debugging purposes:
+echo $0 $*
+
+# Make sure we are at home
+cd ~
+
+# Initialize variables
+user=opc
+cbr_ip1=$1
+cbr_ip2=$2
+target_mac=$3
+br="br0"
+tap="tap0"
+eth="enp0s8"
+
+proxy1_ssh=""
+proxy2_ssh=""
+proxy2_vpn=""
+case $4 in
+ HTTP | HTTPS)
+ proxy1_ssh="connect-proxy -w 30 -H $5:$6 %h %p"
+ ;;
+ SOCKS | SOCKS5)
+ proxy1_ssh="connect-proxy -w 30 -S $5:$6 %h %p"
+ ;;
+ SOCKS4)
+ proxy1_ssh="connect-proxy -w 30 -4 -S $5:$6 %h %p"
+ ;;
+esac
+case $7 in
+ HTTP | HTTPS)
+ proxy2_ssh="connect-proxy -w 30 -H $8:$9 %h %p"
+ proxy2_vpn="--http-proxy $8 $9"
+ ;;
+ SOCKS | SOCKS5)
+ proxy2_ssh="connect-proxy -w 30 -S $8:$9 %h %p"
+ proxy2_vpn="--socks-proxy $8 $9"
+ ;;
+ SOCKS4)
+ proxy2_ssh="connect-proxy -w 30 -4 -S $8:$9 %h %p"
+ proxy2_vpn="--socks-proxy $8 $9"
+ ;;
+esac
+
+# Generate pre-shared secret and share it with the server, bypassing proxy if necessary
+/usr/sbin/openvpn --genkey --secret static.key
+for i in 1 2 3 4
+do
+ # Go via proxy if set
+ scp ${proxy1_ssh:+ -o ProxyCommand="$proxy1_ssh"} static.key cloud-bridge.conf cloud-bridge.sh $user@$cbr_ip1:
+ if [ $? -eq 0 ]; then break; fi; sleep 15
+ # Go direct even if proxy is set
+ scp static.key cloud-bridge.conf cloud-bridge.sh $user@$cbr_ip1:
+ if [ $? -eq 0 ]; then proxy1_ssh=""; break; fi; sleep 15
+done
+
+# Get metadata info from the cloud bridge
+for i in 1 2 3 4; do metadata=$(ssh ${proxy1_ssh:+ -o ProxyCommand="$proxy1_ssh"} $user@$cbr_ip1 sudo oci-network-config) && break || sleep 15; done
+
+# Extract primary VNIC info
+vnic1_md=`echo "$metadata"|grep -E "\sUP\s"`
+vnic1_dev=`echo $vnic1_md|cut -d ' ' -f 8`
+vnic1_mac=`echo $vnic1_md|cut -d ' ' -f 12`
+# Extract secondary VNIC info
+vnic2_md=`echo "$metadata"|grep -E "\sDOWN\s"`
+vnic2_dev=`echo $vnic2_md|cut -d ' ' -f 8`
+vnic2_gw=`echo $vnic2_md|cut -d ' ' -f 5`
+
+# Configure secondary VNIC
+ssh ${proxy1_ssh:+ -o ProxyCommand="$proxy1_ssh"} $user@$cbr_ip1 sudo oci-network-config -c
+
+# Bring up the cloud bridge
+ssh ${proxy2_ssh:+ -o ProxyCommand="$proxy2_ssh"} $user@$cbr_ip2 /bin/sh -x cloud-bridge.sh $vnic1_dev $vnic2_dev $vnic2_gw $target_mac
+if [ $? -eq 0 ]
+then
+ # SSH was able to reach cloud via proxy, establish a tunnel via proxy as well
+ sudo /usr/sbin/openvpn $proxy2_vpn --config local-bridge.conf --daemon --remote $cbr_ip2
+else
+ # Retry without proxy
+ ssh $user@$cbr_ip2 /bin/sh -x cloud-bridge.sh $vnic1_dev $vnic2_dev $vnic2_gw $target_mac
+ # Establish a tunnel to the cloud bridge
+ sudo /usr/sbin/openvpn --config local-bridge.conf --daemon --remote $cbr_ip2
+fi
+
+# Bridge the openvpn tap device and the local Ethernet interface
+sudo ip link set dev $eth down
+sudo ip link add name $br type bridge
+sudo ip link set dev $eth master $br
+sudo ip link set dev $tap master $br
+
+# Bring up all interfaces
+sudo ip link set dev $tap up
+sudo ip link set dev $eth up
+sudo ip link set dev $br up
+EOT
+log_command chmod +x "${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/local-bridge.sh"
+
+echo "** Creating ${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/.ssh/config..." | tee -a "${MY_LOGFILE}"
+log_command mkdir "${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/.ssh"
+cat >"${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/.ssh/config" <<'EOT'
+Host *
+ StrictHostKeyChecking no
+EOT
+log_command chmod 400 "${MY_TARGET}/home/@@VBOX_INSERT_USER_LOGIN@@/.ssh/config"
+
+log_command_in_target chown -R @@VBOX_INSERT_USER_LOGIN@@:@@VBOX_INSERT_USER_LOGIN@@ "/home/@@VBOX_INSERT_USER_LOGIN@@"
+
+echo '** Creating /etc/systemd/system/keygen.service...' | tee -a "${MY_LOGFILE}"
+cat >"${MY_TARGET}/etc/systemd/system/keygen.service" <<'EOT'
+[Unit]
+Description=Boot-time ssh key pair generator
+After=vboxadd.service
+
+[Service]
+ExecStart=/bin/sh -c 'su - vbox -c "cat /dev/zero | ssh-keygen -q -N \\\"\\\""'
+ExecStartPost=/bin/sh -c 'VBoxControl guestproperty set "/VirtualBox/Gateway/PublicKey" "`cat ~vbox/.ssh/id_rsa.pub`" --flags TRANSIENT'
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
+EOT
+log_command chmod 644 "${MY_TARGET}/etc/systemd/system/keygen.service"
+log_command_in_target systemctl enable keygen.service
+
+echo '** Creating /etc/sudoers.d/020_vbox_sudo...' | tee -a "${MY_LOGFILE}"
+echo "@@VBOX_INSERT_USER_LOGIN@@ ALL=(ALL) NOPASSWD: ALL" > "${MY_TARGET}/etc/sudoers.d/020_vbox_sudo"
+
+#
+# Test Execution Service.
+#
+@@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing Test Execution Service...' | tee -a "${MY_LOGFILE}"
+log_command_in_target test "${MY_CHROOT_CDROM}/vboxvalidationkit/linux/@@VBOX_INSERT_OS_ARCH@@/TestExecService"
+log_command mkdir -p "${MY_TARGET}/opt/validationkit" "${MY_TARGET}/media/cdrom"
+log_command cp -R ${MY_CDROM_NOCHROOT}/vboxvalidationkit/* "${MY_TARGET}/opt/validationkit/"
+log_command chmod -R u+rw,a+xr "${MY_TARGET}/opt/validationkit/"
+if [ -e "${MY_TARGET}/usr/bin/chcon" -o -e "${MY_TARGET}/bin/chcon" -o -e "${MY_TARGET}/usr/sbin/chcon" -o -e "${MY_TARGET}/sbin/chcon" ]; then
+ MY_IGNORE_EXITCODE=1
+ log_command_in_target chcon -R -t usr_t "/opt/validationkit/"
+ MY_IGNORE_EXITCODE=
+fi
+
+# systemd service config:
+MY_UNIT_PATH="${MY_TARGET}/lib/systemd/system"
+test -d "${MY_TARGET}/usr/lib/systemd/system" && MY_UNIT_PATH="${MY_TARGET}/usr/lib/systemd/system"
+if [ -d "${MY_UNIT_PATH}" ]; then
+ log_command cp "${MY_TARGET}/opt/validationkit/linux/vboxtxs.service" "${MY_UNIT_PATH}/vboxtxs.service"
+ log_command chmod 644 "${MY_UNIT_PATH}/vboxtxs.service"
+ log_command_in_target systemctl -q enable vboxtxs
+
+# System V like:
+elif [ -e "${MY_TARGET}/etc/init.d/" ]; then
+
+ # Install the script. On rhel6 scripts are under /etc/rc.d/ with /etc/init.d and /etc/rc?.d being symlinks.
+ if [ -d "${MY_TARGET}/etc/rc.d/init.d/" ]; then
+ MY_INIT_D_PARENT_PATH="${MY_TARGET}/etc/rc.d"
+ log_command ln -s "../../../opt/validationkit/linux/vboxtxs" "${MY_INIT_D_PARENT_PATH}/init.d/"
+ else
+ MY_INIT_D_PARENT_PATH="${MY_TARGET}/etc"
+ log_command ln -s "../../opt/validationkit/linux/vboxtxs" "${MY_INIT_D_PARENT_PATH}/init.d/"
+ fi
+
+ # Use runlevel management script if found.
+ if chroot_which chkconfig; then # Redhat based sysvinit systems
+ log_command_in_target chkconfig --add vboxtxs
+ elif chroot_which insserv; then # SUSE-based sysvinit systems
+ log_command_in_target insserv vboxtxs
+ elif chroot_which update-rc.d; then # Debian/Ubuntu-based systems
+ log_command_in_target update-rc.d vboxtxs defaults
+ elif chroot_which rc-update; then # Gentoo Linux
+ log_command_in_target rc-update add vboxtxs default
+ # Fall back on hardcoded symlinking.
+ else
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc0.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc1.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc6.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc2.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc3.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc4.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc5.d/S35vboxtxs"
+ fi
+else
+ echo "** error: Unknown init script system." | tee -a "${MY_LOGFILE}"
+fi
+
+@@VBOX_COND_END@@
+
+
+#
+# Run user command.
+#
+@@VBOX_COND_HAS_POST_INSTALL_COMMAND@@
+echo '** Running custom user command ...' | tee -a "${MY_LOGFILE}"
+log_command @@VBOX_INSERT_POST_INSTALL_COMMAND@@
+@@VBOX_COND_END@@
+
+
+#
+# Unmount the cdrom if we bound it and clean up the chroot if we set it up.
+#
+if [ -n "${MY_UNMOUNT_TARGET_CDROM}" ]; then
+ echo "** unbinding cdrom from jail..." | tee -a "${MY_LOGFILE}"
+ log_command umount "${MY_TARGET}${MY_CHROOT_CDROM}"
+fi
+
+if [ -n "${MY_RMDIR_TARGET_CDROM}" ]; then
+ log_command rmdir "${MY_TARGET}${MY_CHROOT_CDROM}"
+fi
+
+
+#
+# Log footer.
+#
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+echo "** Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}"
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+
+exit ${MY_EXITCODE}
+
diff --git a/src/VBox/Main/UnattendedTemplates/ol8_ks.cfg b/src/VBox/Main/UnattendedTemplates/ol8_ks.cfg
new file mode 100644
index 00000000..5ed3e553
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/ol8_ks.cfg
@@ -0,0 +1,109 @@
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+# Firewall configuration
+firewall --disabled
+
+# Install OS instead of upgrade
+install
+
+# Use CDROM installation media
+cdrom
+
+# Root password
+rootpw --plaintext @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# System authorization information
+auth --useshadow --passalgo=sha512
+
+# Use text mode install
+text
+
+# System keyboard
+keyboard us
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@
+
+# Disable the unsupported hardware popup (vmmdev?).
+# This has been removed from kickstart file format as of OL8
+#unsupported_hardware
+
+# SELinux configuration
+selinux --enforcing
+
+# Installation logging level
+logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# Network information
+network --bootproto=dhcp --device=link --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information
+part / --fstype ext4 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@ --plaintext
+
+# Reboot after installation
+# Note! Not sure exctly when the --eject option was added. Need to find out an make it optional.
+reboot --eject
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+@base
+@core
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@development
+@basic-desktop
+@desktop-debugging
+@desktop-platform
+@fonts
+@general-desktop
+@graphical-admin-tools
+@remote-desktop-clients
+@x11
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from the cdrom as it may be impossible
+# to install anything from the post script:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+@@VBOX_COND[${GUEST_OS_VERSION} vgt 8.0.0]@@
+elfutils-libelf-devel
+@@VBOX_COND_END@@
+dkms
+make
+bzip2
+perl
+
+#Package cloud-init is needed for possible automation the initial setup of virtual machine
+cloud-init
+
+%end
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs between fedora 26 to rhel5
+# and apparently there isn't any way to be certain that anaconda didn't unmount it already.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+df -h
+mkdir -p /tmp/vboxcdrom
+mount /dev/cdrom /tmp/vboxcdrom
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/bash /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+%end
diff --git a/src/VBox/Main/UnattendedTemplates/ol9_ks.cfg b/src/VBox/Main/UnattendedTemplates/ol9_ks.cfg
new file mode 100644
index 00000000..d0b07156
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/ol9_ks.cfg
@@ -0,0 +1,115 @@
+# Refer to RHEL9 kickstart reference:
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/performing_an_advanced_rhel_9_installation/kickstart-commands-and-options-reference_installing-rhel-as-an-experienced-user
+
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+# Firewall configuration
+firewall --disabled
+
+# Install OS instead of upgrade
+# Removed from kickstart file syntax in OL9
+#install
+
+# Use CDROM installation media
+cdrom
+
+# Root password
+rootpw --plaintext @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# auth or authconfig is deprecated in OL8
+# System authorization information
+#auth --useshadow --passalgo=sha512
+
+# Use text mode install
+text
+
+# System keyboard
+keyboard us
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@
+
+# Disable the unsupported hardware popup (vmmdev?).
+# Removed from kickstart file syntax in OL9
+#unsupported_hardware
+
+# SELinux configuration
+selinux --enforcing
+
+# Deprecated in OL9
+# Installation logging level
+#logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# Network information
+network --bootproto=dhcp --device=link --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information
+part / --fstype ext4 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@ --plaintext
+
+# Reboot after installation
+# Note! Not sure exctly when the --eject option was added. Need to find out an make it optional.
+reboot --eject
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+@base
+@core
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@development
+@basic-desktop
+@desktop-debugging
+@desktop-platform
+@fonts
+@general-desktop
+@graphical-admin-tools
+@remote-desktop-clients
+@x11
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from the cdrom as it may be impossible
+# to install anything from the post script:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+@@VBOX_COND[${GUEST_OS_VERSION} vgt 8.0.0]@@
+elfutils-libelf-devel
+@@VBOX_COND_END@@
+dkms
+make
+bzip2
+perl
+
+#Package cloud-init is needed for possible automation the initial setup of virtual machine
+cloud-init
+
+%end
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs between fedora 26 to rhel5
+# and apparently there isn't any way to be certain that anaconda didn't unmount it already.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+df -h
+mkdir -p /tmp/vboxcdrom
+mount /dev/cdrom /tmp/vboxcdrom
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/bash /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+%end
diff --git a/src/VBox/Main/UnattendedTemplates/ol_ks.cfg b/src/VBox/Main/UnattendedTemplates/ol_ks.cfg
new file mode 100644
index 00000000..8caaf38a
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/ol_ks.cfg
@@ -0,0 +1,108 @@
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+# Firewall configuration
+firewall --disabled
+
+# Install OS instead of upgrade
+install
+
+# Use CDROM installation media
+cdrom
+
+# Root password
+rootpw --plaintext @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# System authorization information
+auth --useshadow --passalgo=sha512
+
+# Use text mode install
+text
+
+# System keyboard
+keyboard us
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@
+
+# Disable the unsupported hardware popup (vmmdev?).
+unsupported_hardware
+
+# SELinux configuration
+selinux --enforcing
+
+# Installation logging level
+logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# Network information
+network --bootproto=dhcp --device=link --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information
+part / --fstype ext4 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@ --plaintext
+
+# Reboot after installation
+# Note! Not sure exctly when the --eject option was added. Need to find out an make it optional.
+reboot --eject
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+@base
+@core
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@development
+@basic-desktop
+@desktop-debugging
+@desktop-platform
+@fonts
+@general-desktop
+@graphical-admin-tools
+@remote-desktop-clients
+@x11
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from the cdrom as it may be impossible
+# to install anything from the post script:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+@@VBOX_COND[${GUEST_OS_VERSION} vgt 8.0.0]@@
+elfutils-libelf-devel
+@@VBOX_COND_END@@
+dkms
+make
+bzip2
+perl
+
+#Package cloud-init is needed for possible automation the initial setup of virtual machine
+cloud-init
+
+%end
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs between fedora 26 to rhel5
+# and apparently there isn't any way to be certain that anaconda didn't unmount it already.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+df -h
+mkdir -p /tmp/vboxcdrom
+mount /dev/cdrom /tmp/vboxcdrom
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/bash /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+%end
diff --git a/src/VBox/Main/UnattendedTemplates/ol_postinstall.sh b/src/VBox/Main/UnattendedTemplates/ol_postinstall.sh
new file mode 100755
index 00000000..800393af
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/ol_postinstall.sh
@@ -0,0 +1,340 @@
+#!/bin/bash
+## @file
+# Post installation script template for redhat- distros.
+#
+# Note! This script expects to be running chrooted (inside new sytem).
+#
+
+#
+# Copyright (C) 2017-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.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, in version 3 of the
+# License.
+#
+# 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>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+
+#
+# Globals.
+#
+MY_TARGET="/mnt/sysimage"
+MY_LOGFILE="${MY_TARGET}/var/log/vboxpostinstall.log"
+MY_CHROOT_CDROM="/cdrom"
+MY_CDROM_NOCHROOT="/tmp/vboxcdrom"
+MY_EXITCODE=0
+MY_DEBUG="" # "yes"
+GUEST_VERSION=@@VBOX_INSERT_GUEST_OS_VERSION@@
+GUEST_MAJOR_VERSION=@@VBOX_INSERT_GUEST_OS_MAJOR_VERSION@@
+
+@@VBOX_COND_HAS_PROXY@@
+PROXY="@@VBOX_INSERT_PROXY@@"
+export http_proxy="${PROXY}"
+export https_proxy="${PROXY}"
+echo "HTTP proxy is ${http_proxy}" | tee -a "${MY_LOGFILE}"
+echo "HTTPS proxy is ${https_proxy}" | tee -a "${MY_LOGFILE}"
+@@VBOX_COND_END@@
+
+#
+# Do we need to exec using target bash? If so, we must do that early
+# or ash will bark 'bad substitution' and fail.
+#
+if [ "$1" = "--need-target-bash" ]; then
+ # Try figure out which directories we might need in the library path.
+ if [ -z "${LD_LIBRARY_PATH}" ]; then
+ LD_LIBRARY_PATH="${MY_TARGET}/lib"
+ fi
+ for x in \
+ ${MY_TARGET}/lib \
+ ${MY_TARGET}/usr/lib \
+ ${MY_TARGET}/lib/*linux-gnu/ \
+ ${MY_TARGET}/lib32/ \
+ ${MY_TARGET}/lib64/ \
+ ${MY_TARGET}/usr/lib/*linux-gnu/ \
+ ${MY_TARGET}/usr/lib32/ \
+ ${MY_TARGET}/usr/lib64/ \
+ ;
+ do
+ if [ -e "$x" ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${x}"; fi;
+ done
+ export LD_LIBRARY_PATH
+
+ # Append target bin directories to the PATH as busybox may not have tee.
+ PATH="${PATH}:${MY_TARGET}/bin:${MY_TARGET}/usr/bin:${MY_TARGET}/sbin:${MY_TARGET}/usr/sbin"
+ export PATH
+
+ # Drop the --need-target-bash argument and re-exec.
+ shift
+ echo "******************************************************************************" >> "${MY_LOGFILE}"
+ echo "** Relaunching using ${MY_TARGET}/bin/bash $0 $*" >> "${MY_LOGFILE}"
+ echo "** LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "${MY_LOGFILE}"
+ echo "** PATH=${PATH}" >> "${MY_LOGFILE}"
+ exec "${MY_TARGET}/bin/bash" "$0" "$@"
+fi
+
+
+#
+# Commands.
+#
+
+# Logs execution of a command.
+log_command()
+{
+ echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+ echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+ echo "** Executing: $*" >> "${MY_LOGFILE}"
+ "$@" 2>&1 | tee -a "${MY_LOGFILE}"
+ MY_TMP_EXITCODE="${PIPESTATUS[0]}" # bashism - whatever.
+ if [ "${MY_TMP_EXITCODE}" != "0" ]; then
+ if [ "${MY_TMP_EXITCODE}" != "${MY_IGNORE_EXITCODE}" ]; then
+ echo "** exit code: ${MY_TMP_EXITCODE}" | tee -a "${MY_LOGFILE}"
+ MY_EXITCODE=1;
+ else
+ echo "** exit code: ${MY_TMP_EXITCODE} (ignored)" | tee -a "${MY_LOGFILE}"
+ fi
+ fi
+}
+
+# Logs execution of a command inside the target.
+log_command_in_target()
+{
+ log_command chroot "${MY_TARGET}" "$@"
+}
+
+# Checks if $1 is a command on the PATH inside the target jail.
+chroot_which()
+{
+ for dir in /bin /usr/bin /sbin /usr/sbin;
+ do
+ if [ -x "${MY_TARGET}${dir}/$1" ]; then
+ return 0;
+ fi
+ done
+ return 1;
+}
+
+#
+# Log header.
+#
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+echo "** VirtualBox Unattended Guest Installation - Late installation actions" >> "${MY_LOGFILE}"
+echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+echo "** Started: $0 $*" >> "${MY_LOGFILE}"
+
+
+#
+# We want the ISO available inside the target jail.
+#
+if [ -d "${MY_TARGET}${MY_CHROOT_CDROM}" ]; then
+ MY_RMDIR_TARGET_CDROM=
+else
+ MY_RMDIR_TARGET_CDROM="yes"
+ log_command mkdir -p ${MY_TARGET}${MY_CHROOT_CDROM}
+fi
+
+if [ -f "${MY_TARGET}${MY_CHROOT_CDROM}/vboxpostinstall.sh" ]; then
+ MY_UNMOUNT_TARGET_CDROM=
+ echo "** binding cdrom into jail: already done" | tee -a "${MY_LOGFILE}"
+else
+ MY_UNMOUNT_TARGET_CDROM="yes"
+ log_command mount -o bind "${MY_CDROM_NOCHROOT}" "${MY_TARGET}${MY_CHROOT_CDROM}"
+ if [ -f "${MY_TARGET}${MY_CHROOT_CDROM}/vboxpostinstall.sh" ]; then
+ echo "** binding cdrom into jail: success" | tee -a "${MY_LOGFILE}"
+ else
+ echo "** binding cdrom into jail: failed" | tee -a "${MY_LOGFILE}"
+ fi
+ if [ "${MY_DEBUG}" = "yes" ]; then
+ log_command find "${MY_TARGET}${MY_CHROOT_CDROM}"
+ fi
+fi
+
+
+#
+# Debug
+#
+if [ "${MY_DEBUG}" = "yes" ]; then
+ log_command id
+ log_command ps
+ log_command ps auxwwwf
+ log_command env
+ log_command df
+ log_command mount
+ log_command_in_target df
+ log_command_in_target mount
+ #log_command find /
+ MY_EXITCODE=0
+fi
+
+
+#
+# Add EPEL repository
+#
+EPEL_REPOSITORY="https://dl.fedoraproject.org/pub/epel/epel-release-latest-${GUEST_MAJOR_VERSION}.noarch.rpm"
+log_command_in_target wget ${EPEL_REPOSITORY}
+log_command_in_target yum localinstall -y "epel-release-latest-${GUEST_MAJOR_VERSION}.noarch.rpm"
+log_command_in_target rpm -q "oraclelinux-release-el${GUEST_MAJOR_VERSION}"
+log_command_in_target yum install -y yum-utils
+log_command_in_target yum-config-manager --enable epel
+
+
+#
+# Packages needed for GAs.
+#
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Finding UEK kernel...' | tee -a "${MY_LOGFILE}"
+UEK=$(find ${MY_TARGET}/boot/ -name "vmlinuz*"| grep uek | awk -F"-" 'BEGIN{OFS="-"} \
+{ kernel=$2; for (i = 3; i <= NF; i++) { kernel=sprintf("%s-%s",kernel,$i)}} END{print kernel}')
+CURRENT_KERNEL=$(uname -r)
+
+if [ -n $UEK ]; then
+ echo "UEK kernel was found - ${UEK}" | tee -a "${MY_LOGFILE}"
+ log_command_in_target yum -y install "kernel-uek-devel-${UEK}"
+fi
+echo "Installation uses kernel ${CURRENT_KERNEL}" | tee -a "${MY_LOGFILE}"
+
+echo '** Installing packages for building kernel modules...' | tee -a "${MY_LOGFILE}"
+log_command_in_target yum -y install "kernel-devel-$(uname -r)"
+log_command_in_target yum -y install "kernel-headers-$(uname -r)"
+log_command_in_target yum -y install gcc
+log_command_in_target yum -y install binutils
+log_command_in_target yum -y install make
+@@VBOX_COND[${GUEST_OS_VERSION} vgt 8.0.0]@@
+log_command_in_target yum -y install elfutils-libelf-devel
+@@VBOX_COND_END@@
+log_command_in_target yum -y install dkms
+log_command_in_target yum -y install make
+log_command_in_target yum -y install bzip2
+log_command_in_target yum -y install perl
+
+
+#
+#Package cloud-init is needed for possible automation the initial setup of virtual machine
+#
+log_command_in_target yum -y install cloud-init
+log_command_in_target systemctl enable cloud-init-local.service
+log_command_in_target systemctl enable cloud-init.service
+log_command_in_target systemctl enable cloud-config.service
+log_command_in_target systemctl enable cloud-final.service
+
+
+#
+# GAs
+#
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing VirtualBox Guest Additions...' | tee -a "${MY_LOGFILE}"
+MY_IGNORE_EXITCODE=2 # returned if modules already loaded and reboot required.
+log_command_in_target /bin/bash "${MY_CHROOT_CDROM}/vboxadditions/VBoxLinuxAdditions.run" --nox11
+log_command_in_target /bin/bash -c "udevadm control --reload-rules" # GAs doesn't yet do this.
+log_command_in_target /bin/bash -c "udevadm trigger" # (ditto)
+MY_IGNORE_EXITCODE=
+log_command_in_target usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@"
+@@VBOX_COND_END@@
+
+
+#
+# Test Execution Service.
+#
+@@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing Test Execution Service...' | tee -a "${MY_LOGFILE}"
+log_command_in_target test "${MY_CHROOT_CDROM}/vboxvalidationkit/linux/@@VBOX_INSERT_OS_ARCH@@/TestExecService"
+log_command mkdir -p "${MY_TARGET}/opt/validationkit" "${MY_TARGET}/media/cdrom"
+log_command cp -R ${MY_CDROM_NOCHROOT}/vboxvalidationkit/* "${MY_TARGET}/opt/validationkit/"
+log_command chmod -R u+rw,a+xr "${MY_TARGET}/opt/validationkit/"
+if [ -e "${MY_TARGET}/usr/bin/chcon" -o -e "${MY_TARGET}/bin/chcon" -o -e "${MY_TARGET}/usr/sbin/chcon" -o -e "${MY_TARGET}/sbin/chcon" ]; then
+ MY_IGNORE_EXITCODE=1
+ log_command_in_target chcon -R -t usr_t "/opt/validationkit/"
+ MY_IGNORE_EXITCODE=
+fi
+
+# systemd service config:
+MY_UNIT_PATH="${MY_TARGET}/lib/systemd/system"
+test -d "${MY_TARGET}/usr/lib/systemd/system" && MY_UNIT_PATH="${MY_TARGET}/usr/lib/systemd/system"
+if [ -d "${MY_UNIT_PATH}" ]; then
+ log_command cp "${MY_TARGET}/opt/validationkit/linux/vboxtxs.service" "${MY_UNIT_PATH}/vboxtxs.service"
+ log_command chmod 644 "${MY_UNIT_PATH}/vboxtxs.service"
+ log_command_in_target systemctl -q enable vboxtxs
+
+# System V like:
+elif [ -e "${MY_TARGET}/etc/init.d/" ]; then
+
+ # Install the script. On rhel6 scripts are under /etc/rc.d/ with /etc/init.d and /etc/rc?.d being symlinks.
+ if [ -d "${MY_TARGET}/etc/rc.d/init.d/" ]; then
+ MY_INIT_D_PARENT_PATH="${MY_TARGET}/etc/rc.d"
+ log_command ln -s "../../../opt/validationkit/linux/vboxtxs" "${MY_INIT_D_PARENT_PATH}/init.d/"
+ else
+ MY_INIT_D_PARENT_PATH="${MY_TARGET}/etc"
+ log_command ln -s "../../opt/validationkit/linux/vboxtxs" "${MY_INIT_D_PARENT_PATH}/init.d/"
+ fi
+
+ # Use runlevel management script if found.
+ if chroot_which chkconfig; then # Redhat based sysvinit systems
+ log_command_in_target chkconfig --add vboxtxs
+ elif chroot_which insserv; then # SUSE-based sysvinit systems
+ log_command_in_target insserv vboxtxs
+ elif chroot_which update-rc.d; then # Debian/Ubuntu-based systems
+ log_command_in_target update-rc.d vboxtxs defaults
+ elif chroot_which rc-update; then # Gentoo Linux
+ log_command_in_target rc-update add vboxtxs default
+ # Fall back on hardcoded symlinking.
+ else
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc0.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc1.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc6.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc2.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc3.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc4.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc5.d/S35vboxtxs"
+ fi
+else
+ echo "** error: Unknown init script system." | tee -a "${MY_LOGFILE}"
+fi
+
+@@VBOX_COND_END@@
+
+
+#
+# Run user command.
+#
+@@VBOX_COND_HAS_POST_INSTALL_COMMAND@@
+echo '** Running custom user command ...' | tee -a "${MY_LOGFILE}"
+log_command @@VBOX_INSERT_POST_INSTALL_COMMAND@@
+@@VBOX_COND_END@@
+
+
+#
+# Unmount the cdrom if we bound it and clean up the chroot if we set it up.
+#
+if [ -n "${MY_UNMOUNT_TARGET_CDROM}" ]; then
+ echo "** unbinding cdrom from jail..." | tee -a "${MY_LOGFILE}"
+ log_command umount "${MY_TARGET}${MY_CHROOT_CDROM}"
+fi
+
+if [ -n "${MY_RMDIR_TARGET_CDROM}" ]; then
+ log_command rmdir "${MY_TARGET}${MY_CHROOT_CDROM}"
+fi
+
+
+#
+# Log footer.
+#
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+echo "** Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}"
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+
+exit ${MY_EXITCODE}
diff --git a/src/VBox/Main/UnattendedTemplates/os2_cid_install.cmd b/src/VBox/Main/UnattendedTemplates/os2_cid_install.cmd
new file mode 100644
index 00000000..f82a0c87
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/os2_cid_install.cmd
@@ -0,0 +1,498 @@
+@ECHO OFF
+REM $Id: os2_cid_install.cmd $
+REM REM @fileREM
+REM VirtualBox CID Installation - main driver script for boot CD/floppy.
+REM
+
+REM
+REM Copyright (C) 2004-2023 Oracle and/or its affiliates.
+REM
+REM This file is part of VirtualBox base platform packages, as
+REM available from https://www.virtualbox.org.
+REM
+REM This program is free software; you can redistribute it and/or
+REM modify it under the terms of the GNU General Public License
+REM as published by the Free Software Foundation, in version 3 of the
+REM License.
+REM
+REM This program is distributed in the hope that it will be useful, but
+REM WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+REM General Public License for more details.
+REM
+REM You should have received a copy of the GNU General Public License
+REM along with this program; if not, see <https://www.gnu.org/licenses>.
+REM
+REM SPDX-License-Identifier: GPL-3.0-only
+REM
+
+REM Check the phase argument and jump to the right section of the file.
+if "%1" == "PHASE1" goto phase1
+if "%1" == "PHASE2" goto phase2
+if "%1" == "PHASE3" goto phase3
+@echo ** error: invalid or missing parameter. Expected PHASE1, PHASE2 or PHASE3 as the first parameter to the script.
+pause
+cmd.exe
+exit /b 1
+
+REM
+REM Phase 1 - Base system installation.
+REM
+:phase1
+SET CDROM=S:
+
+@echo on
+@echo .
+@echo Step 1.1 - Partition the disk.
+@echo .
+cd %CDROM%\os2image\disk_6
+%CDROM%
+
+lvm.exe /NEWMBR:1 && goto lvm_newmbr_ok
+@echo ** error: Writing a new MBR on disk 1 failed.
+goto lvm_failed
+:lvm_newmbr_ok
+
+@REM Depends the default drive name being "[ D1 ]". However it's cosmetical,
+@REM so we don't complain if this fails.
+lvm.exe "/SETNAME:DRIVE,[ D1 ],BootDrive"
+
+lvm.exe /CREATE:PARTITION,OS2Boot,1,1024,PRIMARY,BOOTABLE && goto lvm_create_partition_ok
+@echo ** error: Creating boot partition on disk 1 failed.
+goto lvm_failed
+:lvm_create_partition_ok
+
+lvm.exe /CREATE:VOLUME,COMPATIBILITY,BOOTOS2,C:,OS2Boot,1,OS2Boot && goto lvm_create_volume_ok
+@echo ** error: Creating boot volume on disk 1 failed.
+goto lvm_failed
+:lvm_create_volume_ok
+
+lvm.exe /SETSTARTABLE:VOLUME,OS2Boot && goto lvm_set_startable_ok
+@echo ** error: Setting boot volume on disk 1 startable failed.
+goto lvm_failed
+:lvm_set_startable_ok
+
+@REM Depending on the freespace automatically getting the name "[ FS1 ]".
+lvm.exe "/CREATE:PARTITION,Data,1,LOGICAL,NotBootable,[ FS1 ]" && goto lvm_create_data_partition_ok
+@echo ** error: Creating data partition on disk 1 failed.
+goto lvm_failed
+:lvm_create_data_partition_ok
+
+lvm.exe /CREATE:VOLUME,LVM,D:,Data,1,Data && goto lvm_create_data_volume_ok
+@echo ** error: Creating data volume on disk 1 failed.
+goto lvm_failed
+:lvm_create_data_volume_ok
+
+REM pause
+lvm.exe /QUERY
+REM CMD.EXE
+goto done_step1_1
+
+:lvm_failed
+@echo .
+@echo An LVM operation failed (see above).
+@echo The process requires a blank disk with no partitions. Starting LVM
+@echo so you can manually correct this.
+@echo .
+pause
+lvm.exe
+%CDROM%\cid\exe\os2\setboot.exe /B
+exit
+
+:done_step1_1
+
+:step1_2
+@echo .
+@echo Step 1.2 - Format the volumes.
+@echo .
+cd %CDROM%\os2image\disk_3
+%CDROM%
+
+FORMAT.COM C: /FS:HPFS /V:OS2Boot < %CDROM%\VBoxCID\YES.TXT && goto format_boot_ok
+@echo ** error: Formatting C: failed.
+pause
+:format_boot_ok
+
+FORMAT.COM D: /FS:JFS /V:Data < %CDROM%\VBoxCID\YES.TXT && goto format_data_ok
+@echo ** error: Formatting D: failed.
+pause
+:format_data_ok
+
+cd \
+
+:step1_3
+@echo .
+@echo Step 1.3 - Putting response files and CID tools on C:
+@echo .
+mkdir C:\VBoxCID
+mkdir C:\OS2
+copy %CDROM%\cid\exe\os2\*.* C:\VBoxCID
+copy %CDROM%\cid\dll\os2\*.* C:\VBoxCID
+copy %CDROM%\os2image\disk_2\inst32.dll C:\VBoxCID
+copy %CDROM%\VBoxCID\*.* C:\VBoxCID && goto copy_1_ok
+@echo ** error: Copying CID stuff from CDROM to C: failed (#1).
+pause
+:copy_1_ok
+copy %CDROM%\VBoxCID.CMD C:\VBoxCID && goto copy_2_ok
+@echo ** error: Copying CID stuff from CDROM to C: failed (#2).
+pause
+:copy_2_ok
+
+:step1_4
+@echo .
+@echo Step 1.4 - Start OS/2 CID installation.
+@echo .
+SET REMOTE_INSTALL_STATE=CAS_WARP4
+cd C:\OS2
+C:
+@REM Treat 0xfe00 as a success status. It seems to mean that a reboot is required.
+C:\VBoxCID\OS2_UTIL.EXE --as-zero 0xfe00 -- C:\VBoxCID\SEMAINT.EXE /S:%CDROM%\os2image /B:C: /L1:C:\VBoxCID\1.4.1-Maint.log /T:C:\OS2 && goto semaint_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\1.4.1-Maint.log
+pause
+:semaint_ok
+REM CMD.EXE
+
+cd C:\VBoxCID
+C:
+@REM Treat 0xff02 as a success status. It seems to mean that a reboot is required.
+C:\VBoxCID\OS2_UTIL.EXE --as-zero 0xff02 -- C:\VBoxCID\SEINST.EXE /S:%CDROM%\os2image /B:C: /L1:C:\VBoxCID\1.4.2-CIDInst.log /R:C:\VBoxCID\OS2.RSP /T:A:\ && goto seinst_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\1.4.2-CIDInst.log
+pause
+:seinst_ok
+REM CMD.EXE
+
+:step1_5
+@echo .
+@echo Step 1.5 - Make C: bootable.
+@echo .
+C:
+cd C:\OS2
+SYSINSTX.COM C: && goto sysinstx_ok
+pause
+:sysinstx_ok
+
+@echo Copying over patched OS2LDR from A:
+attrib -R -H -S C:\OS2LDR
+copy C:\OS2LDR C:\OS2LDR.Phase1
+del C:\OS2LDR
+copy A:\OS2LDR C:\OS2LDR && goto copy_os2ldr_ok
+pause
+:copy_os2ldr_ok
+attrib +R +H +S C:\OS2LDR
+
+@REM This copy is for the end of phase 2 as someone replaces it.
+copy A:\OS2LDR C:\VBoxCID && goto copy_os2ldr_2_ok
+pause
+:copy_os2ldr_2_ok
+attrib +r C:\VBoxCID\OS2LDR
+
+@echo Enabling Alt-F2 driver logging during boot.
+@echo > "C:\ALTF2ON.$$$"
+
+@echo Install startup.cmd for phase2.
+@echo C:\VBoxCID\OS2_UTIL.EXE --tee-to-backdoor --tee-to-file C:\VBoxCID\Phase2.log --append -- C:\OS2\CMD.EXE /C C:\VBoxCID\VBoxCID.CMD PHASE2> C:\STARTUP.CMD && goto phase2_startup_ok
+pause
+:phase2_startup_ok
+
+copy C:\CONFIG.SYS C:\VBoxCID\Phase1-end-config.sys
+
+REM now reboot.
+goto reboot
+
+
+REM
+REM Phase 2 - Install GRADD drivers (VGA is horribly slow).
+REM
+:phase2
+SET CDROM=E:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase2_found_cdrom
+SET CDROM=D:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase2_found_cdrom
+SET CDROM=F:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase2_found_cdrom
+SET CDROM=G:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase2_found_cdrom
+SET CDROM=H:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase2_found_cdrom
+SET CDROM=S:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase2_found_cdrom
+@echo ** error: Unable to find the CDROM drive
+pause
+CMD
+SET CDROM=E:
+:phase2_found_cdrom
+cd C:\VBoxCID
+C:
+
+@echo on
+
+:step2_1
+@echo .
+@echo Step 2.1 - Install the video driver.
+@echo .
+@REM Treat 0xfe00 as a success status. It seems to mean that a reboot is required.
+C:\VBoxCID\OS2_UTIL.EXE --as-zero 0xfe00 -- C:\OS2\INSTALL\DspInstl.EXE /PD:C:\OS2\INSTALL\GENGRADD.DSC /S:%CDROM%\OS2IMAGE /T:C: /RES:1024X768X16777216 /U && goto dspinstl_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\OS2\INSTALL\DSPINSTL.LOG
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\OS2\INSTALL\GRADD.LOG
+pause
+:dspinstl_ok
+
+@REM TODO: Error: 1 Error getting current desktop mode
+@REM UPDATE: This is probably not working because SVGA.EXE doesn't want to play along with our graphics adapter,
+@REM so it looks like there is no simple way of changing the resolution or select a better monitor.
+call VCfgCID.CMD /L1:C:\VBoxCID\2.1-Video.log /L2:C:\VBoxCID\2.1-Video-2.log /RES:1024X768X16777216 /MON:548
+goto vcfgcid_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\2.1-Video.log
+pause
+:vcfgcid_ok
+cd C:\VBoxCID
+C:
+
+:step2_2
+@echo Install startup.cmd for phase3.
+ren C:\STARTUP.CMD C:\VBoxCID\Phase2-end-startup.cmd
+copy C:\CONFIG.SYS C:\VBoxCID\Phase2-end-config.sys
+@echo C:\VBoxCID\OS2_UTIL.EXE --tee-to-backdoor --tee-to-file C:\VBoxCID\Phase3.log --append -- C:\OS2\CMD.EXE /C C:\VBoxCID\VBoxCID.CMD PHASE3> C:\STARTUP.CMD && goto phase3_startup_ok
+pause
+:phase3_startup_ok
+
+REM now reboot.
+goto reboot
+
+
+REM
+REM Phase 2 - The rest of the installation running of the base install with fast GRADD drivers.
+REM
+:phase3
+SET CDROM=E:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase3_found_cdrom
+SET CDROM=D:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase3_found_cdrom
+SET CDROM=F:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase3_found_cdrom
+SET CDROM=G:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase3_found_cdrom
+SET CDROM=H:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase3_found_cdrom
+SET CDROM=S:
+IF EXIST "%CDROM%\VBoxCID.CMD" goto phase3_found_cdrom
+@echo ** error: Unable to find the CDROM drive
+pause
+CMD
+SET CDROM=E:
+:phase3_found_cdrom
+cd C:\VBoxCID
+C:
+
+@echo on
+
+:step3_1
+@echo .
+@echo Step 3.1 - Install multimedia.
+@echo .
+cd C:\mmtemp
+C:
+@REM Does not have any /L, /L1, or /L2 options. Fixed log file: C:\MINSTALL.LOG.
+@REM Treat 0xfe00 as a success status. It seems to mean that a reboot is required.
+C:\VBoxCID\OS2_UTIL.EXE --as-zero 0xfe00 -- MInstall.EXE /M /R:C:\VBoxCID\MMOS2.RSP && goto mmos2_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\MINSTALL.LOG
+pause
+:mmos2_ok
+cd C:\VBoxCID
+
+:step3_2
+@echo .
+@echo Step 3.2 - Install features.
+@echo .
+@REM Treat 0xfe00 as a success status. It seems to mean that a reboot is required.
+C:\VBoxCID\OS2_UTIL.EXE --as-zero 0xfe00 -- CLIFI.EXE /A:C /B:C: /S:%CDROM%\os2image\fi /R:C:\OS2\INSTALL\FIBASE.RSP /L1:C:\VBoxCID\3.2-FeatureInstaller.log /R2:C:\VBoxCID\OS2.RSP
+@REM does not exit with status 0 on success.
+goto features_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\3.2-FeatureInstaller.log
+pause
+:features_ok
+
+:step3_3
+@echo .
+@echo Step 3.3 - Install MPTS.
+@echo .
+@REM If we want to use non-standard drivers like the intel ones, copy the .NIF- and
+@REM .OS2-files to C:\IBMCOM\MACS before launching the installer (needs creating first).
+@REM Note! Does not accept /L2:.
+@REM Note! Omitting /TU:C in hope that it solves the lan install failure (no netbeui configured in mpts).
+CD %CDROM%\CID\SERVER\MPTS
+%CDROM%
+@REM Treat 0xfe00 as a success status. It seems to mean that a reboot is required.
+C:\VBoxCID\OS2_UTIL.EXE --as-zero 0xfe00 -- %CDROM%\CID\SERVER\MPTS\MPTS.EXE /R:C:\VBoxCID\MPTS.RSP /S:%CDROM%\CID\SERVER\MPTS /T:C: /L1:C:\VBoxCID\3.3-Mpts.log && goto mpts_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\3.3-Mpts.log
+pause
+:mpts_ok
+CD %CDROM%\
+C:
+
+:step3_4
+@echo .
+@echo Step 3.4 - Install TCP/IP.
+@echo .
+CD %CDROM%\CID\SERVER\TCPAPPS
+%CDROM%
+@REM Treat 0xfe00 as a success status. It seems to mean that a reboot is required.
+C:\VBoxCID\OS2_UTIL.EXE --as-zero 0xfe00 -- CLIFI.EXE /A:C /B:C: /S:%CDROM%\CID\SERVER\TCPAPPS\INSTALL /R:%CDROM%\CID\SERVER\TCPAPPS\INSTALL\TCPINST.RSP /L1:C:\VBoxCID\3.4-tcp.log /L2:C:\VBoxCID\3.4-tcp-2.log && goto tcp_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\3.4-tcp.log
+pause
+:tcp_ok
+CD %CDROM%\
+C:
+
+CD %CDROM%\CID\SERVER\TCPAPPS\INSTALL
+%CDROM%
+C:\VBoxCID\OS2_UTIL.EXE -- %CDROM%\CID\SERVER\TCPAPPS\INSTALL\makecmd.exe C:\TCPIP en_US C:\MPTS && goto makecmd_ok
+pause
+:makecmd_ok
+cd %CDROM%\
+
+:step3_5
+@echo .
+@echo Step 3.5 - Install IBM LAN Requestor/Peer.
+@echo .
+SET REMOTE_INSTALL_STATE=CAS_OS/2 Peer
+CD %CDROM%\CID\SERVER\IBMLS
+%CDROM%
+C:\VBoxCID\OS2_UTIL.EXE -- %CDROM%\CID\SERVER\IBMLS\LANINSTR.EXE /REQ /R:C:\VBoxCID\IBMLan.rsp /L1:C:\VBoxCID\3.5-IBMLan.log /L2:C:\VBoxCID\3.5-IBMLan-2.log && goto ibmlan_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\3.5-IBMLan.log
+:ibmlan_ok
+CD %CDROM%\
+C:
+
+:step3_6
+@echo .
+@echo Step 3.6 - Install Netscape.
+@echo .
+CD C:\VBoxCID
+C:
+%CDROM%
+@REM Skipping as it hangs after a "Message file not found." error. (The DPATH amendment doesn't help.) Logs give no clue.
+@REM The install works fine after the phase3 reboot. Next log message then is "NS46EXIT QLTOBMCONVERT en_US, rc=0x0000",
+@REM so maybe it is related to the LANG environment variable or Locale? Hmm. LANG seems to be set...
+goto netscape_ok
+SET DPATH=%DPATH%;C:\NETSCAPE\SIUTIL;C:\NETSCAPE\PROGRAM;
+IF "x%LANG%x" == "xx" THEN SET LANG=en_US
+C:\VBoxCID\OS2_UTIL.EXE -- %CDROM%\CID\SERVER\NETSCAPE\INSTALL.EXE /X /A:I /TU:C: /C:%CDROM%\CID\SERVER\NETSCAPE\NS46.ICF /S:%CDROM%\CID\SERVER\NETSCAPE /R:C:\VBoxCID\Netscape.RSP /L1:C:\VBoxCID\3.6-Netscape.log /L2:C:\VBoxCID\3.6-Netscape-2.log && goto netscape_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\3.6-Netscape.log
+pause
+:netscape_ok
+CD %CDROM%\
+C:
+
+:step3_7
+@echo .
+@echo Step 3.7 - Install feature installer.
+@echo .
+@REM No /L2: support.
+@REM The /NN option is to make it not fail if netscape is missing.
+C:\VBoxCID\OS2_UTIL.EXE -- C:\OS2\INSTALL\WSFI\FiSetup.EXE /B:C: /S:C:\OS2\INSTALL\WSFI\FISETUP /NN /L1:C:\VBoxCID\3.7-FiSetup.log && goto fisetup_ok
+C:\VBoxCID\OS2_UTIL.EXE --file-to-backdoor C:\VBoxCID\3.7-FiSetup.log
+pause
+:fisetup_ok
+
+:step3_8
+@echo .
+@echo Step 3.8 - Install the test execution service (TXS).
+@echo .
+@@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
+mkdir C:\VBoxValKit
+mkdir D:\TestArea
+copy %CDROM%\VBoxValidationKit\*.* C:\VBoxValKit && goto valkit_copy_1_ok
+pause
+:valkit_copy_1_ok
+copy %CDROM%\VBoxValidationKit\os2\x86\*.* C:\VBoxValKit && goto valkit_copy_2_ok
+pause
+:valkit_copy_2_ok
+@@VBOX_COND_ELSE@@
+@echo Not requested. Skipping.
+@@VBOX_COND_END@@
+
+:step3_9
+@echo .
+@echo Step 3.9 - Install final startup.cmd and copy over OS2LDR again.
+@echo .
+attrib -r -h -s C:\STARTUP.CMD
+copy C:\VBoxCID\STARTUP.CMD C:\ && goto final_startup_ok
+pause
+:final_startup_ok
+
+attrib -r -h -s C:\OS2LDR
+if not exist C:\VBoxCID\OS2LDR pause
+if not exist C:\VBoxCID\OS2LDR goto final_os2ldr_ok
+copy C:\OS2LDR C:\OS2LDR.Phase2
+del C:\OS2LDR
+copy C:\VBoxCID\OS2LDR C:\OS2LDR && goto final_os2ldr_ok
+pause
+:final_os2ldr_ok
+attrib +r +h +s C:\OS2LDR
+
+:step3_10
+@REM Putting this after placing the final Startup.cmd so we can test the
+@REM installer's ability to parse and modify it.
+@echo .
+@echo Step 3.10 - Install guest additions.
+@echo .
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@
+%CDROM%\VBoxAdditions\OS2\VBoxOs2AdditionsInstall.exe --do-install && goto addition_install_ok
+pause
+:addition_install_ok
+@@VBOX_COND_ELSE@@
+@echo Not requested. Skipping.
+@@VBOX_COND_END@@
+
+:step3_11
+@echo .
+@echo Step 3.11 - Cleanup
+@echo .
+del /N C:\*.bio
+del /N C:\*.i13
+del /N C:\*.snp
+del /N C:\CONFIG.ADD
+mkdir C:\MMTEMP 2>nul
+del /N C:\MMTEMP\*.*
+@REM This is only needed if we don't install mmos2:
+@REM for %%i in (acpadd2 azt16dd azt32dd csbsaud es1688dd es1788dd es1868dd es1888dd es688dd jazzdd mvprobdd mvprodd sb16d2 sbawed2 sbd2 sbp2d2 sbpd2) do del /N C:\MMTEMP\OS2\DRIVERS\%%i\*.*
+@REM for %%i in (acpadd2 azt16dd azt32dd csbsaud es1688dd es1788dd es1868dd es1888dd es688dd jazzdd mvprobdd mvprodd sb16d2 sbawed2 sbd2 sbp2d2 sbpd2) do rmdir C:\MMTEMP\OS2\DRIVERS\%%i
+@REM rmdir C:\MMTEMP\OS2\DRIVERS
+@REM rmdir C:\MMTEMP\OS2
+rmdir C:\MMTEMP
+copy C:\CONFIG.SYS C:\VBoxCID || goto skip_sys_cleanup
+del /N C:\*.SYS
+copy C:\VBoxCID\CONFIG.SYS C:\
+:skip_sys_cleanup
+
+:step3_12
+@@VBOX_COND_HAS_POST_INSTALL_COMMAND@@
+@echo .
+@echo Step 3.12 - Custom actions: "@@VBOX_INSERT_POST_INSTALL_COMMAND@@"
+@echo .
+cd C:\VBoxCID
+C:
+@@VBOX_INSERT_POST_INSTALL_COMMAND@@
+@@VBOX_COND_END@@
+
+copy C:\CONFIG.SYS C:\VBoxCID\Phase3-end-config.sys
+
+
+REM
+REM Reboot (common to both phases).
+REM
+:reboot
+@echo .
+@echo Reboot (%1)
+@echo .
+cd C:\OS2
+C:
+
+@REM @echo debug
+@REM CMD.EXE
+
+SETBOOT /IBD:C
+pause
+CMD.EXE
+
diff --git a/src/VBox/Main/UnattendedTemplates/os2_response_files.rsp b/src/VBox/Main/UnattendedTemplates/os2_response_files.rsp
new file mode 100644
index 00000000..90788914
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/os2_response_files.rsp
@@ -0,0 +1,325 @@
+@@VBOX_SPLITTER_START[CONFIG.SYS]@@
+REM
+REM $Id: os2_response_files.rsp $
+REM VirtualBox CID Installation CONFIG.SYS for boot CD/floppy.
+REM
+
+REM Put the CDROM as letter S:.
+RESERVEDRIVELETTER=R
+LASTDRIVE=Z
+
+BUFFERS=32
+DISKCACHE=D2,LW
+
+MEMMAN=NOSWAP,PROTECT
+PROTECTONLY=YES
+IOPL=YES
+
+PAUSEONERROR=NO
+BREAK=OFF
+
+REM Just to be on the safe side, all paths include disk #0 thru #6.
+REM as it doesn't contain much interesting.
+REM Also adding typical C:\ locations for good measure...
+ LIBPATH=.;A:\;S:\OS2IMAGE\DISK_0;S:\OS2IMAGE\DISK_1;S:\OS2IMAGE\DISK_2;S:\OS2IMAGE\DISK_3;S:\OS2IMAGE\DISK_4;S:\OS2IMAGE\DISK_5;S:\OS2IMAGE\DISK_6;S:\OS2IMAGE\DISK_7;C:\OS2\DLL;C:\MPTN\DLL;C:\TCPIP\DLL;C:\IBMCOM\DLL;
+SET PATH=.;A:\;S:\OS2IMAGE\DISK_0;S:\OS2IMAGE\DISK_1;S:\OS2IMAGE\DISK_2;S:\OS2IMAGE\DISK_3;S:\OS2IMAGE\DISK_4;S:\OS2IMAGE\DISK_5;S:\OS2IMAGE\DISK_6;S:\OS2IMAGE\DISK_7;C:\OS2;C:\OS2\SYSTEM;
+SET DPATH=.;A:\;S:\OS2IMAGE\DISK_0;S:\OS2IMAGE\DISK_1;S:\OS2IMAGE\DISK_2;S:\OS2IMAGE\DISK_3;S:\OS2IMAGE\DISK_4;S:\OS2IMAGE\DISK_5;S:\OS2IMAGE\DISK_6;S:\OS2IMAGE\DISK_7;C:\OS2;C:\OS2\SYSTEM;
+
+COUNTRY=001,COUNT437.SYS
+CODEPAGE=850,437
+DEVINFO=KBD,US,KEYBOARD.DCP
+DEVINFO=SCR,VGA,VIO437.DCP
+
+BASEDEV=IBMKBD.SYS
+BASEDEV=IBM1FLPY.ADD
+BASEDEV=IBM1S506.ADD
+BASEDEV=IBMIDECD.FLT
+BASEDEV=OS2DASD.DMD
+BASEDEV=OS2LVM.DMD
+DEVICE=TESTCFG.SYS
+DEVICE=OS2CDROM.DMD
+DEVICE=DOS.SYS
+
+IFS=CDFS.IFS
+REM From here on we can load off the ISO.
+IFS=S:\OS2IMAGE\DISK_2\HPFS.IFS /C:2048
+IFS=S:\OS2IMAGE\DISK_2\JFS.IFS
+
+SET OS2_SHELL=S:\OS2IMAGE\DISK_2\CMD.EXE
+REM PROTSHELL=S:\OS2IMAGE\DISK_2\CMD.EXE
+REM Run the os2_cid_install.cmd file (renamed to VBOXCID.CMD on the ISO).
+REM PROTSHELL=S:\OS2IMAGE\DISK_2\CMD.EXE /C S:\VBOXCID\OS2_UTIL.EXE --tee-to-backdoor --tee-to-file C:\VBoxCID\Phase1.log --append -- S:\OS2IMAGE\DISK_2\CMD.EXE /C S:\VBOXCID.CMD PHASE1
+PROTSHELL=S:\VBOXCID\OS2_UTIL.EXE --tee-to-backdoor --tee-to-file C:\VBoxCID\Phase1.log --append -- S:\OS2IMAGE\DISK_2\CMD.EXE /C S:\VBOXCID.CMD PHASE1
+
+@@VBOX_SPLITTER_END[CONFIG.SYS]@@
+
+#
+# An "Y" for the format command.
+#
+@@VBOX_SPLITTER_START[YES.TXT]@@
+Y
+@@VBOX_SPLITTER_END[YES.TXT]@@
+
+#
+# This is the startup.cmd file that ends up on the final C:.
+#
+@@VBOX_SPLITTER_START[STARTUP.CMD]@@
+@REM
+@REM $Id: os2_response_files.rsp $
+@REM The startup file for C: for use after the successful install.
+@REM
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@
+C:\VBoxAdd\VBoxService.exe
+@@VBOX_COND_END@@
+dhcpstrt -i lan0
+@@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
+SET ENDLIBPATH=C:\VBoxValKit
+C:\VBoxValKit\TestExecService.exe --scratch=D:\TestArea --cdrom=E:\ --foreground
+pause
+@@VBOX_COND_END@@
+
+@@VBOX_SPLITTER_END[STARTUP.CMD]@@
+
+#
+# The OS2.RSP file is the main installer response file.
+#
+@@VBOX_SPLITTER_START[OS2.RSP]@@
+RebootRequired=0
+ExitOnError=1
+BaseFileSystem=1
+AlternateAdapter=0
+CDROM=2
+APM=1
+AdditionalPrinters=0
+CountryCode=001
+CountryKeyboard=US
+DefaultPrinter=0
+DisplayAdapter=7
+Documentation=1
+DOSSupport=1
+WIN-OS/2Support=1
+WIN-OS/2Desktop=0
+DPMI=1
+IBMFONTA.Selection=0
+IBMFONTG.Selection=0
+IBMFONTT.Selection=0
+IBMFONTJ.Selection=0
+IBMFONTC.Selection=0
+IBMFONTS.Selection=0
+IBMFONTK.Selection=0
+IBMFONTU.Selection=1
+XIBMFONT.InstDrive=C:
+FormatPartition=0
+Locale=en_US
+MigrateConfigFiles=0
+Mouse=1
+MousePort=0
+OptionalSystemUtilities=1
+OptionalSystemComponents=1
+PCMCIA=0
+PCMCIAOptions=0
+Optical=0
+HOTPLUG.Selection=0
+WARMSWAP.Selection=0
+PrimaryCodePage=1
+PrinterPort=1
+ProcessEnvironment=1
+ProgressIndication=1
+SCSI=0
+SerialDeviceSupport=1
+SourcePath=S:\os2image
+TargetDrive=C:
+*WIN-OS/2TargetDrive=C:
+SMP=0
+SMPPath=C:\OS2\BOOT
+ToolsAndGames=1
+MultimediaSupport=1
+PUMARKNET.Selection=0
+PUMARKNET.TarDrv=C:
+PUMARKVIS.Selection=0
+PUMARKVIS.TarDrv=C:
+LVMGUI.Selection=1
+Java11.Selection=1
+Runtime.Selection=1
+FIBASE.JavaDrive=C:
+SeedConfigSysLine=PAUSEONERROR=NO
+@@VBOX_SPLITTER_END[OS2.RSP]@@
+
+#
+# Multi-Protocol Transport Services (MPTS) response file.
+#
+@@VBOX_SPLITTER_START[MPTS.RSP]@@
+INST_SECTION = (
+ UPGRADE_LEVEL = SAME
+ INSTALL = PRODUCT
+)
+MPTS = (
+ [CONTROL]
+ Local_IPC = YES
+ INET_Access = YES
+ NETBIOS_Access = YES
+)
+
+PROTOCOL = (
+[PROT_MAN]
+
+ DRIVERNAME = PROTMAN$
+
+[IBMLXCFG]
+
+ netbeui_nif = netbeui.nif
+ tcpbeui_nif = tcpbeui.nif
+ tcpip_nif = tcpip.nif
+ IBMEAN_nif = IBMEAN.nif
+
+[NETBIOS]
+
+ DriverName = netbios$
+ ADAPTER0 = netbeui$,0
+ ADAPTER1 = tcpbeui$,1
+
+[netbeui_nif]
+
+ DriverName = netbeui$
+ Bindings = IBMEAN_nif
+ ETHERAND_TYPE = "I"
+ USEADDRREV = "YES"
+ OS2TRACEMASK = 0x0
+ SESSIONS = 130
+ NCBS = 225
+ NAMES = 21
+ SELECTORS = 50
+ USEMAXDATAGRAM = "NO"
+ ADAPTRATE = 1000
+ WINDOWERRORS = 0
+ MAXDATARCV = 4168
+ TI = 30000
+ T1 = 1000
+ T2 = 200
+ MAXIN = 1
+ MAXOUT = 1
+ NETBIOSTIMEOUT = 500
+ NETBIOSRETRIES = 3
+ NAMECACHE = 1000
+ RNDOPTION = 1
+ PIGGYBACKACKS = 1
+ DATAGRAMPACKETS = 50
+ PACKETS = 300
+ LOOPPACKETS = 8
+ PIPELINE = 5
+ MAXTRANSMITS = 6
+ MINTRANSMITS = 2
+ DLCRETRIES = 10
+ FCPRIORITY = 5
+ NETFLAGS = 0x0
+
+[tcpbeui_nif]
+
+ DriverName = tcpbeui$
+ Bindings = ,IBMEAN_nif
+ NODETYPE = "B-Node"
+ OS2TRACEMASK = 0x0
+ SESSIONS = 130
+ NCBS = 225
+ NAMES = 21
+ SELECTORS = 15
+ USEMAXDATAGRAM = "NO"
+ NETBIOSTIMEOUT = 500
+ NETBIOSRETRIES = 2
+ NAMECACHE = 1000
+ PURGECACHE = 0
+ PRELOADCACHE = "NO"
+ NAMESFILE = 0
+ DATAGRAMPACKETS = 20
+ PACKETS = 50
+ ENABLEDNS = 0
+ INTERFACERATE = 300
+
+[tcpip_nif]
+
+ DriverName = TCPIP$
+ Bindings = IBMEAN_nif
+
+[IBMEAN_nif]
+
+ DriverName = IBMEAN$
+)
+@@VBOX_SPLITTER_END[MPTS.RSP]@@
+
+#
+# IBM Lan Manager response file installing both TCP and old NETBIOS.
+#
+@@VBOX_SPLITTER_START[IBMLAN.RSP]@@
+UPDATEIBMLAN = Networks<
+ net1 = NETBEUI$,0,LM10,34,70,14
+ net2 = TCPBEUI$,1,LM10,34,70,14
+>
+
+ADDIBMLAN = Requester<
+wrkservices = MESSENGER
+wrknets = NET1, NET2
+>
+
+UPDATEIBMLAN = Requester<
+Computername = VBOXACP2
+Domain = VBOXGUEST
+useallmem = Yes
+>
+
+UPDATEIBMLAN = Peer<
+srvnets = NET1,NET2
+>
+
+ConfigTargetDrive = C
+ConfigAutoStartLS = Migrate
+ConfigSourceDrive = C
+InstallAPI = INSTALLIFREQUIRED
+InstallDosLanApi = INSTALLIFREQUIRED
+InstallInstallProgram = INSTALLIFREQUIRED
+InstallPeerService = INSTALL
+InstallRequester = INSTALLIFREQUIRED
+InstallUPM = INSTALLIFREQUIRED
+InstallMSGPopup = INSTALLIFREQUIRED
+InstallGUI = INSTALL
+InstallClipBoard = INSTALLIFREQUIRED
+InstallDesktopIcons = YES
+
+@@VBOX_SPLITTER_END[IBMLAN.RSP]@@
+
+#
+# Multimedia Presentation Manager/2 response file - Setting up SB16.
+#
+@@VBOX_SPLITTER_START[MMOS2.RSP]@@
+MMINSTSOURCE = "C:\\mmtemp"
+MMINSTTARGET = "C:"
+CHANGECONFIG = "Y"
+
+MMINSTGROUPS =
+ (
+ GROUP.1 = " "
+ GROUP.2 = "Software Motion Video=NUM=1,"
+ GROUP.4 = "IBM Video Capture Adapter=NUM=0,"
+ GROUP.5 = "1"
+ GROUP.14 = " "
+ GROUP.19 = " "
+ GROUP.20 = " "
+ GROUP.43 = "Sound Blaster 16=NUM=1,V1=1,V1=5,V1=5,V1=220,V1=330,"
+ )
+@@VBOX_SPLITTER_END[MMOS2.RSP]@@
+
+#
+# Good old netscape communicator.
+#
+@@VBOX_SPLITTER_START[NETSCAPE.RSP]@@
+COMP = Netscape Communicator 4.61 for OS/2
+FILE = C:\NETSCAPE
+CFGUPDATE = AUTO
+DELETEBACKUP = NO
+OVERWRITE = YES
+SAVEBACKUP = NO
+NSCONVERTBROWSER = YES
+NSCONVERTQL = YES
+NSASSOCIATEHTML = YES
+@@VBOX_SPLITTER_END[NETSCAPE.RSP]@@
+
+
diff --git a/src/VBox/Main/UnattendedTemplates/os2_util.exe b/src/VBox/Main/UnattendedTemplates/os2_util.exe
new file mode 100644
index 00000000..98df4f0a
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/os2_util.exe
Binary files differ
diff --git a/src/VBox/Main/UnattendedTemplates/redhat67_ks.cfg b/src/VBox/Main/UnattendedTemplates/redhat67_ks.cfg
new file mode 100644
index 00000000..455655d8
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/redhat67_ks.cfg
@@ -0,0 +1,108 @@
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+# Firewall configuration
+firewall --disabled
+
+# Install OS instead of upgrade
+install
+
+# Use CDROM installation media
+cdrom
+
+# Root password
+rootpw --plaintext @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# System authorization information
+auth --useshadow --passalgo=sha512
+
+# Use text mode install
+text
+
+# System keyboard
+keyboard us
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@
+
+# Disable the unsupported hardware popup (vmmdev?).
+#unsupported_hardware
+
+# SELinux configuration
+selinux --enforcing
+
+# Installation logging level
+logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# Network information
+network --bootproto=dhcp --device=link --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information
+part / --fstype ext4 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@ --plaintext
+
+# Reboot after installation
+# Note! Not sure exctly when the --eject option was added. Need to find out an make it optional.
+reboot --eject
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+@base
+@core
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@development
+@basic-desktop
+@desktop-debugging
+@desktop-platform
+@fonts
+@general-desktop
+@graphical-admin-tools
+@remote-desktop-clients
+@x11
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from the cdrom as it may be impossible
+# to install anything from the post script:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+@@VBOX_COND[${GUEST_OS_VERSION} vgt 8.0.0]@@
+elfutils-libelf-devel
+@@VBOX_COND_END@@
+dkms
+make
+bzip2
+perl
+
+#Package cloud-init is needed for possible automation the initial setup of virtual machine
+cloud-init
+
+%end
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs between fedora 26 to rhel5
+# and apparently there isn't any way to be certain that anaconda didn't unmount it already.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+df -h
+mkdir -p /tmp/vboxcdrom
+mount /dev/cdrom /tmp/vboxcdrom
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/bash /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+%end
diff --git a/src/VBox/Main/UnattendedTemplates/redhat_postinstall.sh b/src/VBox/Main/UnattendedTemplates/redhat_postinstall.sh
new file mode 100755
index 00000000..27091edf
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/redhat_postinstall.sh
@@ -0,0 +1,328 @@
+#!/bin/bash
+## @file
+# Post installation script template for redhat- distros.
+#
+# Note! This script expects to be running chrooted (inside new sytem).
+#
+
+#
+# Copyright (C) 2017-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.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, in version 3 of the
+# License.
+#
+# 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>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+
+#
+# Globals.
+#
+MY_TARGET="/mnt/sysimage"
+MY_LOGFILE="${MY_TARGET}/var/log/vboxpostinstall.log"
+MY_CHROOT_CDROM="/cdrom"
+MY_CDROM_NOCHROOT="/tmp/vboxcdrom"
+MY_EXITCODE=0
+MY_DEBUG="" # "yes"
+GUEST_VERSION=@@VBOX_INSERT_GUEST_OS_VERSION@@
+GUEST_MAJOR_VERSION=@@VBOX_INSERT_GUEST_OS_MAJOR_VERSION@@
+
+@@VBOX_COND_HAS_PROXY@@
+PROXY="@@VBOX_INSERT_PROXY@@"
+export http_proxy="${PROXY}"
+export https_proxy="${PROXY}"
+echo "HTTP proxy is ${http_proxy}" | tee -a "${MY_LOGFILE}"
+echo "HTTPS proxy is ${https_proxy}" | tee -a "${MY_LOGFILE}"
+@@VBOX_COND_END@@
+
+#
+# Do we need to exec using target bash? If so, we must do that early
+# or ash will bark 'bad substitution' and fail.
+#
+if [ "$1" = "--need-target-bash" ]; then
+ # Try figure out which directories we might need in the library path.
+ if [ -z "${LD_LIBRARY_PATH}" ]; then
+ LD_LIBRARY_PATH="${MY_TARGET}/lib"
+ fi
+ for x in \
+ ${MY_TARGET}/lib \
+ ${MY_TARGET}/usr/lib \
+ ${MY_TARGET}/lib/*linux-gnu/ \
+ ${MY_TARGET}/lib32/ \
+ ${MY_TARGET}/lib64/ \
+ ${MY_TARGET}/usr/lib/*linux-gnu/ \
+ ${MY_TARGET}/usr/lib32/ \
+ ${MY_TARGET}/usr/lib64/ \
+ ;
+ do
+ if [ -e "$x" ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${x}"; fi;
+ done
+ export LD_LIBRARY_PATH
+
+ # Append target bin directories to the PATH as busybox may not have tee.
+ PATH="${PATH}:${MY_TARGET}/bin:${MY_TARGET}/usr/bin:${MY_TARGET}/sbin:${MY_TARGET}/usr/sbin"
+ export PATH
+
+ # Drop the --need-target-bash argument and re-exec.
+ shift
+ echo "******************************************************************************" >> "${MY_LOGFILE}"
+ echo "** Relaunching using ${MY_TARGET}/bin/bash $0 $*" >> "${MY_LOGFILE}"
+ echo "** LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "${MY_LOGFILE}"
+ echo "** PATH=${PATH}" >> "${MY_LOGFILE}"
+ exec "${MY_TARGET}/bin/bash" "$0" "$@"
+fi
+
+
+#
+# Commands.
+#
+
+# Logs execution of a command.
+log_command()
+{
+ echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+ echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+ echo "** Executing: $*" >> "${MY_LOGFILE}"
+ "$@" 2>&1 | tee -a "${MY_LOGFILE}"
+ MY_TMP_EXITCODE="${PIPESTATUS[0]}" # bashism - whatever.
+ if [ "${MY_TMP_EXITCODE}" != "0" ]; then
+ if [ "${MY_TMP_EXITCODE}" != "${MY_IGNORE_EXITCODE}" ]; then
+ echo "** exit code: ${MY_TMP_EXITCODE}" | tee -a "${MY_LOGFILE}"
+ MY_EXITCODE=1;
+ else
+ echo "** exit code: ${MY_TMP_EXITCODE} (ignored)" | tee -a "${MY_LOGFILE}"
+ fi
+ fi
+}
+
+# Logs execution of a command inside the target.
+log_command_in_target()
+{
+ log_command chroot "${MY_TARGET}" "$@"
+}
+
+# Checks if $1 is a command on the PATH inside the target jail.
+chroot_which()
+{
+ for dir in /bin /usr/bin /sbin /usr/sbin;
+ do
+ if [ -x "${MY_TARGET}${dir}/$1" ]; then
+ return 0;
+ fi
+ done
+ return 1;
+}
+
+#
+# Log header.
+#
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+echo "** VirtualBox Unattended Guest Installation - Late installation actions" >> "${MY_LOGFILE}"
+echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+echo "** Started: $0 $*" >> "${MY_LOGFILE}"
+
+
+#
+# We want the ISO available inside the target jail.
+#
+if [ -d "${MY_TARGET}${MY_CHROOT_CDROM}" ]; then
+ MY_RMDIR_TARGET_CDROM=
+else
+ MY_RMDIR_TARGET_CDROM="yes"
+ log_command mkdir -p ${MY_TARGET}${MY_CHROOT_CDROM}
+fi
+
+if [ -f "${MY_TARGET}${MY_CHROOT_CDROM}/vboxpostinstall.sh" ]; then
+ MY_UNMOUNT_TARGET_CDROM=
+ echo "** binding cdrom into jail: already done" | tee -a "${MY_LOGFILE}"
+else
+ MY_UNMOUNT_TARGET_CDROM="yes"
+ log_command mount -o bind "${MY_CDROM_NOCHROOT}" "${MY_TARGET}${MY_CHROOT_CDROM}"
+ if [ -f "${MY_TARGET}${MY_CHROOT_CDROM}/vboxpostinstall.sh" ]; then
+ echo "** binding cdrom into jail: success" | tee -a "${MY_LOGFILE}"
+ else
+ echo "** binding cdrom into jail: failed" | tee -a "${MY_LOGFILE}"
+ fi
+ if [ "${MY_DEBUG}" = "yes" ]; then
+ log_command find "${MY_TARGET}${MY_CHROOT_CDROM}"
+ fi
+fi
+
+
+#
+# Debug
+#
+if [ "${MY_DEBUG}" = "yes" ]; then
+ log_command id
+ log_command ps
+ log_command ps auxwwwf
+ log_command env
+ log_command df
+ log_command mount
+ log_command_in_target df
+ log_command_in_target mount
+ #log_command find /
+ MY_EXITCODE=0
+fi
+
+
+#
+# Add EPEL repository
+#
+EPEL_REPOSITORY="https://dl.fedoraproject.org/pub/epel/epel-release-latest-${GUEST_MAJOR_VERSION}.noarch.rpm"
+log_command_in_target wget ${EPEL_REPOSITORY}
+log_command_in_target yum localinstall -y "epel-release-latest-${GUEST_MAJOR_VERSION}.noarch.rpm"
+log_command_in_target yum install -y yum-utils
+log_command_in_target yum-config-manager --enable epel
+
+
+#
+# Packages needed for GAs.
+#
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing packages for building kernel modules...' | tee -a "${MY_LOGFILE}"
+log_command_in_target yum -y install "kernel-devel-$(uname -r)"
+log_command_in_target yum -y install "kernel-headers-$(uname -r)"
+log_command_in_target yum -y install gcc
+log_command_in_target yum -y install binutils
+log_command_in_target yum -y install make
+@@VBOX_COND[${GUEST_OS_VERSION} vgt 8.0.0]@@
+log_command_in_target yum -y install elfutils-libelf-devel
+@@VBOX_COND_END@@
+log_command_in_target yum -y install dkms
+log_command_in_target yum -y install make
+log_command_in_target yum -y install bzip2
+log_command_in_target yum -y install perl
+
+
+#
+#Package cloud-init is needed for possible automation the initial setup of virtual machine
+#
+log_command_in_target yum -y install cloud-init
+log_command_in_target systemctl enable cloud-init-local.service
+log_command_in_target systemctl enable cloud-init.service
+log_command_in_target systemctl enable cloud-config.service
+log_command_in_target systemctl enable cloud-final.service
+
+
+#
+# GAs
+#
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing VirtualBox Guest Additions...' | tee -a "${MY_LOGFILE}"
+MY_IGNORE_EXITCODE=2 # returned if modules already loaded and reboot required.
+log_command_in_target /bin/bash "${MY_CHROOT_CDROM}/vboxadditions/VBoxLinuxAdditions.run" --nox11
+log_command_in_target /bin/bash -c "udevadm control --reload-rules" # GAs doesn't yet do this.
+log_command_in_target /bin/bash -c "udevadm trigger" # (ditto)
+MY_IGNORE_EXITCODE=
+log_command_in_target usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@"
+@@VBOX_COND_END@@
+
+
+#
+# Test Execution Service.
+#
+@@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
+echo "--------------------------------------------------" >> "${MY_LOGFILE}"
+echo '** Installing Test Execution Service...' | tee -a "${MY_LOGFILE}"
+log_command_in_target test "${MY_CHROOT_CDROM}/vboxvalidationkit/linux/@@VBOX_INSERT_OS_ARCH@@/TestExecService"
+log_command mkdir -p "${MY_TARGET}/opt/validationkit" "${MY_TARGET}/media/cdrom"
+log_command cp -R ${MY_CDROM_NOCHROOT}/vboxvalidationkit/* "${MY_TARGET}/opt/validationkit/"
+log_command chmod -R u+rw,a+xr "${MY_TARGET}/opt/validationkit/"
+if [ -e "${MY_TARGET}/usr/bin/chcon" -o -e "${MY_TARGET}/bin/chcon" -o -e "${MY_TARGET}/usr/sbin/chcon" -o -e "${MY_TARGET}/sbin/chcon" ]; then
+ MY_IGNORE_EXITCODE=1
+ log_command_in_target chcon -R -t usr_t "/opt/validationkit/"
+ MY_IGNORE_EXITCODE=
+fi
+
+# systemd service config:
+MY_UNIT_PATH="${MY_TARGET}/lib/systemd/system"
+test -d "${MY_TARGET}/usr/lib/systemd/system" && MY_UNIT_PATH="${MY_TARGET}/usr/lib/systemd/system"
+if [ -d "${MY_UNIT_PATH}" ]; then
+ log_command cp "${MY_TARGET}/opt/validationkit/linux/vboxtxs.service" "${MY_UNIT_PATH}/vboxtxs.service"
+ log_command chmod 644 "${MY_UNIT_PATH}/vboxtxs.service"
+ log_command_in_target systemctl -q enable vboxtxs
+
+# System V like:
+elif [ -e "${MY_TARGET}/etc/init.d/" ]; then
+
+ # Install the script. On rhel6 scripts are under /etc/rc.d/ with /etc/init.d and /etc/rc?.d being symlinks.
+ if [ -d "${MY_TARGET}/etc/rc.d/init.d/" ]; then
+ MY_INIT_D_PARENT_PATH="${MY_TARGET}/etc/rc.d"
+ log_command ln -s "../../../opt/validationkit/linux/vboxtxs" "${MY_INIT_D_PARENT_PATH}/init.d/"
+ else
+ MY_INIT_D_PARENT_PATH="${MY_TARGET}/etc"
+ log_command ln -s "../../opt/validationkit/linux/vboxtxs" "${MY_INIT_D_PARENT_PATH}/init.d/"
+ fi
+
+ # Use runlevel management script if found.
+ if chroot_which chkconfig; then # Redhat based sysvinit systems
+ log_command_in_target chkconfig --add vboxtxs
+ elif chroot_which insserv; then # SUSE-based sysvinit systems
+ log_command_in_target insserv vboxtxs
+ elif chroot_which update-rc.d; then # Debian/Ubuntu-based systems
+ log_command_in_target update-rc.d vboxtxs defaults
+ elif chroot_which rc-update; then # Gentoo Linux
+ log_command_in_target rc-update add vboxtxs default
+ # Fall back on hardcoded symlinking.
+ else
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc0.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc1.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc6.d/K65vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc2.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc3.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc4.d/S35vboxtxs"
+ log_command ln -s "../init.d/vboxtxs" "${MY_INIT_D_PARENT_PATH}/rc5.d/S35vboxtxs"
+ fi
+else
+ echo "** error: Unknown init script system." | tee -a "${MY_LOGFILE}"
+fi
+
+@@VBOX_COND_END@@
+
+
+#
+# Run user command.
+#
+@@VBOX_COND_HAS_POST_INSTALL_COMMAND@@
+echo '** Running custom user command ...' | tee -a "${MY_LOGFILE}"
+log_command @@VBOX_INSERT_POST_INSTALL_COMMAND@@
+@@VBOX_COND_END@@
+
+
+#
+# Unmount the cdrom if we bound it and clean up the chroot if we set it up.
+#
+if [ -n "${MY_UNMOUNT_TARGET_CDROM}" ]; then
+ echo "** unbinding cdrom from jail..." | tee -a "${MY_LOGFILE}"
+ log_command umount "${MY_TARGET}${MY_CHROOT_CDROM}"
+fi
+
+if [ -n "${MY_RMDIR_TARGET_CDROM}" ]; then
+ log_command rmdir "${MY_TARGET}${MY_CHROOT_CDROM}"
+fi
+
+
+#
+# Log footer.
+#
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+echo "** Date: `date -R`" >> "${MY_LOGFILE}"
+echo "** Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}"
+echo "******************************************************************************" >> "${MY_LOGFILE}"
+
+exit ${MY_EXITCODE}
diff --git a/src/VBox/Main/UnattendedTemplates/rhel3_ks.cfg b/src/VBox/Main/UnattendedTemplates/rhel3_ks.cfg
new file mode 100644
index 00000000..797737a8
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/rhel3_ks.cfg
@@ -0,0 +1,141 @@
+#
+# Template for RHEL3 and derivatives.
+#
+# Note! RHEL3 kickstart typically just hangs if it finds something it doesn't like.
+# So, all changes to this file must be tested!
+#
+# N.B! AHCI is not supported by RHEL3
+#
+
+# Use text mode install
+text
+
+# Install OS instead of upgrade
+install
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@.UTF-8
+
+# rhel4+rhel3 needs:
+langsupport --default @@VBOX_INSERT_LOCALE@@.UTF-8 @@VBOX_INSERT_LOCALE@@.UTF-8
+
+# Use CDROM installation media
+cdrom
+
+# System authorization information (rhel5: no --passalgo=sha512)
+#auth --useshadow
+authconfig --enableshadow --enablemd5
+
+# Root password (rhel5 not --plaintext groks)
+rootpw @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# Network information
+# rhel3: doesn't like --onboot=on.
+network --bootproto=dhcp --device=eth0 --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# Firewall configuration
+firewall --disabled
+
+# System keyboard
+keyboard us
+
+# rhel3 wants mouse config.
+mouse genericwheelps/2 --device psaux
+
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+# rhel3 wants xconfig.
+# TODO: Dunno VRAM size, is that a problem? --videoram 32768
+xconfig --card "VESA driver (generic)" --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 24 --startxonboot --defaultdesktop gnome
+@@VBOX_COND_END@@
+
+# SELinux configuration
+# rhel3: disable selinux
+# selinux --enforcing
+
+# Installation logging level
+#rhel4 does not grok: logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information (rhel5: no ext4, so use ext3)
+part / --fstype ext3 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+#rhel4 does not grok, done in welcome sequence: user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@
+
+# Reboot after installation
+# Note! Not sure exctly when the --eject option was added. Need to find out an make it optional.
+reboot --eject
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+grub
+kernel
+@ base
+@ core
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@ admin-tools
+@ development
+@ editors
+@ text-internet
+@ base-x
+@ graphics
+@ basic-desktop
+@ general-desktop
+@ gnome-desktop
+@ desktop-platform
+@ fonts
+@ graphical-admin-tools
+@ graphical-internet
+@ remote-desktop-clients
+@ sound-and-video
+@ x11
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from the cdrom as it may be impossible
+# to install anything from the post script (rhel3 seems to need kernel-sources):
+kernel-source
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+dkms
+make
+bzip2
+perl
+# %end - rhel5 does not like this.
+
+
+# Pre install script for mounting the cdrom, to make sure it cannot be ejcted.
+# See https://bugzilla.redhat.com/show_bug.cgi?id=239002
+%pre
+mkdir -p /tmp/vboxcdrom
+mount -t iso9660 /tmp/cdrom /tmp/vboxcdrom || mount -t iso9660 /dev/hdc /tmp/vboxcdrom || mount -t iso9660 /dev/scd0 /tmp/vboxcdrom || mount -t iso9660 /dev/sdb /tmp/vboxcdrom
+# %end - rhel5 does not like this.
+
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs between fedora 26 to rhel5
+# and apparently there isn't any way to be certain that anaconda didn't unmount it already.
+# rhel5: There is not /bin/bash, so use /bin/sh
+# rhel5: There is no /dev/cdrom, so try use /dev/hdc and /dev/sdb.
+# rhel3: no --log option
+%post --nochroot
+df -h
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/sh /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+rmdir /tmp/vboxcdrom
+# %end - rhel5 does not like this.
+
diff --git a/src/VBox/Main/UnattendedTemplates/rhel4_ks.cfg b/src/VBox/Main/UnattendedTemplates/rhel4_ks.cfg
new file mode 100644
index 00000000..54a2cdab
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/rhel4_ks.cfg
@@ -0,0 +1,120 @@
+# Template for RHEL5 and derivatives.
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+# Firewall configuration
+firewall --disabled
+
+# Install OS instead of upgrade
+install
+
+# Use CDROM installation media
+cdrom
+
+# Root password (rhel5 not --plaintext groks)
+rootpw @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# System authorization information (rhel5: no --passalgo=sha512)
+auth --useshadow
+
+# Use text mode install
+text
+
+# System keyboard
+keyboard us
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@
+# rhel4 needs:
+langsupport --default=@@VBOX_INSERT_LOCALE@@.UTF-8 @@VBOX_INSERT_LOCALE@@.UTF-8
+
+
+# SELinux configuration
+selinux --enforcing
+
+# Installation logging level
+#rhel4 does not grok: logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# Network information
+network --bootproto=dhcp --device=eth0 --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information (rhel5: no ext4, so use ext3)
+part / --fstype ext3 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+#rhel4 does not grok, done in welcome sequence: user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@
+
+# Reboot after installation
+# Note! Not sure exctly when the --eject option was added. Need to find out an make it optional.
+reboot --eject
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+@ base
+@ core
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@ admin-tools
+@ development
+@ editors
+@ text-internet
+@ base-x
+@ graphics
+@ basic-desktop
+@ general-desktop
+@ gnome-desktop
+@ desktop-platform
+@ fonts
+@ graphical-admin-tools
+@ graphical-internet
+@ remote-desktop-clients
+@ sound-and-video
+@ x11
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from the cdrom as it may be impossible
+# to install anything from the post script:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+dkms
+make
+bzip2
+perl
+# %end - rhel5 does not like this.
+
+
+# Pre install script for mounting the cdrom, to make sure it cannot be ejcted.
+# See https://bugzilla.redhat.com/show_bug.cgi?id=239002
+%pre
+mkdir -p /tmp/vboxcdrom
+mount -t iso9660 /tmp/cdrom /tmp/vboxcdrom || mount -t iso9660 /dev/hdc /tmp/vboxcdrom || mount -t iso9660 /dev/scd0 /tmp/vboxcdrom || mount -t iso9660 /dev/sdb /tmp/vboxcdrom
+# %end - rhel5 does not like this.
+
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs between fedora 26 to rhel5
+# and apparently there isn't any way to be certain that anaconda didn't unmount it already.
+# rhel5: There is not /bin/bash, so use /bin/sh
+# rhel5: There is no /dev/cdrom, so try use /dev/hdc and /dev/sdb.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+df -h 1>&2
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/sh /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+rmdir /tmp/vboxcdrom
+# %end - rhel5 does not like this.
+
diff --git a/src/VBox/Main/UnattendedTemplates/rhel5_ks.cfg b/src/VBox/Main/UnattendedTemplates/rhel5_ks.cfg
new file mode 100644
index 00000000..67bc998e
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/rhel5_ks.cfg
@@ -0,0 +1,119 @@
+# Template for RHEL5 and derivatives.
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+# Firewall configuration
+firewall --disabled
+
+# Install OS instead of upgrade
+install
+
+# Use CDROM installation media
+cdrom
+
+# Root password (rhel5 not --plaintext groks)
+rootpw @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# System authorization information (rhel5: no --passalgo=sha512)
+auth --useshadow
+
+# Use text mode install
+text
+
+# System keyboard
+keyboard us
+
+# System language
+lang @@VBOX_INSERT_LOCALE@@
+
+#rhel5 needs:
+@@VBOX_COND_HAS_NO_PRODUCT_KEY@@
+key --skip
+@@VBOX_COND_END@@
+@@VBOX_COND_HAS_PRODUCT_KEY@@
+key @@VBOX_INSERT_PRODUCT_KEY@@
+@@VBOX_COND_END@@
+
+
+# SELinux configuration
+selinux --enforcing
+
+# Installation logging level
+logging --level=info
+
+# System timezone
+timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@
+
+# Network information
+network --bootproto=dhcp --device=eth0 --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+# System bootloader configuration
+bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet"
+zerombr
+
+# Partition clearing information
+clearpart --all --initlabel
+
+# Disk partitioning information (rhel5: no ext4, so use ext3)
+part / --fstype ext3 --size 6000 --grow --asprimary
+part swap --size 1024
+
+#Initial user
+user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@
+
+# Reboot after installation
+# Note! Not sure exctly when the --eject option was added. Need to find out an make it optional.
+reboot --eject
+
+# Packages. We currently ignore missing packages/groups here to keep things simpler.
+%packages --ignoremissing
+@base
+@core
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@development
+@basic-desktop
+@desktop-debugging
+@desktop-platform
+@fonts
+@general-desktop
+@graphical-admin-tools
+@remote-desktop-clients
+@x11
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from the cdrom as it may be impossible
+# to install anything from the post script:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+dkms
+make
+bzip2
+perl
+# %end - rhel5 does not like this.
+
+
+# Pre install script for mounting the cdrom, to make sure it cannot be ejcted.
+# See https://bugzilla.redhat.com/show_bug.cgi?id=239002
+%pre
+mkdir -p /tmp/vboxcdrom
+mount -t iso9660 /tmp/cdrom /tmp/vboxcdrom || mount -t iso9660 /dev/hdc /tmp/vboxcdrom || mount -t iso9660 /dev/scd0 /tmp/vboxcdrom || mount -t iso9660 /dev/sdb /tmp/vboxcdrom
+# %end - rhel5 does not like this.
+
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs between fedora 26 to rhel5
+# and apparently there isn't any way to be certain that anaconda didn't unmount it already.
+# rhel5: There is not /bin/bash, so use /bin/sh
+# rhel5: There is no /dev/cdrom, so try use /dev/hdc and /dev/sdb.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+df -h 1>&2
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/sh /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+rmdir /tmp/vboxcdrom
+# %end - rhel5 does not like this.
+
diff --git a/src/VBox/Main/UnattendedTemplates/suse_autoinstall.xml b/src/VBox/Main/UnattendedTemplates/suse_autoinstall.xml
new file mode 100644
index 00000000..8708bde9
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/suse_autoinstall.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2016-2023 Oracle and/or its affiliates.
+
+ This file is part of VirtualBox base platform packages, as
+ available from https://www.virtualbox.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, in version 3 of the
+ License.
+
+ 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>.
+
+ SPDX-License-Identifier: GPL-3.0-only
+-->
+<!DOCTYPE profile>
+<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
+ <general>
+ <mode>
+ <confirm config:type="boolean">false</confirm>
+ </mode>
+ </general>
+
+ <partitioning config:type="list">
+ <drive>
+ <use>all</use>
+ </drive>
+ </partitioning>
+
+ <software>
+ <!-- Those are necessary for Guest Additions -->
+ <packages config:type="list">
+ <package>gcc</package>
+ <package>automake</package>
+ <package>kernel-source</package>
+ <!-- 'smpppd' is required on openSUSE 11.4 -->
+ <package>smpppd</package>
+ </packages>
+
+ <patterns config:type="list">
+ <pattern>apparmor</pattern>
+ <pattern>apparmor_opt</pattern>
+ <pattern>base</pattern>
+ <pattern>kde</pattern>
+ <!--pattern>Basis-Devel</pattern-->
+ <!--pattern>devel_kernel</pattern-->
+ <pattern>default</pattern>
+ <pattern>sw_management</pattern>
+ <pattern>sw_management_kde4</pattern>
+ <pattern>yast2_install_wf</pattern>
+ </patterns>
+ </software>
+
+ <configure>
+ <x11>
+ <display_manager>kdm</display_manager>
+ </x11>
+
+ <networking>
+ <interfaces config:type="list">
+ <interface>
+ <bootproto>dhcp</bootproto>
+ <device>eth0</device>
+ <startmode>auto</startmode>
+ <usercontrol>yes</usercontrol>
+ </interface>
+ </interfaces>
+ </networking>
+
+ <users config:type="list">
+ <user>
+ <fullname>root</fullname>
+ <username>root</username>
+ <encrypted config:type="boolean">false</encrypted>
+ <user_password>$password</user_password>
+ </user>
+ <user>
+ <groups>video,dialout,vboxsf</groups>
+ <fullname>$user</fullname>
+ <username>$user</username>
+ <encrypted config:type="boolean">false</encrypted>
+ <user_password>$password</user_password>
+ </user>
+ </users>
+ </configure>
+</profile>
diff --git a/src/VBox/Main/UnattendedTemplates/ubuntu_preseed.cfg b/src/VBox/Main/UnattendedTemplates/ubuntu_preseed.cfg
new file mode 100644
index 00000000..c7439fbd
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/ubuntu_preseed.cfg
@@ -0,0 +1,101 @@
+### software sources
+d-i ubiquity/use_nonfree true
+d-i ubiquity/install_oem false
+
+### Partitioning
+d-i partman-auto/disk string /dev/sda
+d-i partman-auto/method string regular
+d-i partman-lvm/device_remove_lvm boolean true
+d-i partman-md/device_remove_md boolean true
+d-i partman-auto/choose_recipe select atomic
+
+# This makes partman automatically partition without confirmation
+d-i partman-partitioning/confirm_write_new_label boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+
+# Locale
+d-i debian-installer/locale string @@VBOX_INSERT_LOCALE@@
+d-i console-setup/ask_detect boolean false
+d-i console-setup/layoutcode string us
+d-i keyboard-configuration/xkb-keymap select us
+
+# Network
+d-i netcfg/get_hostname string @@VBOX_INSERT_HOSTNAME_WITHOUT_DOMAIN@@
+d-i netcfg/get_domain string @@VBOX_INSERT_HOSTNAME_DOMAIN@@
+d-i netcfg/choose_interface select auto
+
+# Clock
+@@VBOX_COND_IS_RTC_USING_UTC@@
+d-i clock-setup/utc-auto boolean true
+d-i clock-setup/utc boolean true
+@@VBOX_COND_END@@
+@@VBOX_COND_IS_NOT_RTC_USING_UTC@@
+d-i clock-setup/utc-auto boolean false
+d-i clock-setup/utc boolean false
+@@VBOX_COND_END@@
+d-i time/zone string @@VBOX_INSERT_TIME_ZONE_UX@@
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@d-i clock-setup/ntp boolean false@@VBOX_COND_END@@
+@@VBOX_COND_IS_NOT_INSTALLING_ADDITIONS@@d-i clock-setup/ntp boolean true@@VBOX_COND_END@@
+
+# Packages, Mirrors, Image
+d-i base-installer/kernel/override-image string linux-server
+d-i base-installer/kernel/override-image string linux-image-amd64
+## @todo use nearest mirror somehow...
+d-i mirror/country string @@VBOX_INSERT_COUNTRY@@
+d-i mirror/http/proxy string
+## @todo minimal install?
+d-i apt-setup/restricted boolean true
+d-i apt-setup/universe boolean true
+d-i pkgsel/install-language-support boolean false
+# Stuff we need to build additions modules:
+d-i pkgsel/include string build-essential linux-headers-generic perl make
+# Package cloud-init is needed for possible automation the initial setup of virtual machine
+d-i pkgsel/include cloud-init
+
+# Users
+d-i passwd/user-fullname string @@VBOX_INSERT_USER_FULL_NAME@@
+d-i passwd/username string @@VBOX_INSERT_USER_LOGIN@@
+d-i passwd/user-password password @@VBOX_INSERT_USER_PASSWORD@@
+d-i passwd/user-password-again password @@VBOX_INSERT_USER_PASSWORD@@
+d-i passwd/root-login boolean true
+d-i passwd/root-password password @@VBOX_INSERT_ROOT_PASSWORD@@
+d-i passwd/root-password-again password @@VBOX_INSERT_ROOT_PASSWORD@@
+d-i user-setup/allow-password-weak boolean true
+d-i passwd/user-default-groups string admin
+
+# Grub
+d-i grub-installer/grub2_instead_of_grub_legacy boolean true
+d-i grub-installer/only_debian boolean true
+
+@@VBOX_COND[${GUEST_OS_VERSION} vge 14.04 && ${GUEST_OS_VERSION} vle 15.04]@@
+# Due notably to potential USB sticks, the location of the MBR can not be
+# determined safely in general, so this needs to be specified:
+# grub-install fails on [14.04.0, 15.04] by complaining "not being able to find default".
+# pointing it to /dev/sda gets around that problem.
+d-i grub-installer/bootdev string /dev/sda
+@@VBOX_COND_ELSE@@
+# To install to the first device (assuming it is not a USB stick):
+d-i grub-installer/bootdev string default
+@@VBOX_COND_END@@
+
+d-i finish-install/reboot_in_progress note
+
+# Custom Commands
+d-i preseed/late_command string cp /cdrom/vboxpostinstall.sh /target/root/vboxpostinstall.sh \
+ && chmod +x /target/root/vboxpostinstall.sh \
+ && /bin/bash /root/vboxpostinstall.sh --preseed-late-command
+
+# Same as above, but for ubiquity.
+ubiquity ubiquity/success_command string vboxpostinstall.sh
+ubiquity ubiquity/success_command string cp /cdrom/vboxpostinstall.sh /target/root/vboxpostinstall.sh \
+ && chmod +x /target/root/vboxpostinstall.sh \
+ && /bin/bash /target/root/vboxpostinstall.sh --ubiquity-success-command
+
+# automatically reboot after installation.
+ubiquity ubiquity/reboot boolean true
+
+## Skip downloading updates during installation (better for testing).
+# Seems this doesn't make any difference, so why bother.
+#ubiquity ubiquity/download_updates boolean false
diff --git a/src/VBox/Main/UnattendedTemplates/win_nt5_unattended.sif b/src/VBox/Main/UnattendedTemplates/win_nt5_unattended.sif
new file mode 100644
index 00000000..fe6a7018
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/win_nt5_unattended.sif
@@ -0,0 +1,60 @@
+;SetupMgrTag
+[Data]
+ AutoPartition = 1
+ MsDosInitiated = "0"
+ UnattendedInstall = "Yes"
+
+[Unattended]
+ UnattendMode = FullUnattended
+ OemSkipEula = Yes
+ OemPreinstall = No
+ TargetPath = \WINDOWS
+ Repartition = Yes
+ UnattendSwitch = "Yes"
+ DriverSigningPolicy = Ignore
+ WaitForReboot = "No"
+
+[GuiUnattended]
+ AdminPassword = "@@VBOX_INSERT_ROOT_PASSWORD@@"
+ EncryptedAdminPassword = No
+ AutoLogon = Yes
+ OEMSkipRegional = 1
+ OemSkipWelcome = 1
+; TODO: Make timezone configurable?
+ TimeZone = @@VBOX_INSERT_TIME_ZONE_WIN_INDEX@@
+ OemSkipWelcome = 1
+
+[UserData]
+; ProductKey was introduced in XP, ProductID was used in 2K and earlier.
+ ProductKey = "@@VBOX_INSERT_PRODUCT_KEY@@"
+ ProductID = "@@VBOX_INSERT_PRODUCT_KEY@@"
+; ; TODO: we're currently setting this up as Administrator only. We should respect the --user too.
+; ; Maybe consider: https://unattended.msfn.org/unattended.xp/view/web/27/SESSID=329e04d6824e220b0bb415d0665b1fe0/
+ FullName = "@@VBOX_INSERT_USER_LOGIN@@"
+ OrgName = ""
+ ComputerName = "@@VBOX_INSERT_HOSTNAME_WITHOUT_DOMAIN_MAX_15@@"
+
+[RegionalSettings]
+; ; TODO: If we implement locales below, we must also install the necessary language groups here. Fun.
+; LanguageGroup=1,2,3,4,5,6 - installed by default with XP
+
+; ; TODO: Implement mapping locales to windows LCIDs.
+; 0409:00000409 is US.
+; SystemLocale=00000419 - russian
+; ; TODO: Make Input locale configurable?
+; InputLocale=0409:00000409,0419:00000419 - US,Russian
+
+[LicenseFilePrintData]
+; This section is used for server installs.
+ AutoMode = "PerServer"
+ AutoUsers = "5"
+
+[Identification]
+ JoinWorkgroup = WORKGROUP
+
+[Networking]
+ InstallDefaultComponents = Yes
+
+[GuiRunOnce]
+ Command0="A:\VBOXPOST.CMD --xp-or-older"
+
diff --git a/src/VBox/Main/UnattendedTemplates/win_nt6_unattended.xml b/src/VBox/Main/UnattendedTemplates/win_nt6_unattended.xml
new file mode 100644
index 00000000..ec9aa4e2
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/win_nt6_unattended.xml
@@ -0,0 +1,300 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016-2023 Oracle and/or its affiliates.
+
+ This file is part of VirtualBox base platform packages, as
+ available from https://www.virtualbox.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, in version 3 of the
+ License.
+
+ 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>.
+
+ SPDX-License-Identifier: GPL-3.0-only
+-->
+<unattend xmlns="urn:schemas-microsoft-com:unattend"
+ xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
+
+ <settings pass="windowsPE">
+ <component name="Microsoft-Windows-International-Core-WinPE"
+ processorArchitecture="@@VBOX_INSERT_OS_ARCH_ATTRIB_DQ@@"
+ publicKeyToken="31bf3856ad364e35" language="neutral"
+ versionScope="nonSxS">
+ <InputLocale>en-US</InputLocale>
+ <SystemLocale>@@VBOX_INSERT_DASH_LOCALE@@</SystemLocale>
+ <UserLocale>@@VBOX_INSERT_DASH_LOCALE@@</UserLocale>
+ <!-- UILanguage must match the installation media language. Stuff like de-CH does not work for
+ example de_windows_7_enterprise_with_sp1_x64_dvd_u_677649.iso. However, stupidly we cannot
+ omit this element (kudos to brilliant minds at MS). -->
+ <UILanguage>@@VBOX_INSERT_LANGUAGE@@</UILanguage>
+ </component>
+
+ <component name="Microsoft-Windows-Setup"
+ processorArchitecture="@@VBOX_INSERT_OS_ARCH_ATTRIB_DQ@@"
+ publicKeyToken="31bf3856ad364e35" language="neutral"
+ versionScope="nonSxS">
+
+ <DiskConfiguration>
+ <WillShowUI>OnError</WillShowUI>
+ <Disk>
+ <DiskID>0</DiskID>
+ <WillWipeDisk>true</WillWipeDisk>
+@@VBOX_COND_IS_NOT_FIRMWARE_UEFI@@
+ <CreatePartitions>
+ <!-- TODO: Use the standard partitioning scheme at starting with Windows 8 maybe, using 2 partitions as described by Microsoft? -->
+ <CreatePartition>
+ <Order>1</Order>
+ <Type>Primary</Type>
+ <Extend>true</Extend>
+ </CreatePartition>
+ </CreatePartitions>
+@@VBOX_COND_END@@
+@@VBOX_COND_IS_FIRMWARE_UEFI@@
+ <CreatePartitions>
+ <CreatePartition wcm:action="add">
+ <Order>1</Order>
+ <Type>Primary</Type>
+ <Size>300</Size>
+ </CreatePartition>
+ <CreatePartition wcm:action="add">
+ <Order>2</Order>
+ <Type>EFI</Type>
+ <Size>100</Size>
+ </CreatePartition>
+ <CreatePartition wcm:action="add">
+ <Order>3</Order>
+ <Type>MSR</Type>
+ <Size>128</Size>
+ </CreatePartition>
+ <CreatePartition wcm:action="add">
+ <Order>4</Order>
+ <Type>Primary</Type>
+ <Extend>true</Extend>
+ </CreatePartition>
+ </CreatePartitions>
+ <ModifyPartitions>
+ <ModifyPartition wcm:action="add">
+ <Order>1</Order>
+ <PartitionID>1</PartitionID>
+ <Label>WINRE</Label>
+ <Format>NTFS</Format>
+ <TypeID>de94bba4-06d1-4d40-a16a-bfd50179d6ac</TypeID>
+ </ModifyPartition>
+ <ModifyPartition wcm:action="add">
+ <Order>2</Order>
+ <PartitionID>2</PartitionID>
+ <Label>EFI</Label>
+ <Format>FAT32</Format>
+ </ModifyPartition>
+ <ModifyPartition wcm:action="add">
+ <Order>3</Order>
+ <PartitionID>3</PartitionID>
+ </ModifyPartition>
+ <ModifyPartition wcm:action="add">
+ <Order>4</Order>
+ <PartitionID>4</PartitionID>
+ <Label>Windows</Label>
+ <Letter>C</Letter>
+ <Format>NTFS</Format>
+ </ModifyPartition>
+ </ModifyPartitions>
+@@VBOX_COND_END@@
+ </Disk>
+ </DiskConfiguration>
+
+ <UserData>
+ <ProductKey>
+@@VBOX_COND_HAS_PRODUCT_KEY@@
+ <Key>@@VBOX_INSERT_PRODUCT_KEY_ELEMENT@@</Key>
+@@VBOX_COND_END@@
+ <WillShowUI>OnError</WillShowUI>
+ </ProductKey>
+ <AcceptEula>true</AcceptEula>
+ </UserData>
+
+ <ImageInstall>
+ <OSImage>
+ <InstallFrom>
+ <!-- TODO: This stuff doesn't work for en_windows_vista_enterprise_sp1_x64_and_x86.iso ... -->
+ <MetaData wcm:action="add">
+ <Key>/IMAGE/INDEX</Key>
+ <Value>@@VBOX_INSERT_IMAGE_INDEX_ELEMENT@@</Value>
+ </MetaData>
+ <!-- <Path>d:\sources\install.wim</Path> - the w7 tests doesn't specify this -->
+ </InstallFrom>
+ <InstallTo>
+ <DiskID>0</DiskID>
+@@VBOX_COND_IS_NOT_FIRMWARE_UEFI@@
+ <PartitionID>1</PartitionID>
+@@VBOX_COND_END@@
+@@VBOX_COND_IS_FIRMWARE_UEFI@@
+ <PartitionID>4</PartitionID>
+@@VBOX_COND_END@@
+ </InstallTo>
+ <WillShowUI>OnError</WillShowUI>
+ <InstallToAvailablePartition>false</InstallToAvailablePartition>
+ </OSImage>
+ </ImageInstall>
+
+ <ComplianceCheck>
+ <DisplayReport>OnError</DisplayReport>
+ </ComplianceCheck>
+
+ <!-- Apply registry tweaks to Windows PE, skipping the checks in the Windows 11 setup program. This will not make it to the final install, and should do no harm with older Windows versions. -->
+ <RunAsynchronous>
+ <RunAsynchronousCommand>
+ <Order>1</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassCPUCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable CPU check</Description>
+ </RunAsynchronousCommand>
+ <RunAsynchronousCommand>
+ <Order>2</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable RAM check</Description>
+ </RunAsynchronousCommand>
+ <RunAsynchronousCommand>
+ <Order>3</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable Secure Boot check</Description>
+ </RunAsynchronousCommand>
+ <RunAsynchronousCommand>
+ <Order>4</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassStorageCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable Storage check</Description>
+ </RunAsynchronousCommand>
+ <RunAsynchronousCommand>
+ <Order>5</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable TPM check</Description>
+ </RunAsynchronousCommand>
+ </RunAsynchronous>
+
+ </component>
+ </settings>
+
+ <settings pass="specialize">
+ <component name="Microsoft-Windows-Shell-Setup"
+ processorArchitecture="@@VBOX_INSERT_OS_ARCH_ATTRIB_DQ@@"
+ publicKeyToken="31bf3856ad364e35" language="neutral"
+ versionScope="nonSxS">
+ <ComputerName>@@VBOX_INSERT_HOSTNAME_WITHOUT_DOMAIN_MAX_15@@</ComputerName>
+ </component>
+
+ <component name="Microsoft-Windows-Deployment"
+ processorArchitecture="@@VBOX_INSERT_OS_ARCH_ATTRIB_DQ@@"
+ publicKeyToken="31bf3856ad364e35" language="neutral"
+ versionScope="nonSxS">
+
+ <!-- Apply registry tweaks in the final Windows install, skipping the checks in the Windows 11 setup program. This means upgrades started in this install will work without compatibility complaints. -->
+ <RunAsynchronous>
+ <RunAsynchronousCommand>
+ <Order>1</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassCPUCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable CPU check</Description>
+ </RunAsynchronousCommand>
+ <RunAsynchronousCommand>
+ <Order>2</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable RAM check</Description>
+ </RunAsynchronousCommand>
+ <RunAsynchronousCommand>
+ <Order>3</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable Secure Boot check</Description>
+ </RunAsynchronousCommand>
+ <RunAsynchronousCommand>
+ <Order>4</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassStorageCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable Storage check</Description>
+ </RunAsynchronousCommand>
+ <RunAsynchronousCommand>
+ <Order>5</Order>
+ <Path>reg.exe ADD HKLM\SYSTEM\Setup\LabConfig /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
+ <Description>Windows 11 disable TPM check</Description>
+ </RunAsynchronousCommand>
+ </RunAsynchronous>
+ </component>
+ </settings>
+
+ <settings pass="oobeSystem">
+ <component name="Microsoft-Windows-Shell-Setup"
+ processorArchitecture="@@VBOX_INSERT_OS_ARCH_ATTRIB_DQ@@"
+ publicKeyToken="31bf3856ad364e35" language="neutral"
+ versionScope="nonSxS">
+ <AutoLogon>
+ <Password>
+ <Value>@@VBOX_INSERT_USER_PASSWORD_ELEMENT@@</Value>
+ <PlainText>true</PlainText>
+ </Password>
+ <Enabled>true</Enabled>
+ <Username>@@VBOX_INSERT_USER_LOGIN_ELEMENT@@</Username>
+ </AutoLogon>
+
+ <UserAccounts>
+@@VBOX_COND_IS_USER_LOGIN_NOT_ADMINISTRATOR@@
+ <AdministratorPassword>
+ <Value>@@VBOX_INSERT_ROOT_PASSWORD_ELEMENT@@</Value>
+ <PlainText>true</PlainText>
+ </AdministratorPassword>
+
+ <LocalAccounts>
+ <LocalAccount wcm:action="add">
+ <Name>@@VBOX_INSERT_USER_LOGIN_ELEMENT@@</Name>
+ <DisplayName>@@VBOX_INSERT_USER_FULL_NAME_ELEMENT@@</DisplayName>
+ <Group>administrators;users</Group>
+ <Password>
+ <Value>@@VBOX_INSERT_USER_PASSWORD_ELEMENT@@</Value>
+ <PlainText>true</PlainText>
+ </Password>
+ </LocalAccount>
+ </LocalAccounts>
+@@VBOX_COND_END@@
+@@VBOX_COND_IS_USER_LOGIN_ADMINISTRATOR@@
+ <AdministratorPassword>
+ <Value>@@VBOX_INSERT_USER_PASSWORD_ELEMENT@@</Value>
+ <PlainText>true</PlainText>
+ </AdministratorPassword>
+@@VBOX_COND_END@@
+ </UserAccounts>
+
+ <VisualEffects>
+ <FontSmoothing>ClearType</FontSmoothing>
+ </VisualEffects>
+
+ <OOBE>
+ <ProtectYourPC>3</ProtectYourPC>
+ <HideEULAPage>true</HideEULAPage>
+ <SkipUserOOBE>true</SkipUserOOBE>
+ <SkipMachineOOBE>true</SkipMachineOOBE>
+ <!-- Make this (NetworkLocation) default to public and make it configurable -->
+ <NetworkLocation>Home</NetworkLocation>
+ </OOBE>
+
+ <FirstLogonCommands>
+ <SynchronousCommand wcm:action="add">
+ <!-- For which OS versions do we need to do this? -->
+ <Order>1</Order>
+ <Description>Turn Off Network Selection pop-up</Description>
+ <CommandLine>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine>
+ </SynchronousCommand>
+ <SynchronousCommand wcm:action="add">
+ <Order>2</Order>
+ <Description>VirtualBox post guest install steps </Description>
+ <CommandLine>cmd.exe /c @@VBOX_INSERT_AUXILIARY_INSTALL_DIR@@VBOXPOST.CMD --vista-or-newer</CommandLine>
+ </SynchronousCommand>
+ </FirstLogonCommands>
+
+ <TimeZone>@@VBOX_INSERT_TIME_ZONE_WIN_NAME@@</TimeZone>
+ </component>
+
+ </settings>
+</unattend>
+
diff --git a/src/VBox/Main/UnattendedTemplates/win_postinstall.cmd b/src/VBox/Main/UnattendedTemplates/win_postinstall.cmd
new file mode 100644
index 00000000..3f291827
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/win_postinstall.cmd
@@ -0,0 +1,164 @@
+@echo off
+rem $Id: win_postinstall.cmd $
+rem rem @file
+rem Post installation script template for Windows.
+rem
+rem This runs after the target system has been booted, typically as
+rem part of the first logon.
+rem
+
+rem
+rem Copyright (C) 2017-2023 Oracle and/or its affiliates.
+rem
+rem This file is part of VirtualBox base platform packages, as
+rem available from https://www.virtualbox.org.
+rem
+rem This program is free software; you can redistribute it and/or
+rem modify it under the terms of the GNU General Public License
+rem as published by the Free Software Foundation, in version 3 of the
+rem License.
+rem
+rem This program is distributed in the hope that it will be useful, but
+rem WITHOUT ANY WARRANTY; without even the implied warranty of
+rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+rem General Public License for more details.
+rem
+rem You should have received a copy of the GNU General Public License
+rem along with this program; if not, see <https://www.gnu.org/licenses>.
+rem
+rem SPDX-License-Identifier: GPL-3.0-only
+rem
+
+rem Globals.
+set MY_LOG_FILE=C:\vboxpostinstall.log
+
+rem Log header.
+echo *** started >> %MY_LOG_FILE%
+echo *** CD=%CD% >> %MY_LOG_FILE%
+echo *** Environment BEGIN >> %MY_LOG_FILE%
+set >> %MY_LOG_FILE%
+echo *** Environment END >> %MY_LOG_FILE%
+
+@@VBOX_COND_HAS_PROXY@@
+set PROXY=@@VBOX_INSERT_PROXY@@
+set HTTP_PROXY=%PROXY%
+set HTTPS_PROXY=%PROXY%
+echo HTTP proxy is %HTTP_PROXY% >> %MY_LOG_FILE%
+echo HTTPS proxy is %HTTPS_PROXY% >> %MY_LOG_FILE%
+@@VBOX_COND_END@@
+
+@@VBOX_COND_IS_INSTALLING_ADDITIONS@@
+rem
+rem Install the guest additions.
+rem
+
+rem First find the CDROM with the GAs on them.
+set MY_VBOX_ADDITIONS=E:\vboxadditions
+if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
+set MY_VBOX_ADDITIONS=D:\vboxadditions
+if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
+set MY_VBOX_ADDITIONS=F:\vboxadditions
+if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
+set MY_VBOX_ADDITIONS=G:\vboxadditions
+if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
+set MY_VBOX_ADDITIONS=E:
+if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
+set MY_VBOX_ADDITIONS=F:
+if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
+set MY_VBOX_ADDITIONS=G:
+if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
+set MY_VBOX_ADDITIONS=D:
+if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
+set MY_VBOX_ADDITIONS=E:\vboxadditions
+:found_vbox_additions
+echo *** MY_VBOX_ADDITIONS=%MY_VBOX_ADDITIONS%\ >> %MY_LOG_FILE%
+
+rem Then add signing certificate to trusted publishers
+echo *** Running: %MY_VBOX_ADDITIONS%\cert\VBoxCertUtil.exe ... >> %MY_LOG_FILE%
+%MY_VBOX_ADDITIONS%\cert\VBoxCertUtil.exe add-trusted-publisher %MY_VBOX_ADDITIONS%\cert\vbox*.cer --root %MY_VBOX_ADDITIONS%\cert\vbox*.cer >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+rem Then do the installation.
+echo *** Running: %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe /S >> %MY_LOG_FILE%
+%MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe /S
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+@@VBOX_COND_END@@
+
+
+@@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
+rem
+rem Install the Test Execution service
+rem
+
+rem First find the CDROM with the validation kit on it.
+set MY_VBOX_VALIDATION_KIT=E:\vboxvalidationkit
+if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
+set MY_VBOX_VALIDATION_KIT=D:\vboxvalidationkit
+if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
+set MY_VBOX_VALIDATION_KIT=F:\vboxvalidationkit
+if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
+set MY_VBOX_VALIDATION_KIT=G:\vboxvalidationkit
+if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
+set MY_VBOX_VALIDATION_KIT=E:
+if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
+set MY_VBOX_VALIDATION_KIT=F:
+if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
+set MY_VBOX_VALIDATION_KIT=G:
+if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
+set MY_VBOX_VALIDATION_KIT=D:
+if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
+set MY_VBOX_VALIDATION_KIT=E:\vboxvalidationkit
+:found_vbox_validation_kit
+echo *** MY_VBOX_VALIDATION_KIT=%MY_VBOX_VALIDATION_KIT%\ >> %MY_LOG_FILE%
+
+rem Copy over the files.
+echo *** Running: mkdir %SystemDrive%\Apps >> %MY_LOG_FILE%
+mkdir %SystemDrive%\Apps >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+echo *** Running: copy %MY_VBOX_VALIDATION_KIT%\win\* %SystemDrive%\Apps >> %MY_LOG_FILE%
+copy %MY_VBOX_VALIDATION_KIT%\win\* %SystemDrive%\Apps >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+echo *** Running: copy %MY_VBOX_VALIDATION_KIT%\win\%PROCESSOR_ARCHITECTURE%\* %SystemDrive%\Apps >> %MY_LOG_FILE%
+copy %MY_VBOX_VALIDATION_KIT%\win\%PROCESSOR_ARCHITECTURE%\* %SystemDrive%\Apps >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+rem Configure the firewall to allow TXS to listen.
+echo *** Running: netsh firewall add portopening TCP 5048 "TestExecService 5048" >> %MY_LOG_FILE%
+netsh firewall add portopening TCP 5048 "TestExecService 5048" >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+echo *** Running: netsh firewall add portopening TCP 5042 "TestExecService 5042" >> %MY_LOG_FILE%
+netsh firewall add portopening TCP 5042 "TestExecService 5042" >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+rem Update the registry to autorun the service and make sure we've got autologon.
+echo *** Running: reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v NTConfiguration /d %SystemDrive%\Apps\vboxtxs.cmd /f >> %MY_LOG_FILE%
+reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v NTConfiguration /d %SystemDrive%\Apps\vboxtxs.cmd /f >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+echo *** Running: reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v PowerdownAfterShutdown /d 1 /f >> %MY_LOG_FILE%
+reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v PowerdownAfterShutdown /d 1 /f >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+
+echo *** Running: reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v ForceAutoLogon /d 1 /f >> %MY_LOG_FILE%
+reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v ForceAutoLogon /d 1 /f >> %MY_LOG_FILE% 2>&1
+echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
+rem AutoAdminLogon too if administrator?
+
+@@VBOX_COND_END@@
+
+
+@@VBOX_COND_HAS_POST_INSTALL_COMMAND@@
+rem
+rem Run user command.
+rem
+echo *** Running custom user command ... >> %MY_LOG_FILE%
+echo *** Running: "@@VBOX_INSERT_POST_INSTALL_COMMAND@@" >> %MY_LOG_FILE%
+@@VBOX_INSERT_POST_INSTALL_COMMAND@@
+@@VBOX_COND_END@@
+
+echo *** done >> %MY_LOG_FILE%
+