#!/bin/sh

file=$1

if [ -e /tmp/dvd ]; then
  rm -f /tmp/dvd
fi

if [ -n "$file" -a -e "$file" ]; then
  path=`echo $file | sed 's,[^/]*$,,'`
else
  path=/dev/dvd
fi

ln -s -f "$path" /tmp/dvd

if [ -e /var/dvdnav ]; then
  echo "loadfile dvdnav:////tmp/dvd" > /var/mp_control
else
  echo "loadfile dvd://1//tmp/dvd" > /var/mp_control
fi
