Browse code

git-sync.sh - v1.2 - Bug corrected and check step added

For more details, see version section of the script.

U-TXBMGENETICS\fcheval authored on24/09/2014 15:34:22
Showing1 changed files
... ...
@@ -1,9 +1,9 @@
1 1
 #!/bin/bash
2 2
 # Title: git-sync.sh
3
-# Version: 1.1
3
+# Version: 1.2
4 4
 # Author: Frédéric CHEVALIER <fcheval@txbiomedgenetics.org>
5 5
 # Created in: 2014-09-03
6
-# Modified in: 2014-09-14
6
+# Modified in: 2014-09-24
7 7
 # Licence: GPL v3
8 8
 
9 9
 
... ...
@@ -20,6 +20,7 @@ aim="Synchronize files from git server (master branch) on this terminal."
20 20
 # Versions #
21 21
 #==========#
22 22
 
23
+# v1.2 - 2014-09-24: temp file bug corrected / check if local file exist
23 24
 # v1.1 - 2014-09-14: test_dep bug corrected
24 25
 # v1.0 - 2014-09-14: git dependency check replaced by wget check (bug) / test_dep function improved / remove comments in list file / check for http path / remove spaces in path / checksum loop corrected
25 26
 # v0.1 - 2014-09-23: dry-run option added / no check certifcate option added for wget
... ...
@@ -106,7 +107,7 @@ fi
106 107
 
107 108
 # Temporary list
108 109
 mydate=$(date +%N)
109
-tmp_list="/tmp/$list-$mydate"
110
+tmp_list="/tmp/$(basename $list)-$mydate"
110 111
 
111 112
 
112 113
 
... ...
@@ -135,6 +136,14 @@ do
135 136
 
136 137
     mydst_tmp="/tmp/${mydst##*/}"
137 138
 
139
+    # Check if destination file exists
140
+    if [[ ! -e "$mydst" ]]
141
+    then
142
+        warning "${mydst##*/}: Local file does not exist. Skipping..."
143
+        continue
144
+    fi
145
+
146
+
138 147
     # Check if remote path is http
139 148
     if [[ ! $(echo "$mysrc" | grep -i "^http") ]]
140 149
     then