Improved portability

pull/2/head v0.99RC2
deajan 11 years ago
parent 1c408b3009
commit 5f51a1fb2d

@ -9,10 +9,12 @@ KNOWN ISSUES
------------ ------------
- If master and remote slave systems don't have rsync in the same path, execution may fail (RSYNC_PATH is always configured on master, even when executed on slave) - If master and remote slave systems don't have rsync in the same path, execution may fail (RSYNC_PATH is always configured on master, even when executed on slave)
- On MSYS, osync does not propagate deletions
RECENT CHANGES RECENT CHANGES
-------------- --------------
- Made more portability improvements (mostly for FreeBSD, must be run with bash shell)
- Added local and remote operating system detection - Added local and remote operating system detection
- Added forced usage of MSYS find on remote MSYS hosts - Added forced usage of MSYS find on remote MSYS hosts
- Updated MSYS handling - Updated MSYS handling

@ -2,8 +2,8 @@
###### Osync - Rsync based two way sync engine with fault tolerance ###### Osync - Rsync based two way sync engine with fault tolerance
###### (L) 2013 by Orsiris "Ozy" de Jong (www.netpower.fr) ###### (L) 2013 by Orsiris "Ozy" de Jong (www.netpower.fr)
OSYNC_VERSION=0.99preRC2-MSYS-compatible OSYNC_VERSION=0.99preRC2-MSYS-FreeBSD-compatible
OSYNC_BUILD=1110201301 OSYNC_BUILD=1110201302
DEBUG=no DEBUG=no
SCRIPT_PID=$$ SCRIPT_PID=$$
@ -503,9 +503,9 @@ function CheckConnectivityRemoteHost
then then
if [ "$LOCAL_OS" == "msys" ] if [ "$LOCAL_OS" == "msys" ]
then then
ping $REMOTE_HOST -n 2 > /dev/null 2>&1 ping -n 2 $REMOTE_HOST > /dev/null 2>&1
else else
ping $REMOTE_HOST -c 2 > /dev/null 2>&1 ping -c 2 $REMOTE_HOST > /dev/null 2>&1
fi fi
if [ $? != 0 ] if [ $? != 0 ]
then then
@ -526,9 +526,9 @@ function CheckConnectivity3rdPartyHosts
do do
if [ "$LOCAL_OS" == "msys" ] if [ "$LOCAL_OS" == "msys" ]
then then
ping $i -n 2 > /dev/null 2>&1 ping -n 2 $i > /dev/null 2>&1
else else
ping $i -c 2 > /dev/null 2>&1 ping -c 2 $i > /dev/null 2>&1
fi fi
if [ $? != 0 ] if [ $? != 0 ]
then then
@ -550,7 +550,7 @@ function CreateOsyncDirs
{ {
if ! [ -d "$MASTER_STATE_DIR" ] if ! [ -d "$MASTER_STATE_DIR" ]
then then
mkdir --parents "$MASTER_STATE_DIR" mkdir -p "$MASTER_STATE_DIR"
if [ $? != 0 ] if [ $? != 0 ]
then then
LogError "Cannot create master replica state dir [$MASTER_STATE_DIR]." LogError "Cannot create master replica state dir [$MASTER_STATE_DIR]."
@ -562,11 +562,11 @@ function CreateOsyncDirs
then then
CheckConnectivity3rdPartyHosts CheckConnectivity3rdPartyHosts
CheckConnectivityRemoteHost CheckConnectivityRemoteHost
eval "$SSH_CMD \"if ! [ -d \\\"$SLAVE_STATE_DIR\\\" ]; then $COMMAND_SUDO mkdir --parents \\\"$SLAVE_STATE_DIR\\\"; fi\"" & eval "$SSH_CMD \"if ! [ -d \\\"$SLAVE_STATE_DIR\\\" ]; then $COMMAND_SUDO mkdir -p \\\"$SLAVE_STATE_DIR\\\"; fi\"" &
child_pid=$! child_pid=$!
WaitForTaskCompletion $child_pid 0 1800 WaitForTaskCompletion $child_pid 0 1800
else else
if ! [ -d "$SLAVE_STATE_DIR" ]; then mkdir --parents "$SLAVE_STATE_DIR"; fi if ! [ -d "$SLAVE_STATE_DIR" ]; then mkdir -p "$SLAVE_STATE_DIR"; fi
fi fi
if [ $? != 0 ] if [ $? != 0 ]
@ -582,7 +582,7 @@ function CheckMasterSlaveDirs
then then
if [ "$CREATE_DIRS" == "yes" ] if [ "$CREATE_DIRS" == "yes" ]
then then
mkdir --parents "$MASTER_SYNC_DIR" mkdir -p "$MASTER_SYNC_DIR"
if [ $? != 0 ] if [ $? != 0 ]
then then
LogError "Cannot create master directory [$MASTER_SYNC_DIR]." LogError "Cannot create master directory [$MASTER_SYNC_DIR]."
@ -600,7 +600,7 @@ function CheckMasterSlaveDirs
CheckConnectivityRemoteHost CheckConnectivityRemoteHost
if [ "$CREATE_DIRS" == "yes" ] if [ "$CREATE_DIRS" == "yes" ]
then then
eval "$SSH_CMD \"if ! [ -d \\\"$SLAVE_SYNC_DIR\\\" ]; then $COMMAND_SUDO mkdir --parents \\\"$SLAVE_SYNC_DIR\\\"; fi"\" & eval "$SSH_CMD \"if ! [ -d \\\"$SLAVE_SYNC_DIR\\\" ]; then $COMMAND_SUDO mkdir -p \\\"$SLAVE_SYNC_DIR\\\"; fi"\" &
child_pid=$! child_pid=$!
WaitForTaskCompletion $child_pid 0 1800 WaitForTaskCompletion $child_pid 0 1800
if [ $? != 0 ] if [ $? != 0 ]
@ -624,7 +624,7 @@ function CheckMasterSlaveDirs
then then
if [ "$CREATE_DIRS" == "yes" ] if [ "$CREATE_DIRS" == "yes" ]
then then
mkdir --parents "$SLAVE_SYNC_DIR" mkdir -p "$SLAVE_SYNC_DIR"
if [ $? != 0 ] if [ $? != 0 ]
then then
LogError "Cannot create slave directory [$SLAVE_SYNC_DIR]." LogError "Cannot create slave directory [$SLAVE_SYNC_DIR]."

Loading…
Cancel
Save