#!/bin/sh
#
#
#
if [ -n "$DISPLAY" ]
then
    CURSES=""
else
    CURSES="-curses"
fi

if [ "$EUID" = "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
  #
  qemu $CURSES \
    -hda disk.hda \
    -net nic,macaddr=b0:c4:20:00:00:00,model=ne2k_pci \
    -net tap,ifname=tap0,script=./tap0 \
    -boot c
else
  echo "[$0] Qemu avviato senza privilegi: non"
  echo "[$0] funziona la rete!"
  echo "[$0] Premi Invio per continuare"
  read

  qemu $CURSES \
    -hda disk.hda \
    -net nic,macaddr=b0:c4:20:00:00:00,model=ne2k_pci \
    -net user,net=172.21.0.0/16,host=172.21.254.254,\
restrict=n \
    -boot c
fi

