tm-compressed-images-one-2.0.patch
src/tm_mad/nfs/tm_clone.sh | ||
---|---|---|
39 | 39 | |
40 | 40 |
DST_DIR=`dirname $DST_PATH` |
41 | 41 | |
42 | ||
42 | 43 |
log "Creating directory $DST_DIR" |
43 | 44 |
exec_and_log "mkdir -p $DST_DIR" |
44 | 45 |
exec_and_log "chmod a+w $DST_DIR" |
45 | 46 | |
46 | 47 |
case $SRC in |
47 |
http://*) |
|
48 |
http://*.gz|https://*.gz) |
|
49 |
log "Downloading GZip archive $SRC" |
|
50 |
exec_and_log "download_and_extract $SRC $DST_PATH.gz $GUNZIP" |
|
51 |
;; |
|
52 | ||
53 |
http://*.bz2|https://*.bz2) |
|
54 |
log "Downloading BZip2 archive $SRC" |
|
55 |
exec_and_log "download_and_extract $SRC $DST_PATH.bz2 $BUNZIP2" |
|
56 |
;; |
|
57 | ||
58 |
http://*|https://) |
|
48 | 59 |
log "Downloading $SRC" |
49 |
exec_and_log "$WGET -O $DST_PATH $SRC"
|
|
60 |
exec_and_log "$CURL -k -o $DST_PATH $SRC"
|
|
50 | 61 |
;; |
51 | 62 | |
52 | 63 |
*) |
src/tm_mad/ssh/tm_clone.sh | ||
---|---|---|
43 | 43 |
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR" |
44 | 44 | |
45 | 45 |
case $SRC in |
46 |
http://*) |
|
46 |
http://*.gz|https://*.gz) |
|
47 |
log "Downloading GZip archive $SRC" |
|
48 |
exec_and_log "download_and_extract $SRC $DST_PATH.gz $GUNZIP $DST_HOST" |
|
49 |
;; |
|
50 | ||
51 |
http://*.bz2|https://*.bz2) |
|
52 |
log "Downloading BZip2 archive $SRC" |
|
53 |
exec_and_log "download_and_extract $SRC $DST_PATH.bz2 $BUNZIP2 $DST_HOST" |
|
54 |
;; |
|
55 | ||
56 |
http://*|https://) |
|
47 | 57 |
log "Downloading $SRC" |
48 |
exec_and_log "$SSH $DST_HOST $WGET -O $DST_PATH $SRC"
|
|
58 |
exec_and_log "$SSH $DST_HOST $CURL -k -o $DST_PATH $SRC"
|
|
49 | 59 |
;; |
50 | 60 | |
51 | 61 |
*) |
... | ... | |
54 | 64 |
;; |
55 | 65 |
esac |
56 | 66 | |
57 |
exec_and_log "$SSH $DST_HOST chmod a+rw $DST_PATH"
|
|
67 |
exec_and_log "$SSH $DST_HOST chmod a+w $DST_PATH" |
|
58 | 68 |
src/tm_mad/tm_common.sh | ||
---|---|---|
39 | 39 |
SSH=/usr/bin/ssh |
40 | 40 |
SUDO=/usr/bin/sudo |
41 | 41 |
WGET=/usr/bin/wget |
42 |
CURL=/usr/bin/curl |
|
43 |
GUNZIP=/bin/gunzip |
|
44 |
BUNZIP2=/bin/bunzip2 |
|
42 | 45 | |
43 | 46 |
function get_vmdir |
44 | 47 |
{ |
... | ... | |
164 | 167 |
fi |
165 | 168 |
} |
166 | 169 | |
170 |
function download_and_extract |
|
171 |
{ |
|
172 |
URL=$1 |
|
173 |
ARCHIVE=$2 |
|
174 |
EXTRACT_CMD=$3 |
|
175 |
HOST=$4 |
|
176 | ||
177 |
if [ "x$HOST" != "x" ]; then |
|
178 |
SSH_CMD="$SSH $HOST" |
|
179 |
fi |
|
180 | ||
181 |
$SSH_CMD $CURL -k -o $ARCHIVE $URL |
|
182 |
$SSH_CMD $EXTRACT_CMD $ARCHIVE |
|
183 |
} |
|
184 |