diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..74afd25 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.inf eol=crlf diff --git a/Dockerfile.m4 b/Dockerfile.m4 index ca5d300..7532f41 100644 --- a/Dockerfile.m4 +++ b/Dockerfile.m4 @@ -12,7 +12,10 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ - unzip \ + genisoimage \ + p7zip-full \ + qemu-system-x86 \ + qemu-utils \ && rm -rf /var/lib/apt/lists/* # Download noVNC @@ -36,7 +39,18 @@ ARG REACTOS_ISO_URL=https://downloads.sourceforge.net/project/reactos/ReactOS/0. ARG REACTOS_ISO_CHECKSUM=ec2776422ed45f8ee7488030eadd7ea40b4276cee04c5e5e5a3f1a5a68c978a7 RUN curl -Lo /tmp/reactos.zip "${REACTOS_ISO_URL:?}" RUN printf '%s' "${REACTOS_ISO_CHECKSUM:?} /tmp/reactos.zip" | sha256sum -c -RUN unzip -p /tmp/reactos.zip 'ReactOS-*.iso' > /tmp/reactos.iso +RUN 7z e /tmp/reactos.zip -so '*.iso' > /tmp/reactos.iso \ + && 7z x /tmp/reactos.iso -o/tmp/reactos/ \ + && rm -f /tmp/reactos.iso +COPY --chown=root:root ./data/iso/ /tmp/reactos/ +RUN mkisofs -no-emul-boot -iso-level 4 -eltorito-boot loader/isoboot.bin -o /tmp/reactos.iso /tmp/reactos/ \ + && qemu-img create -f qcow2 /tmp/reactos.qcow2 124G \ + && timeout 900 qemu-system-x86_64 \ + -accel tcg -smp 2 -m 512 -serial stdio -display none \ + -drive file=/tmp/reactos.qcow2,index=0,media=disk,format=qcow2 \ + -drive file=/tmp/reactos.iso,index=2,media=cdrom,format=raw \ + -boot order=cd,menu=off \ + -netdev user,id=n0 -device e1000,netdev=n0 ################################################## ## "main" stage @@ -63,24 +77,19 @@ RUN export DEBIAN_FRONTEND=noninteractive \ # Environment ENV VM_CPU=2 ENV VM_RAM=1024M -ENV VM_DISK_SIZE=16G ENV VM_KEYBOARD=en-us ENV VM_NET_OPTIONS=hostfwd=tcp::13389-:3389,hostfwd=tcp::15900-:5900 -ENV VM_BOOT_ORDER=cd ENV VM_KVM=true ENV SVDIR=/etc/service/ -# Create some directories for QEMU -RUN mkdir -p /var/lib/qemu/iso/ /var/lib/qemu/images/ - # Copy noVNC COPY --from=build --chown=root:root /tmp/novnc/ /opt/novnc/ # Copy Websockify COPY --from=build --chown=root:root /tmp/websockify/ /opt/novnc/utils/websockify/ -# Copy ReactOS ISO -COPY --from=build --chown=root:root /tmp/reactos.iso /var/lib/qemu/iso/reactos.iso +# Copy ReactOS disk +COPY --from=build --chown=root:root /tmp/reactos.qcow2 /var/lib/qemu/reactos.qcow2 # Copy services COPY --chown=root:root ./scripts/service/ /etc/service/ diff --git a/README.md b/README.md index 38ebec9..bb0ed6f 100644 --- a/README.md +++ b/README.md @@ -23,15 +23,9 @@ Number of cores the VM is permitted to use (`2` by default). #### `VM_RAM` Amount of memory the VM is permitted to use (`1024M` by default). -#### `VM_DISK_SIZE` -VM disk size (`16G` by default). - #### `VM_KEYBOARD` VM keyboard layout (`en-us` by default). -#### `VM_BOOT_ORDER` -VM boot order (`cd` by default). - #### `VM_KVM` Start QEMU in KVM mode (`true` by default). > The `--device /dev/kvm` option is required for this variable to take effect. diff --git a/data/iso/reactos/unattend.inf b/data/iso/reactos/unattend.inf new file mode 100644 index 0000000..cf6ef5d --- /dev/null +++ b/data/iso/reactos/unattend.inf @@ -0,0 +1,46 @@ +[Unattend] +Signature = "$ReactOS$" + +UnattendSetupEnabled = yes + +DestinationDiskNumber = 0 +DestinationPartitionNumber = 1 +InstallationDirectory = ReactOS +AutoPartition = 1 +FormatPartition = 1 +; 0: FAT +; 1: BtrFS +FsType = 0 +; 0: Skips MBR installation +; 1: Install MBR on floppy +; 2: Install MBR on hdd +MBRInstallType = 2 + +FullName = "Owner" +OrgName = "Org" +ComputerName = "REACTOS" +; AdminPassword = "password" + +; TimeZoneIndex lists: +; https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms912053(v=winembedded.10) +TimeZoneIndex = 85 +DisableAutoDaylightTimeSet = 1 + +; LocaleID lists: +; https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c +LocaleID = 409 + +; 0: ReactOS Server +; 1: ReactOS Workstation +ProductOption = 0 + +DisableGeckoInst = no + +[GuiRunOnce] +%SystemRoot%\system32\shutdown.exe /s /t 5 + +[Display] +BitsPerPel = 32 +XResolution = 1440 +YResolution = 900 +VRefresh = 0 diff --git a/scripts/bin/container-init b/scripts/bin/container-init index d1ef86f..cc67cc2 100755 --- a/scripts/bin/container-init +++ b/scripts/bin/container-init @@ -2,11 +2,6 @@ set -eu -# Create ReactOS disk -if [ ! -f /var/lib/qemu/images/reactos.img ]; then - qemu-img create -f qcow2 /var/lib/qemu/images/reactos.img "${VM_DISK_SIZE:?}" -fi - stop() { for s in "${SVDIR:?}"/*; do sv force-stop "${s:?}" >/dev/null 2>&1; done kill -HUP "${RUNSVDIRPID:?}"; wait "${RUNSVDIRPID:?}" diff --git a/scripts/service/qemu/run b/scripts/service/qemu/run index d1cb0a0..71dcdcd 100755 --- a/scripts/service/qemu/run +++ b/scripts/service/qemu/run @@ -5,10 +5,8 @@ set -eu set -- set -- "$@" -smp "${VM_CPU:?}" -m "${VM_RAM:?}" set -- "$@" -serial stdio -monitor unix:/run/qemu-monitor,server,nowait -device VGA -display vnc=:0 -set -- "$@" -drive file=/var/lib/qemu/images/reactos.img,index=0,media=disk,format=qcow2 -set -- "$@" -drive file=/var/lib/qemu/iso/reactos.iso,index=2,media=cdrom,format=raw -set -- "$@" -boot order="${VM_BOOT_ORDER:?}",menu=off -set -- "$@" -netdev user,id=n0,"${VM_NET_OPTIONS:?}" +set -- "$@" -drive file=/var/lib/qemu/reactos.qcow2,index=0,media=disk,format=qcow2 +set -- "$@" -netdev user,id=n0,"${VM_NET_OPTIONS?}" set -- "$@" -device e1000,netdev=n0 set -- "$@" -usb -device usb-tablet set -- "$@" -k "${VM_KEYBOARD:?}"