forked from mirrored-repos/manjaro-tools
117 lines
2.8 KiB
Bash
117 lines
2.8 KiB
Bash
#!/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
|
|
import ${LIBDIR}/util-iso.sh
|
|
import ${LIBDIR}/util-publish.sh
|
|
|
|
show_profile(){
|
|
cd $1
|
|
load_profile "$1"
|
|
msg2 "cache_dir_iso: ${cache_dir_iso}"
|
|
msg2 "remote_tree: ${remote_tree}/$1"
|
|
cd ..
|
|
}
|
|
|
|
show_upload_queue(){
|
|
if ${is_buildset};then
|
|
local list=$(read_set ${sets_dir_iso}/${buildset_iso}.set)
|
|
for item in ${list[@]}; do
|
|
show_profile "$item"
|
|
done
|
|
else
|
|
show_profile "${buildset_iso}"
|
|
fi
|
|
}
|
|
|
|
display_settings(){
|
|
show_version
|
|
show_config
|
|
|
|
msg "PROFILE:"
|
|
msg2 "sets_dir_iso: ${sets_dir_iso}"
|
|
msg2 "buildsets: $(load_sets ${sets_dir_iso})"
|
|
msg2 "buildset_iso: ${buildset_iso}"
|
|
msg2 "is_buildset: ${is_buildset}"
|
|
|
|
msg "ARGS:"
|
|
msg2 "update: ${update}"
|
|
msg2 "remote_create: ${remote_create}"
|
|
msg2 "rsync_args: ${rsync_args[*]}"
|
|
|
|
msg "HOST:"
|
|
msg2 "dist_release: ${dist_release}"
|
|
|
|
msg "REMOTE:"
|
|
msg2 "remote_url: ${remote_url}"
|
|
msg2 "remote_project: ${remote_project}"
|
|
msg2 "remote_target: ${remote_target}"
|
|
msg2 "remote_user: ${remote_user}"
|
|
|
|
msg "UPLOAD QUEUE:"
|
|
show_upload_queue
|
|
}
|
|
|
|
load_user_info
|
|
|
|
load_config "${USER_CONFIG}/manjaro-tools.conf"
|
|
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
|
|
|
pretend=false
|
|
remote_create=false
|
|
update=false
|
|
|
|
rsync_args=(-aP --progress -e ssh)
|
|
|
|
usage() {
|
|
echo "Usage: ${0##*/} [options]"
|
|
echo " -p Source folder to upload [default:${buildset_iso}]"
|
|
echo ' -c Create new remote edition_type with subtree'
|
|
echo ' -u Update remote iso (diff only)'
|
|
echo ' -q Query settings and pretend upload'
|
|
echo ' -h This help'
|
|
echo ''
|
|
echo ''
|
|
exit $1
|
|
}
|
|
|
|
opts='p:cuqh'
|
|
|
|
while getopts "${opts}" arg; do
|
|
case "${arg}" in
|
|
p) buildset_iso="$OPTARG" ;;
|
|
c) remote_create=true ;;
|
|
u) update=true; rsync_args+=(-u) ;;
|
|
q) pretend=true ;;
|
|
h|?) usage 0 ;;
|
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
|
esac
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
timer_start=$(get_timer)
|
|
|
|
eval_buildset "${buildset_iso}" "${sets_dir_iso}"
|
|
|
|
sf_url=${remote_user},${remote_project}@frs.${remote_url}:${remote_target}/${remote_project}
|
|
shell_url=${remote_user},${remote_project}@shell.${remote_url}
|
|
|
|
${pretend} && display_settings && exit 1
|
|
|
|
upload
|