Discussion:
unknown
1970-01-01 00:00:00 UTC
Permalink
License
-------
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/Makefile.am synce-serial-0.9.1-sg/script/Makefile.am
--- synce-0.9.1/synce-serial-0.9.1/script/Makefile.am 2002-11-20 03:39:18.000000000 -0500
+++ synce-serial-0.9.1-sg/script/Makefile.am 2006-11-13 15:47:30.000000000 -0500
@@ -1,8 +1,6 @@
# $Id: Makefile.am,v 1.2 2002/11/20 08:39:18 twogood Exp $

syncedatadir = $(datadir)/synce
-syncedata_DATA = synce-serial-common
-
-bin_SCRIPTS = synce-serial-config synce-serial-start synce-serial-abort
-
+syncedata_DATA = synce-serial-common synce-udev.rules synce.usermap

+bin_SCRIPTS = synce-serial-config synce-serial-start synce-serial-abort synce-serial-start-device synce-serial-abort-device synce-serial-udev-add synce-serial-udev-remove synce-serial-hotplug
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-abort-device.in synce-serial-0.9.1-sg/script/synce-serial-abort-device.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-abort-device.in 1969-12-31 19:00:00.000000000 -0500
+++ synce-serial-0.9.1-sg/script/synce-serial-abort-device.in 2006-11-13 14:52:34.000000000 -0500
@@ -0,0 +1,52 @@
+#!/bin/sh -e
+
+THIS=`basename $0`
+
+# include common stuff
+. @SHARED_SYNCE@/synce-serial-common
+if [ -n "$1" ]
+then
+ SYNCE_DEVNAME="$1"
+elif [ -z "$SYNCE_DEVNAME" ]
+then
+ SYNCE_DEVNAME="synce-device"
+fi
+
+exit_if_not_root
+
+if [ -z "$INFO" ]; then INFO=echo; fi
+
+PIDFILE="$VAR_PPP/ppp-$SYNCE_DEVNAME.pid"
+
+if ! [ -f "$PIDFILE" ]; then
+ echo "
+${THIS} was unable find a running SynCE connection. Will do nothing.
+" >&2
+ exit 0
+fi
+
+while [ -f "$PIDFILE" ]; do
+ PID="`head -1 $VAR_PPP/ppp-$SYNCE_DEVNAME.pid`"
+
+ if [ -z "${PID}" ]; then
+ echo "
+${THIS} found invalid PID in ppp-$SYNCE_DEVNAME; giving up.
+" >&2
+ exit 1
+ fi
+
+ ${INFO} "Killing process with PID ${PID}"
+
+ if kill ${PID}; then
+ echo "
+${THIS} has requested shutdown of $SYNCE_DEVNAME.
+"
+ else
+ echo "
+${THIS} was unable stop the SynCE connection with PID ${PID}.
+" >&2
+ exit 1
+ fi
+ sleep 3
+done
+
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-abort.in synce-serial-0.9.1-sg/script/synce-serial-abort.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-abort.in 2005-07-08 15:04:42.000000000 -0400
+++ synce-serial-0.9.1-sg/script/synce-serial-abort.in 2006-11-13 14:51:47.000000000 -0500
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e

THIS=`basename $0`

@@ -7,26 +7,20 @@

exit_if_not_root

-get_pid
-
-if [ -z "${PID}" ]; then
- echo "
-${THIS} was unable find a running SynCE connection. Will do nothing.
-"
- exit 0
-fi

