2015-11-11 11:10:37 +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.
|
|
|
|
|
|
|
|
version=@version@
|
|
|
|
|
|
|
|
LIBDIR='@libdir@'
|
|
|
|
SYSCONFDIR='@sysconfdir@'
|
|
|
|
|
|
|
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
|
|
|
|
|
|
|
import ${LIBDIR}/util.sh
|
2015-11-12 19:03:51 +01:00
|
|
|
import ${LIBDIR}/util-publish.sh
|
2015-11-11 11:10:37 +01:00
|
|
|
|
2015-11-23 20:02:56 +01:00
|
|
|
show_profile(){
|
2015-12-04 23:08:57 +01:00
|
|
|
prepare_transfer "$1"
|
2016-07-12 20:19:41 +02:00
|
|
|
info "Profile: [$1]"
|
2016-07-15 00:50:50 +02:00
|
|
|
msg2 "project: %s" "${project}"
|
2015-12-04 23:08:57 +01:00
|
|
|
msg2 "src_dir: ${src_dir}"
|
2016-07-15 00:50:50 +02:00
|
|
|
msg2 "target_dir: ${target_dir}"
|
2015-11-23 20:02:56 +01:00
|
|
|
}
|
|
|
|
|
2015-11-11 11:10:37 +01:00
|
|
|
display_settings(){
|
|
|
|
show_version
|
|
|
|
show_config
|
2015-11-12 00:31:51 +01:00
|
|
|
|
2015-11-17 17:05:06 +01:00
|
|
|
msg "PROFILE:"
|
2016-06-09 18:03:38 +02:00
|
|
|
msg2 "list_dir_iso: %s" "${list_dir_iso}"
|
|
|
|
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
|
|
|
msg2 "build_list_iso: %s" "${build_list_iso}"
|
|
|
|
msg2 "is_build_list: %s" "${is_build_list}"
|
2015-11-17 17:05:06 +01:00
|
|
|
|
2015-11-24 16:58:40 +01:00
|
|
|
msg "OPTIONS:"
|
2016-02-15 16:30:59 +01:00
|
|
|
msg2 "limit: %s kB/s" "${limit}"
|
2016-07-15 00:50:50 +02:00
|
|
|
msg2 "dist_release: %s" "${dist_release}"
|
2015-11-24 10:31:27 +01:00
|
|
|
|
2015-11-23 22:57:17 +01:00
|
|
|
msg "ARGS:"
|
2016-02-15 16:30:59 +01:00
|
|
|
msg2 "update: %s" "${update}"
|
2016-07-14 06:56:29 +02:00
|
|
|
msg2 "release: %s" "${release}"
|
2016-02-15 16:30:59 +01:00
|
|
|
msg2 "verbose: %s" "${verbose}"
|
|
|
|
msg2 "rsync_args: %s" "${rsync_args[*]}"
|
2015-11-23 22:57:17 +01:00
|
|
|
|
2015-11-12 00:31:51 +01:00
|
|
|
msg "REMOTE:"
|
2016-07-15 00:50:50 +02:00
|
|
|
msg2 "account: %s" "${account}"
|
|
|
|
msg2 "host: %s" "${host}"
|
2016-07-12 22:27:23 +02:00
|
|
|
|
2015-11-17 17:05:06 +01:00
|
|
|
msg "UPLOAD QUEUE:"
|
2016-06-09 18:03:38 +02:00
|
|
|
run show_profile "${build_list_iso}"
|
2015-11-12 17:49:38 +01:00
|
|
|
}
|
|
|
|
|
2015-11-11 11:10:37 +01:00
|
|
|
load_user_info
|
|
|
|
|
2016-06-14 17:54:44 +02:00
|
|
|
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
2015-11-11 11:10:37 +01:00
|
|
|
|
2015-12-03 12:02:23 +01:00
|
|
|
run_dir=${cache_dir_iso}
|
|
|
|
|
2015-11-11 11:10:37 +01:00
|
|
|
pretend=false
|
2016-07-14 06:56:29 +02:00
|
|
|
release=false
|
2015-11-23 22:57:17 +01:00
|
|
|
update=false
|
2015-11-26 12:24:55 +01:00
|
|
|
verbose=false
|
2016-07-14 15:54:57 +02:00
|
|
|
exists=false
|
2015-11-23 22:57:17 +01:00
|
|
|
|
2015-11-26 12:24:55 +01:00
|
|
|
rsync_args=(-aP --progress -e ssh)
|
2015-11-12 12:25:35 +01:00
|
|
|
|
2015-11-11 11:10:37 +01:00
|
|
|
usage() {
|
|
|
|
echo "Usage: ${0##*/} [options]"
|
2016-06-09 18:03:38 +02:00
|
|
|
echo " -p Source folder to upload [default:${build_list_iso}]"
|
2015-11-25 19:52:56 +01:00
|
|
|
echo " -l Limit bandwidth in kB/s [default:${limit}]"
|
2016-07-12 20:19:41 +02:00
|
|
|
echo ' -c Create new remote release directory'
|
2016-07-12 22:27:23 +02:00
|
|
|
echo ' -u Update remote directory'
|
2015-11-12 17:49:38 +01:00
|
|
|
echo ' -q Query settings and pretend upload'
|
2015-11-26 12:24:55 +01:00
|
|
|
echo ' -v Verbose output'
|
2015-11-11 11:10:37 +01:00
|
|
|
echo ' -h This help'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
2016-07-12 20:19:41 +02:00
|
|
|
opts='p:l:cuvqh'
|
2015-11-11 11:10:37 +01:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
|
|
|
case "${arg}" in
|
2016-06-09 18:03:38 +02:00
|
|
|
p) build_list_iso="$OPTARG" ;;
|
2015-11-25 19:52:56 +01:00
|
|
|
l) limit="$OPTARG" ;;
|
2016-07-14 06:56:29 +02:00
|
|
|
c) release=true ;;
|
2015-11-23 22:57:17 +01:00
|
|
|
u) update=true; rsync_args+=(-u) ;;
|
2015-11-26 12:24:55 +01:00
|
|
|
v) verbose=true; rsync_args+=(-v --stats) ;;
|
2015-11-25 19:55:59 +01:00
|
|
|
q) pretend=true; rsync_args+=(-n) ;;
|
2015-11-11 11:10:37 +01:00
|
|
|
h|?) usage 0 ;;
|
|
|
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
|
|
|
timer_start=$(get_timer)
|
|
|
|
|
2016-06-09 18:03:38 +02:00
|
|
|
eval_build_list "${list_dir_iso}" "${build_list_iso}"
|
2015-11-17 17:05:06 +01:00
|
|
|
|
2015-11-25 19:52:56 +01:00
|
|
|
rsync_args+=(--bwlimit=${limit})
|
2015-11-11 11:10:37 +01:00
|
|
|
|
|
|
|
${pretend} && display_settings && exit 1
|
|
|
|
|
2016-06-09 18:03:38 +02:00
|
|
|
run sync_dir "${build_list_iso}"
|