2015-11-12 19:03:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
2016-07-12 20:19:41 +02:00
|
|
|
create_release(){
|
2016-07-14 06:56:29 +02:00
|
|
|
msg "Create release (%s) ..." "${dist_release}"
|
2016-07-15 00:50:50 +02:00
|
|
|
rsync ${rsync_args[*]} /dev/null ${url}/${dist_release}/
|
2016-02-15 16:47:52 +01:00
|
|
|
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
2016-07-14 06:56:29 +02:00
|
|
|
msg "Done (%s)" "${dist_release}"
|
2015-11-26 01:21:16 +01:00
|
|
|
}
|
|
|
|
|
2016-07-12 20:19:41 +02:00
|
|
|
get_edition(){
|
|
|
|
local result=$(find ${run_dir} -maxdepth 3 -name "$1") path
|
2016-07-14 12:26:51 +02:00
|
|
|
[[ -z $result ]] && die "%s is not a valid profile or build list!" "$1"
|
2016-07-12 20:19:41 +02:00
|
|
|
path=${result%/*}
|
|
|
|
path=${path%/*}
|
|
|
|
echo ${path##*/}
|
|
|
|
}
|
|
|
|
|
2016-07-15 00:50:50 +02:00
|
|
|
connect(){
|
|
|
|
local home="/home/frs/project"
|
|
|
|
echo "${account},$1@frs.${host}:${home}/$1"
|
|
|
|
}
|
|
|
|
|
2015-11-30 18:59:57 +01:00
|
|
|
prepare_transfer(){
|
2016-07-15 00:53:46 +02:00
|
|
|
local edition=$(get_edition $1)
|
2016-07-15 00:50:50 +02:00
|
|
|
project=$(get_project "${edition}")
|
|
|
|
url=$(connect "${project}")
|
|
|
|
target_dir="${dist_release}/$1"
|
|
|
|
src_dir="${run_dir}/${edition}/${target_dir}"
|
2016-02-18 00:02:11 +01:00
|
|
|
}
|
|
|
|
|
2015-11-17 17:04:04 +01:00
|
|
|
sync_dir(){
|
2015-12-04 23:08:27 +01:00
|
|
|
prepare_transfer "$1"
|
2016-07-14 12:26:51 +02:00
|
|
|
if ${release} && ! ${exists};then
|
|
|
|
create_release
|
|
|
|
exists=true
|
|
|
|
fi
|
2016-07-12 20:19:41 +02:00
|
|
|
msg "Start upload [%s] ..." "$1"
|
2016-07-15 00:50:50 +02:00
|
|
|
rsync ${rsync_args[*]} ${src_dir}/ ${url}/${target_dir}/
|
2016-02-15 16:30:59 +01:00
|
|
|
msg "Done upload [%s]" "$1"
|
2016-02-15 16:47:52 +01:00
|
|
|
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
2015-11-12 19:03:21 +01:00
|
|
|
}
|