root commited on 2011-02-10 11:02:47
Showing 1 changed files, with 50 additions and 1 deletions.
... | ... |
@@ -10,9 +10,45 @@ MAX_CHECK=10 |
10 | 10 |
MAX_FAILED=3 |
11 | 11 |
SLEEP_ON_FAILED=10 |
12 | 12 |
CHECK_URL=http://www.roundcube.net/download |
13 |
+DOWNLOAD_DIR=$RC_HOME/../upstream |
|
13 | 14 |
|
14 | 15 |
DEBUG=0 |
15 |
-[ "$1" == "-v" ] && DEBUG=1 |
|
16 |
+DOWNLOAD=0 |
|
17 |
+ |
|
18 |
+function usage() { |
|
19 |
+ echo "Usage : $0 [-v] [-d]" |
|
20 |
+ echo " -v Verbose mode" |
|
21 |
+ echo " -d Download new release" |
|
22 |
+ echo " -h Display this help" |
|
23 |
+} |
|
24 |
+ |
|
25 |
+while getopts ":dvh" opt; do |
|
26 |
+ case $opt in |
|
27 |
+ v) |
|
28 |
+ DEBUG=1 |
|
29 |
+ ;; |
|
30 |
+ d) |
|
31 |
+ DOWNLOAD=1 |
|
32 |
+ ;; |
|
33 |
+ h) |
|
34 |
+ usage |
|
35 |
+ exit 0 |
|
36 |
+ ;; |
|
37 |
+ \?) |
|
38 |
+ echo "Invalid option: -$OPTARG" >&2 |
|
39 |
+ echo |
|
40 |
+ usage |
|
41 |
+ exit 1 |
|
42 |
+ ;; |
|
43 |
+ :) |
|
44 |
+ echo "Option -$OPTARG requires an argument." >&2 |
|
45 |
+ echo |
|
46 |
+ usage |
|
47 |
+ exit 1 |
|
48 |
+ ;; |
|
49 |
+ |
|
50 |
+ esac |
|
51 |
+done |
|
16 | 52 |
|
17 | 53 |
[ -f "$0.local" ] && source "$0.local" && [ $DEBUG -eq 1 ] && echo "Import local config file : $0.local" |
18 | 54 |
|
... | ... |
@@ -74,6 +110,19 @@ then |
74 | 110 |
echo >> $tmp |
75 | 111 |
echo "Download URL : $DOWNLOAD_URL" >> $tmp |
76 | 112 |
|
113 |
+ if [ $DOWNLOAD -eq 1 ] |
|
114 |
+ then |
|
115 |
+ if [ -d "$DOWNLOAD_DIR" ] |
|
116 |
+ then |
|
117 |
+ cd "$DOWNLOAD_DIR" |
|
118 |
+ [ $DEBUG -eq 1 ] && echo "Download new release in $( pwd )/roundcubemail-$newest.tar.gz" |
|
119 |
+ wget -q -O "roundcubemail-$newest.tar.gz" "$DOWNLOAD_URL" |
|
120 |
+ echo "Download file : $( pwd )/roundcubemail-$newest.tar.gz" >> $tmp |
|
121 |
+ else |
|
122 |
+ echo "[WARNING] Le dossier de telechargement n'existe pas ($DOWNLOAD_DIR)." |
|
123 |
+ fi |
|
124 |
+ fi |
|
125 |
+ |
|
77 | 126 |
M=0 |
78 | 127 |
if [ -f $CACHE ] |
79 | 128 |
then |
80 | 129 |