#!/bin/bash

# Start QEMU with built-in SMB share
qemu-system-i386 \
  -enable-kvm \
  -m 3584 \
  -cpu host \
  -machine pc,accel=kvm \
  -vga vmware \
  -global vmware-svga.vgamem_mb=1024 \
  -device AC97 \
  -drive file=hp-mini_32-bit-color_tonescape.img,format=raw,if=ide \
  -usb -device usb-tablet \
  -rtc base=localtime \
  -netdev user,id=net0,smb=/home/monz/Desktop \
  -device rtl8139,netdev=net0 \
  -display gtk &

# Wait for QEMU to generate the smb.conf
sleep 2

# Patch the generated smb.conf to support Windows XP (SMB1)
sudo sed -i '/\[global\]/a server min protocol = NT1\nlanman auth = yes\nntlm auth = yes' /tmp/qemu-smb.*/smb.conf

# Wait for QEMU to finish
wait   
