From c2675e125d83b94a714d9d6612ead86f6154c6c0 Mon Sep 17 00:00:00 2001 From: deajan Date: Sun, 20 Mar 2016 16:49:29 +0100 Subject: [PATCH] Added cygwin to supported OS list --- dev/debug_obackup.sh | 14 +++++++++++--- install.sh | 43 ++++++++++++++++++++++++++----------------- obackup.sh | 14 +++++++++++--- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/dev/debug_obackup.sh b/dev/debug_obackup.sh index 04379d6..472030f 100755 --- a/dev/debug_obackup.sh +++ b/dev/debug_obackup.sh @@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre PROGRAM_BUILD=2016031801 IS_STABLE=no -## FUNC_BUILD=2016031401 +## FUNC_BUILD=2016032001 ## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode @@ -410,13 +410,17 @@ function GetLocalOS { *"BSD"*) LOCAL_OS="BSD" ;; - *"MINGW32"*) + *"MINGW32"*|*"CYGWIN"*) LOCAL_OS="msys" ;; *"Darwin"*) LOCAL_OS="MacOSX" ;; *) + if [ "$IGNORE_OS_TYPE" == "yes" ]; then #DOC: Undocumented option + Logger "Running on unknown local OS." "WARN" + return + fi Logger "Running on >> $local_os_var << not supported. Please report to the author." "ERROR" exit 1 ;; @@ -466,7 +470,7 @@ function GetRemoteOS { *"BSD"*) REMOTE_OS="BSD" ;; - *"MINGW32"*) + *"MINGW32"*|*"CYGWIN"*) REMOTE_OS="msys" ;; *"Darwin"*) @@ -477,6 +481,10 @@ function GetRemoteOS { exit 1 ;; *) + if [ "$IGNORE_OS_VER" == "yes" ]; then #DOC: Undocumented option + Logger "Running on unknown remote OS." "WARN" + return + fi Logger "Running on remote OS failed. Please report to the author if the OS is not supported." "CRITICAL" Logger "Remote OS said:\n$remote_os_var" "CRITICAL" exit 1 diff --git a/install.sh b/install.sh index 114632a..9152924 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,7 @@ PROGRAM=obackup PROGRAM_BINARY=$PROGRAM".sh" PROGRAM_BATCH=$PROGRAM"-batch.sh" -SCRIPT_BUILD=2016031401 +SCRIPT_BUILD=2016031502 ## osync / obackup daemon install script ## Tested on RHEL / CentOS 6 & 7, Fedora 23, Debian 7 & 8, Mint 17 and FreeBSD 8 & 10 @@ -42,23 +42,37 @@ if [ -f "./exlude.list.example" ]; then cp "./exclude.list.example" "/etc/$PROGRAM" fi +if [ -f "./snapshot.conf" ]; then + cp "./snapshot.conf" "/etc/$PROGRAM/snapshot.conf.example" +fi + cp "./$PROGRAM_BINARY" "$BIN_DIR" if [ $? != 0 ]; then echo "Cannot copy $PROGRAM_BINARY to [$BIN_DIR]." else + chmod 755 "$BIN_DIR/$PROGRAM_BINARY" echo "Copied $PROGRAM_BINARY to [$BIN_DIR]." fi -cp "./$PROGRAM_BATCH" "/usr/local/bin" -if [ $? != 0 ]; then - echo "Cannot copy $PROGRAM_BATCH to [$BIN_DIR]." -else - echo "Copied $PROGRAM_BATCH to [$BIN_DIR]." + +if [ -f "./$PROGRAM_BATCH" ]; then + cp "./$PROGRAM_BATCH" "$BIN_DIR" + if [ $? != 0 ]; then + echo "Cannot copy $PROGRAM_BATCH to [$BIN_DIR]." + else + chmod 755 "$BIN_DIR/$PROGRAM_BATCH" + echo "Copied $PROGRAM_BATCH to [$BIN_DIR]." + fi fi -cp "./ssh_filter.sh" "/usr/local/bin" -if [ $? != 0 ]; then - echo "Cannot copy ssh_filter.sh to [$BIN_DIR]." -else - echo "Copied ssh_filter.sh to [$BIN_DIR]." + +if [ -f "./ssh_filter.sh" ]; then + cp "./ssh_filter.sh" "$BIN_DIR" + if [ $? != 0 ]; then + echo "Cannot copy ssh_filter.sh to [$BIN_DIR]." + else + chmod 755 "$BIN_DIR/ssh_filter.sh" + chown root:root "$BIN_DIR/ssh_filter.sh" + echo "Copied ssh_filter.sh to [$BIN_DIR]." + fi fi if [ -f "./osync-srv" ]; then @@ -66,12 +80,7 @@ if [ -f "./osync-srv" ]; then if [ $? != 0 ]; then echo "Cannot copy osync-srv to [$SERVICE_DIR]." else + chmod 755 "$SERVICE_DIR/osync-srv" echo "Created osync-srv service in [$SERVICE_DIR]." - chmod 755 "/etc/init.d/osync-srv" fi fi - -chmod 755 "/usr/local/bin/$PROGRAM_BINARY" -chmod 755 "/usr/local/bin/$PROGRAM_BATCH" -chmod 755 "/usr/local/bin/ssh_filter.sh" -chown root:root "/usr/local/bin/ssh_filter.sh" diff --git a/obackup.sh b/obackup.sh index d6d2f2e..3d40e90 100755 --- a/obackup.sh +++ b/obackup.sh @@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre PROGRAM_BUILD=2016031801 IS_STABLE=no -## FUNC_BUILD=2016031401 +## FUNC_BUILD=2016032001 ## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode @@ -396,13 +396,17 @@ function GetLocalOS { *"BSD"*) LOCAL_OS="BSD" ;; - *"MINGW32"*) + *"MINGW32"*|*"CYGWIN"*) LOCAL_OS="msys" ;; *"Darwin"*) LOCAL_OS="MacOSX" ;; *) + if [ "$IGNORE_OS_TYPE" == "yes" ]; then #DOC: Undocumented option + Logger "Running on unknown local OS." "WARN" + return + fi Logger "Running on >> $local_os_var << not supported. Please report to the author." "ERROR" exit 1 ;; @@ -451,7 +455,7 @@ function GetRemoteOS { *"BSD"*) REMOTE_OS="BSD" ;; - *"MINGW32"*) + *"MINGW32"*|*"CYGWIN"*) REMOTE_OS="msys" ;; *"Darwin"*) @@ -462,6 +466,10 @@ function GetRemoteOS { exit 1 ;; *) + if [ "$IGNORE_OS_VER" == "yes" ]; then #DOC: Undocumented option + Logger "Running on unknown remote OS." "WARN" + return + fi Logger "Running on remote OS failed. Please report to the author if the OS is not supported." "CRITICAL" Logger "Remote OS said:\n$remote_os_var" "CRITICAL" exit 1