#!/bin/sh

if [ "$UID" = 0 ]
then
  #   172.21.11.18                      172.21.11.16
  #  >-----------point to point -----> >-------os32
  #   tap0 (linux)                      net1
  #
  # Dal lato Linux:
  #   ifconfig tap0 172.21.11.18 pointopoint \
  #            172.21.11.16 netmask 255.255.255.255
  #   route add -host 172.21.11.16 gw 172.21.11.18
  #
  # Dalla macchina 172.21.254.254:
  #   route add -host 172.21.11.16 gw 172.21.11.18
  #
  bochs -q \
    "boot: disk" \
    "ata0-master: type=disk, path=disk.hda" \
    "keyboard_mapping: enabled=1, \
       map=/usr/share/bochs/keymaps/x11-pc-it.map" \
    "keyboard_type: mf" \
    "vga: none" \
    "ne2k: mac=b0:c4:20:00:00:00, ioaddr=0x300, \
           irq=9, ethmod=tuntap, ethdev=/dev/net/tun, \
           script=./tap0" \
    "i440fxsupport: enabled=1, slot1=pcivga, \
                   slot2=ne2k" \
    "romimage: \
      file=\"/usr/share/bochs/BIOS-bochs-legacy\"" \
    "megs:128"
else
  bochs -q \
    "boot: disk" \
    "ata0-master: type=disk, path=disk.hda" \
    "keyboard_mapping: enabled=1, \
       map=/usr/share/bochs/keymaps/x11-pc-it.map" \
    "keyboard_type: mf" \
    "vga: none" \
    "ne2k: mac=b0:c4:20:00:00:00, ioaddr=0x300, \
           irq=9, ethmod=null" \
    "i440fxsupport: enabled=1, slot1=pcivga, \
                    slot2=ne2k" \
    "romimage: \
      file=\"/usr/share/bochs/BIOS-bochs-legacy\"" \
    "megs:128"
fi
