#!/bin/bash

# fix the path in case somebody mounts the administrative share
# cut from 3rd char on 
# replace / with _ 
# replace $ with _
# replace trailing _ with _root

MOUNT_POINT=~/`echo "$1" | cut -c3- | tr "/" "_" | tr "$" "_" | sed s/_$/_root/g`

# make sure this share isn't already mounted
if mount | grep -q $1
then
	echo $1 is already mounted
	exit 1
fi

mkdir -p $MOUNT_POINT

echo -n username: 
read USERNAME

echo -n password: 
read PASSWORD

smbmount $1 $MOUNT_POINT -o username=$USERNAME,password=$PASSWORD,uid=$UID

exit 0