-${INFO} "Killing process with PID ${PID}"
-
-if kill ${PID}; then
- echo "
-${THIS} has requested shutdown of the current connection.
-"
+if [ $# -gt 0 ]; then
+ synce_cmdline_setup "$@"
+elif [ -e ${CONFIG_FILE} ]; then
+ . $CONFIG_FILE
else
- echo "
-${THIS} was unable stop the SynCE connection with PID ${PID}.
+ echo "
+${THIS} was unable to find the file ${CONFIG_FILE}:
+
+Please run the synce-serial-config tool to create this file before running this
+script again.
" >&2
- exit 1
+ exit 1
fi
-
+get_pid

+exec @BINDIR@/synce-serial-abort-device
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-common.in synce-serial-0.9.1-sg/script/synce-serial-common.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-common.in 2005-07-08 15:04:42.000000000 -0400
+++ synce-serial-0.9.1-sg/script/synce-serial-common.in 2006-11-13 13:38:05.000000000 -0500
@@ -5,7 +5,8 @@
# Common functions and declarations for the synce-serial scripts
#

-LOGGER="logger -t ${THIS}"
+export PATH="@BINDIR@:$PATH"
+LOGGER="logger -t ${THIS}[$$]"
FACILITY=user
ERROR="${LOGGER} -p ${FACILITY}.err"
WARNING="${LOGGER} -p ${FACILITY}.warning"
@@ -13,19 +14,27 @@
INFO="${LOGGER} -p ${FACILITY}.info"
DEBUG="${LOGGER} -p ${FACILITY}.debug"

+SYSFS="/sys"
PPP_OPTIONS=/etc/ppp/options
PPP_PEERS=/etc/ppp/peers
PPPD=/usr/sbin/pppd
+VAR_PPP=/var/run

-PEER=synce-device
+DEVICE_PREFIX=synce-device
+PEER=$DEVICE_PREFIX
PEER_FILE=${PPP_PEERS}/${PEER}

+CONFIG_FILE=@ETC_SYNCE@/synce.default
+
COMMAND="${PPPD} call ${PEER}"

# see the "linkname" option in the man page for pppd
-PID_FILE=/var/run/ppp-synce-device.pid
+PID_FILE=/var/run/ppp-$PEER.pid

-DEFAULT_IPS=192.168.131.102:192.168.131.201
+DEFAULT_NETWORK=192.168.131
+DEFAULT_LOCAL_IP=$DEFAULT_NETWORK.102
+DEFAULT_REMOTE_IP=$DEFAULT_NETWORK.201
+DEFAULT_IPS=$DEFAULT_LOCAL_IP:$DEFAULT_REMOTE_IP

exit_if_not_root()
{
@@ -55,3 +64,85 @@

}

+synce_dev_setup()
+{
+ synce_cmdline_setup "$1"
+}
+
+synce_cmdline_help()
+{
+ echo "Usage: $THIS serial-device [localip:remoteip [dns_server]]" >&2
+}
+
+# Usage: synce_cmdline_setup /dev/path [localip:remoteip [dns_server]]
+# Typically: synce_cmdline_setup "$@"
+synce_cmdline_setup()
+{
+ if [ -z "$1" -o "$1" = "--help" ]; then
+ synce_cmdline_help
+ exit 1
+ fi
+
+ if [ -c $1 ]; then
+ SYNCE_DEV=$1;
+ else
+ if [ -c /dev/$1 ]; then
+ SYNCE_DEV=/dev/$1
+ else
+ echo "
+ ERROR:
+
+ ${THIS} was unable to find a character device named \"$1\"
+
+ Run \"${THIS} --help\" to get help.
+ " >&2
+ exit 1
+ fi
+ fi
+
+ SYNCE_DEVNUM="`echo "$SYNCE_DEV" |sed -e 's/^[^0-9]*\([0-9]*\)$/\1/'`"
+ if [ -z "$SYNCE_DEVNUM" ]; then
+ SYNCE_DEVNUM=0
+ fi
+
+ # Add 120 for /dev/ttyS*, to support both standard serial
+ # and USB
+ if echo "$SYNCE_DEV" |grep ttyS >/dev/null 2>&1; then
+ SYNCE_DEVNUM="`expr $SYNCE_DEVNUM + 120`"
+ fi
+
+ SYNCE_DEVNAME="$DEVICE_PREFIX$SYNCE_DEVNUM"
+
+ if [ "$2" ]; then
+ if ! (echo $2 | grep -b '^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$'); then
+ echo "
+ ERROR:
+
+ The format of \"$2\" looks incorrect.
+
+ Run \"${THIS} --help\" to get help.
+ " >&2
+ exit 1
+ fi
+
+ SYNCE_IPADDR="$2"
+ SYNCE_LOCALIP="`echo "$2" |sed -e 's/^.*://'`"
+ SYNCE_REMOTEIP="`echo "$2" |sed -e 's/:.*$//'`"
+ else
+ SYNCE_LOCALIP="$DEFAULT_NETWORK.`expr 1 + $SYNCE_DEVNUM`"
+ SYNCE_REMOTEIP="$DEFAULT_NETWORK.`expr 129 + $SYNCE_DEVNUM`"
+ SYNCE_IPADDR="$SYNCE_LOCALIP:$SYNCE_REMOTEIP"
+ fi
+
+ if [ "$3" ]; then
+ SYNCE_DNS="$3"
+ else
+ SYNCE_DNS="$SYNCE_LOCALIP"
+ fi
+ export SYNCE_DEV SYNCE_DEVNUM SYNCE_LOCALIP SYNCE_REMOTEIP SYNCE_DEVNAME SYNCE_IPADDR SYNCE_DNS
+}
+
+synce_dumpenv()
+{
+ env |grep '^SYNCE' |sed -e 's/^/export /'
+}
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-config.in synce-serial-0.9.1-sg/script/synce-serial-config.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-config.in 2005-07-08 15:04:42.000000000 -0400
+++ synce-serial-0.9.1-sg/script/synce-serial-config.in 2006-11-13 15:00:00.000000000 -0500
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
#
# $Id: synce-serial-config.in,v 1.9 2005/07/08 19:04:42 twogood Exp $
#
@@ -14,6 +14,8 @@

exit_if_not_root

+rm -f $CONFIG_FILE.new
+
SYSTEM=`uname -s`

help()
@@ -92,57 +94,10 @@
exit 1
fi

-if [ -c $1 ]; then
- DEVICE=$1;
-else
- if [ -c /dev/$1 ]; then
- DEVICE=/dev/$1
- else
- echo "
-ERROR:
-
-${THIS} was unable to find a character device named \"$1\"
-
-Run \"${THIS} --help\" to get help.
-" >&2
- exit 1
- fi
-fi
-
-if [ "$2" ]; then
- if ! (echo $2 | grep -b '^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$'); then
- echo "
-ERROR:
-
-The format of \"$2\" looks incorrect.
-
-Run \"${THIS} --help\" to get help.
-" >&2
- exit 1
- fi
-
- IP_ADDRESSES=$2
-else
- IP_ADDRESSES=${DEFAULT_IPS}
-fi
-
-DNS_SERVER="$3"
-if [ -z "$DNS_SERVER" ]; then
- DNS_SERVER=`echo $IP_ADDRESSES | sed 's/:.*$//'`
-fi
+synce_cmdline_setup "$@"

-echo "# Modifications to this file will be lost next time you run ${THIS}
-${DEVICE} 115200
-connect '@BINDIR@/synce-serial-chat'
-nodefaultroute
-noauth
-local
-${IP_ADDRESSES}
-ms-dns ${DNS_SERVER}
-crtscts
-linkname ${PEER}" >${PEER_FILE}
-#lcp-echo-failure 2
-#lcp-echo-interval 2
+synce_dumpenv >$CONFIG_FILE.new
+mv $CONFIG_FILE.new $CONFIG_FILE

echo "
You can now run synce-serial-start to start a serial connection.
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-hotplug.in synce-serial-0.9.1-sg/script/synce-serial-hotplug.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-hotplug.in 1969-12-31 19:00:00.000000000 -0500
+++ synce-serial-0.9.1-sg/script/synce-serial-hotplug.in 2006-11-13 13:37:35.000000000 -0500
@@ -0,0 +1,32 @@
+#!/bin/sh -e
+
+THIS=`basename $0`
+
+# include common stuff
+. @SHARED_SYNCE@/synce-serial-common
+
+exit_if_not_root
+
+uname=`uname -n`
+
+# OK, first find our TTY.
+DEVTTY="`ls "$SYSFS$DEVPATH" |grep tty |head -1`"
+if [ -z "$DEVTTY" ]; then
+ log "Couldn't find TTY for '$DEVPATH'"
+ exit 1
+fi
+
+# Set up the environment
+synce_dev_setup "/dev/$DEVTTY"
+
+if [ "$ACTION" != "add" ]; then
+ exit 0
+fi
+
+# Put the important parts of the environment into the remover
+( synce_dumpenv
+ echo "@BINDIR@/synce-serial-abort-device"
+) >$REMOVER
+chmod +x $REMOVER
+
+exec @BINDIR@/synce-serial-start-device
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-start-device.in synce-serial-0.9.1-sg/script/synce-serial-start-device.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-start-device.in 1969-12-31 19:00:00.000000000 -0500
+++ synce-serial-0.9.1-sg/script/synce-serial-start-device.in 2006-11-13 14:52:03.000000000 -0500
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+
+
+THIS=`basename $0`
+
+# include common stuff
+. @SHARED_SYNCE@/synce-serial-common
+
+exit_if_not_root
+
+export PATH="@BINDIR@:$PATH"
+pppopts="nodefaultroute noauth local crtscts"
+if [ -t 1 ]; then
+ pppopts="$pppopts updetach"
+fi
+
+: ${SYNCE_DEV:=$DEFAULT_DEV}
+if [ ! -e ${SYNCE_DEV} ]; then
+ $ERROR "Device '$SYNCE_DEV' does not exist"
+ exit 1
+fi
+
+# Shut off the connection in case it's running.
+synce-serial-abort-device >/dev/null 2>&1
+
+# Now bring up the connection
+${SYNCE_PPP:-$PPPD} ${SYNCE_DEV} ${SYNCE_DEVSPEED:-115200} connect ${SYNCE_PPP_CONNECT:-@BINDIR@/synce-serial-chat} ${SYNCE_IPADDR:-$DEFAULT_IPS} ms-dns ${SYNCE_DNS:-$DEFAULT_LOCAL_IP} linkname ${SYNCE_DEVNAME:-$PEER} $pppopts $SYNCE_PPP_OPTIONS
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-start.in synce-serial-0.9.1-sg/script/synce-serial-start.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-start.in 2005-07-08 15:04:42.000000000 -0400
+++ synce-serial-0.9.1-sg/script/synce-serial-start.in 2006-11-13 14:51:28.000000000 -0500
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
#
# $Id: synce-serial-start.in,v 1.9 2005/07/08 19:04:42 twogood Exp $
#
@@ -42,18 +42,18 @@
exit 1
fi

-#
-# Check for the peer file to prevent some confusing error from pppd.
-#
-
-if [ ! -e ${PEER_FILE} ]; then
- echo "
-${THIS} was unable to find the file ${PEER_FILE}:
+if [ $# -gt 0 ]; then
+ synce_cmdline_setup "$@"
+elif [ -e ${CONFIG_FILE} ]; then
+ . $CONFIG_FILE
+else
+ echo "
+${THIS} was unable to find the file ${CONFIG_FILE}:

Please run the synce-serial-config tool to create this file before running this
script again.
" >&2
- exit 1
+ exit 1
fi

#
@@ -77,17 +77,14 @@
#
# Check for file in /dev
#
-DEVICE=`awk '/^\/dev\// { print $1 }' ${PEER_FILE}`
-if [ "$DEVICE" ]; then
- if [ ! -c "$DEVICE" ]; then
- echo "
+if [ ! -c "$SYNCE_DEV" ]; then
+ echo "
Error!

-${THIS} could not find the serial port $DEVICE.
+${THIS} could not find the serial port $SYNCE_DEV.
Is your Windows CE device really connected?
" >&2
exit 1
- fi
fi


@@ -138,9 +135,7 @@
# Finally start pppd
#

-${INFO} "Executing '${COMMAND}'"
-
-if ${COMMAND}; then
+if @BINDIR@/synce-serial-start-device; then
echo "
${THIS} is now waiting for your device to connect
"
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-udev-add.in synce-serial-0.9.1-sg/script/synce-serial-udev-add.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-udev-add.in 1969-12-31 19:00:00.000000000 -0500
+++ synce-serial-0.9.1-sg/script/synce-serial-udev-add.in 2006-11-10 18:00:41.000000000 -0500
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+
+THIS=`basename $0`
+
+# include common stuff
+. @SHARED_SYNCE@/synce-serial-common
+
+exit_if_not_root
+
+synce_dev_setup "$DEVNAME"
+
+exec @BINDIR@/synce-serial-start-device
+
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-serial-udev-remove.in synce-serial-0.9.1-sg/script/synce-serial-udev-remove.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-serial-udev-remove.in 1969-12-31 19:00:00.000000000 -0500
+++ synce-serial-0.9.1-sg/script/synce-serial-udev-remove.in 2006-11-10 18:00:41.000000000 -0500
@@ -0,0 +1,14 @@
+#!/bin/sh -e
+
+THIS=`basename $0`
+
+# include common stuff
+. @SHARED_SYNCE@/synce-serial-common
+
+exit_if_not_root
+
+synce_dev_setup "$DEVNAME"
+
+$INFO "Removing $SYNCE_DEV ($SYNCE_DEVNAME)"
+
+exec @BINDIR@/synce-abort-serial-device
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce-udev.rules.in synce-serial-0.9.1-sg/script/synce-udev.rules.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce-udev.rules.in 1969-12-31 19:00:00.000000000 -0500
+++ synce-serial-0.9.1-sg/script/synce-udev.rules.in 2006-11-10 16:22:59.000000000 -0500
@@ -0,0 +1,2 @@
+ACTION="add", DRIVER="ipaq", SUBSYSTEM="tty", KERNEL="ttyUSB*", RUN+="@BINDIR@/synce-serial-udev-add"
+ACTION="remove", KERNEL="ttyUSB*", SUBSYSTEM="tty", RUN+="@BINDIR@/synce-serial-udev-remove"
diff -ur --unidirectional-new-file synce-0.9.1/synce-serial-0.9.1/script/synce.usermap.in synce-serial-0.9.1-sg/script/synce.usermap.in
--- synce-0.9.1/synce-serial-0.9.1/script/synce.usermap.in 1969-12-31 19:00:00.000000000 -0500
+++ synce-serial-0.9.1-sg/script/synce.usermap.in 2006-11-13 15:40:41.000000000 -0500
@@ -0,0 +1,5 @@
+# SynCE devices for PDA synchronization
+# http://www.synce.org/
+synce 0x0003 0x413c 0x4003 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+synce 0x0003 0x413c 0x4004 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+synce 0x0003 0x413c 0x4011 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

--=-=-=--

Loading...