manjaro-tools/lib/util-publish.sh

51 lines
1.4 KiB
Bash
Raw Normal View History

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.
create_release(){
msg "Create release (%s) ..." "${dist_release}"
2016-07-15 00:50:50 +02:00
rsync ${rsync_args[*]} /dev/null ${url}/${dist_release}/
show_elapsed_time "${FUNCNAME}" "${timer_start}"
msg "Done (%s)" "${dist_release}"
2015-11-26 01:21:16 +01: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"
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"
}
prepare_transfer(){
2016-07-15 00:50:50 +02:00
local edition=$(get_edition $1) project
project=$(get_project "${edition}")
url=$(connect "${project}")
target_dir="${dist_release}/$1"
src_dir="${run_dir}/${edition}/${target_dir}"
}
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
msg "Start upload [%s] ..." "$1"
2016-07-15 00:50:50 +02:00
rsync ${rsync_args[*]} ${src_dir}/ ${url}/${target_dir}/
msg "Done upload [%s]" "$1"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
2015-11-12 19:03:21 +01:00
}