[BACK]Return to manage_pre CVS log [TXT][DIR] Up to [local] / palm / manage_pre

Diff for /palm/manage_pre/manage_pre between version 1.7 and 1.8

version 1.7, 2009/11/25 21:27:15 version 1.8, 2010/03/10 19:35:40
Line 1 
Line 1 
 #!/bin/sh  #!/bin/sh
 # $Id$  # $AFresh1$
   
   # Copyright (c) 2010 Andrew Fresh <andrew@afresh1.com>
   #
   # Permission to use, copy, modify, and distribute this software for any
   # purpose with or without fee is hereby granted, provided that the above
   # copyright notice and this permission notice appear in all copies.
   #
   # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   
 local _pre_id='Palm, Pre, 0000'  local _pre_id='Palm, Pre, 0000'
 #local _pre_label='Pre'  local _mount_point='/mnt/pre'
 #local _ipod_label='iPod'  local _unison_config='palm_pre'
 local _mount_dir='/mnt/pre'  
 local _name=`basename $0`  
 local _unison_config='vogonpa'  
   
 local _action="$*"  
 case "$_name" in  
     eject_pre)  
         _action=eject  
         ;;  
     sync_pre)  
         _action=sync  
         ;;  
     mount_pre)  
         _action=mount  
         ;;  
 esac  
   
 if [ -z "$_action" ]; then  
     echo "manage_pre mount|sync|eject"  
     exit 255  
 fi  
   
 find_pre() {  find_pre() {
     local _dev=`dmesg | grep 'Palm, Pre' | tail -1 | cut -d' ' -f 1`      local _dev=`dmesg | grep 'Palm, Pre' | tail -1 | cut -d' ' -f 1`
     if [ X"$_dev" == X"" ]; then      if [ X"$_dev" == X"" ]; then
Line 55 
Line 48 
         echo Not mounted          echo Not mounted
     fi      fi
     $SUDO /bin/eject  $_dev 2> /dev/null && echo Ejected Pre      $SUDO /bin/eject  $_dev 2> /dev/null && echo Ejected Pre
     $SUDO rmdir $_mount_dir 2> /dev/null      $SUDO rmdir $_mount_point 2> /dev/null
 }  }
   
 mount() {  mount() {
Line 64 
Line 57 
         echo Already mounted: ${_mounted%% type*}          echo Already mounted: ${_mounted%% type*}
         return          return
     fi      fi
     $SUDO mkdir -p $_mount_dir      $SUDO mkdir -p $_mount_point
     $SUDO chgrp users $_mount_dir      $SUDO chgrp users $_mount_point
     $SUDO chmod g+w   $_mount_dir      $SUDO chmod g+w   $_mount_point
     $SUDO /sbin/mount $_dev $_mount_dir && echo Mounted Pre on $_mount_dir      $SUDO /sbin/mount $_dev $_mount_point && echo Mounted Pre on $_mount_point
 }  }
   
 synchronize() {  synchronize() {
Line 81 
Line 74 
     echo Synchronizing Pre      echo Synchronizing Pre
   
     #if [ -e /usr/local/bin/rsync ]; then      #if [ -e /usr/local/bin/rsync ]; then
         #rsync -rv --delete --size-only --exclude '*.pid' \      #   rsync -rv --delete --size-only --exclude '*.pid'
             #.backgrounds/vogonpa/ /mnt/pre/wallpapers_mine/  
     #fi      #fi
   
     if [ -e /usr/local/bin/unison ]; then      if [ -e /usr/local/bin/unison ]; then
Line 93 
Line 85 
         eject          eject
     fi      fi
 }  }
   
   local _action="$*"
   local _name=`basename $0`
   case "$_name" in
       eject_pre)
           _action=eject
           ;;
       sync_pre)
           _action=sync
           ;;
       mount_pre)
           _action=mount
           ;;
   esac
   
   if [ -z "$_action" ]; then
       echo "manage_pre mount|sync|eject"
       exit 255
   fi
   
 local _dev=`find_pre`  local _dev=`find_pre`
 if [ X"${_dev}" == X"" -o ! -e $_dev ]; then  if [ X"${_dev}" == X"" -o ! -e $_dev ]; then

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>