#!/bin/bash # Author: Michael Styer # Date written: 6 February 2005 if [ ! -x "/usr/bin/lufis" ] then echo "/usr/bin/lufis does not exist; unable to mount ftpfs. Exiting." exit 1 else lufis="/usr/bin/lufis" fi TEMP=`getopt -o qao:u:p:e: -l quiet,anon,options:,username:,password:,email: -n 'mount.ftpfs' -- "$@"` if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1; fi eval set -- "$TEMP" while true ; do case "$1" in -q|--quiet) quiet=1 ; shift ;; -a|--anon) anon=1 ; shift ;; -o|--options) mnt_opts=$2 ; shift 2 ;; -u|--username) username=$2 ; shift 2 ;; -p|--password) password=$2 ; shift 2 ;; -e|--email) email=$2 ; shift 2 ;; --) shift ; break ;; *) echo "Error parsing options!" ; exit 1; esac done if [ "x$1" != "x" ] ; then host=$1 ; else echo "Need a host name." ; exit 1; fi if [ "x$2" != "x" ] ; then mnt_point=$2 ; else echo "Need a mount point." ; exit 1; fi lufis_opts="fs=ftpfs,host=$host"; if [ $quiet > 0 ] ; then lufis_opts="$lufis_opts,quiet" fi if [ $anon > 0 ] then if [ "x$email" == "x" ] then read -p "Enter email address for anonymous login: " email fi lufis_opts="$lufis_opts,username=anonymous,password=$email" else if [ "x$username" == "x" ] then read -p "Username: " username read -s -p "Password: " password elif [ "x$password" == "x" ] then read -s -p "Password: " password fi lufis_opts="$lufis_opts,username=$username,password=$password" fi if [ "x$options" != "x" ] then lufis_opts="$lufis_opts,$options" fi $lufis $lufis_opts $mnt_point -s