Created
May 11, 2010 09:08
-
-
Save animist/397097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sshfs_cmd='/opt/local/bin/sshfs' | |
vol_dir='/Volumes/' | |
#fuse_dirname='fuse_mp' | |
while getopts p:s:t: OPT | |
do | |
case $OPT in | |
"p" ) port="-p $OPTARG" ;; | |
"s" ) short_name="$OPTARG" ;; | |
"t" ) target="$OPTARG" ;; | |
esac | |
done | |
tgt_dir=${vol_dir}${short_name} | |
# TODO: mount されていない fuse_mp* は消す | |
# TODO: 最大の番号+1になるように変更 | |
#fuse_dircount=`ls -1 ${vol_dir} | grep fuse_mp | wc -l | sed 's/ //g'` | |
#echo "mounting to " ${vol_dir}${fuse_dirname}${fuse_dircount} | |
if [ -d ${tgt_dir} ] | |
then | |
echo ${tgt_dir} "is already exist." | |
exit | |
fi | |
echo "mounting to :" ${tgt_dir} | |
#if [ ! $short_name ] | |
#then | |
# short_name=${target} | |
#fi | |
mkdir ${tgt_dir} | |
echo ${sshfs_cmd} ${target} ${tgt_dir} -oauto_cache,reconnect,volname=${short_name} ${port} | |
${sshfs_cmd} ${target} ${tgt_dir} -oauto_cache,reconnect,volname=${short_name} ${port} | |
if [ $? -ne 0 -a -d ${tgt_dir} ] | |
then | |
rmdir ${tgt_dir} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment