=================================================================== RCS file: /cvs/palm/manage_pre/manage_pre,v retrieving revision 1.4 retrieving revision 1.7 diff -u -r1.4 -r1.7 --- palm/manage_pre/manage_pre 2009/08/20 22:40:49 1.4 +++ palm/manage_pre/manage_pre 2009/11/25 21:27:15 1.7 @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: manage_pre,v 1.4 2009/08/20 21:40:49 andrew Exp $ +# $Id: manage_pre,v 1.7 2009/11/25 21:27:15 andrew Exp $ -local _pre_id='Palm, Pre, 0316' +local _pre_id='Palm, Pre, 0000' #local _pre_label='Pre' #local _ipod_label='iPod' local _mount_dir='/mnt/pre' @@ -29,14 +29,14 @@ find_pre() { local _dev=`dmesg | grep 'Palm, Pre' | tail -1 | cut -d' ' -f 1` if [ X"$_dev" == X"" ]; then - echo Pre not found! >&2 - exit 1 + echo Pre not found! >&2 + exit 1 fi local _id=`dmesg | grep "^$_dev at " | tail -1 | sed -e 's/.*.*$//'` if [ X"$_id" != X"$_pre_id" ]; then - echo "Pre [$_dev] not correct id [$_id]" >&2 - exit 2 + echo "Pre [$_dev] not correct id [$_id]" >&2 + exit 2 fi echo /dev/${_dev}i @@ -65,16 +65,17 @@ return fi $SUDO mkdir -p $_mount_dir - $SUDO chgrp users $_mount_dir - $SUDO chmod g+w $_mount_dir + $SUDO chgrp users $_mount_dir + $SUDO chmod g+w $_mount_dir $SUDO /sbin/mount $_dev $_mount_dir && echo Mounted Pre on $_mount_dir } synchronize() { local _mounted=`is_mounted $_dev` + local _did_mount="" if [ X"" == X"$_mounted" ]; then - echo Not mounted - return 1 + mount || exit 255 + _did_mount=1 fi echo Synchronizing Pre @@ -86,6 +87,10 @@ if [ -e /usr/local/bin/unison ]; then /usr/local/bin/unison $_unison_config -auto -batch -ui text + fi + + if [ ! -z "$_did_mount" ]; then + eject fi }