#!/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@ BINDIR='@bindir@' LIBDIR='@libdir@' PKGDATADIR='@pkgdatadir@' SYSCONFDIR='@sysconfdir@' [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh import ${LIBDIR}/util.sh display_settings(){ show_version show_config msg "HOST:" msg2 "cache_dir_iso: ${cache_dir_iso}" msg2 "dist_version: ${dist_version}" msg "REMOTE:" msg2 "remote_url: ${remote_url}" msg2 "remote_project: ${remote_project}" msg2 "remote_target: ${remote_target}" msg2 "remote_user: ${remote_user}" msg2 "remote_pwd: ${remote_pwd}" } upload(){ msg "Start upload ..." # local url=${remote_user},${remote_project}@frs.sourceforge.net:/home/frs/project/m/ma/${remote_project}/${remote_target} local files=$(ls ${cache_dir_iso}) sshpass -f ${remote_pwd} rsync -vP --progress -e ssh $files ${remote_url} msg "Done upload" msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer_start}) minutes" } load_user_info load_config "${USER_CONFIG}/manjaro-tools.conf" load_config "${SYSCONFDIR}/manjaro-tools.conf" publish=false pretend=false usage() { echo "Usage: ${0##*/} [options]" echo ' -u Upload iso file(s)' echo ' -q Query settings and pretend build' echo ' -h This help' echo '' echo '' exit $1 } orig_argv=("$@") opts='uqh' while getopts "${opts}" arg; do case "${arg}" in q) publish=true ;; q) pretend=true ;; h|?) usage 0 ;; *) echo "invalid argument '${arg}'"; usage 1 ;; esac done shift $(($OPTIND - 1)) timer_start=$(get_timer) # check_root "$0" "${orig_argv[@]}" ${pretend} && display_settings && exit 1 ${publish} && upload