#!/bin/sh
# url: http://pank.org/scripts/
# description: mount or umount iso image (ln -s mountiso.sh umountiso.sh)
# comment: csh bash
# platform: freebsd, linux

if [ -z $1 ] ; then
    echo "Usage: `basename $0` {iso image} {node}"
else
    case $HOSTTYPE in
        FreeBSD)
            DEVICE=/dev/vn0a
            if echo $0 | grep -q umount ; then
            	umount $1
                vnconfig -u $DEVICE
            else
                vnconfig $DEVICE $1 
                mount -t cd9660 $DEVICE $2
            fi
            ;;
        Linux)
            if echo $0 | grep -q umount ; then
                umount $1
            else
                mount -t iso9660 -o loop $1 $2
            fi
            ;;
    esac
fi