manjaro-tools/bin/buildtree.in

86 lines
1.9 KiB
Text
Raw Normal View History

2015-01-19 04:22:02 +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
2015-06-09 00:01:31 +02:00
import ${LIBDIR}/util.sh
2015-06-12 03:25:28 +02:00
import ${LIBDIR}/util-pkgtree.sh
2015-01-19 04:22:02 +01:00
display_settings(){
2016-09-15 23:58:18 +02:00
show_version
show_config
msg "ARGS:"
msg2 "sync: %s" "${sync}"
msg2 "abs: %s" "${abs}"
msg2 "clean: %s" "${clean}"
msg "PATHS:"
msg2 "tree_dir: %s" "${tree_dir}"
msg2 "repo_tree: %s" "${repo_tree[*]}"
msg2 "host_tree: %s" "${host_tree}"
msg2 "host_tree_abs: %s" "${host_tree_abs}"
2015-01-19 04:22:02 +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-01-19 04:22:02 +01:00
2015-01-19 05:24:32 +01:00
sync=false
2015-01-19 04:22:02 +01:00
pretend=false
abs=false
2015-01-19 05:24:32 +01:00
clean=false
2015-01-19 04:22:02 +01:00
usage() {
2016-09-15 23:58:18 +02:00
echo "Usage: ${0##*/} [options]"
echo " -s Sync manjaro tree"
echo " -a Sync arch abs"
echo ' -c Clean package tree'
echo ' -q Query settings'
echo ' -h This help'
echo ''
echo ''
exit $1
2015-01-19 04:22:02 +01:00
}
orig_argv=("$0" "$@")
2015-01-19 04:22:02 +01:00
2015-01-19 05:24:32 +01:00
opts='sacqh'
2015-01-19 04:22:02 +01:00
while getopts "${opts}" arg; do
2016-09-15 23:58:18 +02:00
case "${arg}" in
s) sync=true ;;
a) abs=true ;;
c) clean=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
2015-01-19 04:22:02 +01:00
done
shift $(($OPTIND - 1))
check_root
2015-01-19 04:22:02 +01:00
2015-02-17 18:28:26 +01:00
prepare_dir "${tree_dir_abs}"
2015-01-19 04:22:02 +01:00
${pretend} && display_settings && exit 1
2015-02-17 12:28:00 +01:00
${clean} && clean_dir "${tree_dir}"
2015-01-19 05:24:32 +01:00
2015-02-16 23:00:32 +01:00
${sync} && sync_tree_manjaro
2015-01-19 05:24:32 +01:00
${abs} && sync_tree_abs