95 lines
2.1 KiB
Bash
95 lines
2.1 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
|
|
[[ -r ${LIBDIR}/util.sh ]] && source ${LIBDIR}/util.sh
|
|
[[ -r ${LIBDIR}/util-pkgtree.sh ]] && source ${LIBDIR}/util-pkgtree.sh
|
|
|
|
display_settings(){
|
|
msg "manjaro-tools"
|
|
msg2 "version: ${version}"
|
|
|
|
if [[ -f ${USER_CONFIG}/manjaro-tools.conf ]]; then
|
|
msg2 "user_config: ${USER_CONFIG}/manjaro-tools.conf"
|
|
else
|
|
msg2 "manjaro_tools_conf: ${manjaro_tools_conf}"
|
|
fi
|
|
|
|
msg "ARGS:"
|
|
msg2 "sync: ${sync}"
|
|
msg2 "abs: ${abs}"
|
|
msg2 "clean: ${clean}"
|
|
|
|
msg "PATHS:"
|
|
msg2 "tree_dir: ${tree_dir}"
|
|
msg2 "repo_tree: ${repo_tree[*]}"
|
|
msg2 "host_tree: ${host_tree}"
|
|
msg2 "host_tree_abs: ${host_tree_abs}"
|
|
}
|
|
|
|
load_user_info
|
|
|
|
load_config "${USER_CONFIG}/manjaro-tools.conf"
|
|
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
|
|
|
sync=false
|
|
pretend=false
|
|
abs=false
|
|
clean=false
|
|
|
|
usage() {
|
|
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
|
|
}
|
|
|
|
orig_argv=("$@")
|
|
|
|
opts='sacqh'
|
|
|
|
while getopts "${opts}" arg; do
|
|
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
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
tree_dir=${cache_dir}/pkgtree
|
|
tree_dir_abs=${tree_dir}/packages-archlinux
|
|
|
|
check_root "$0" "${orig_argv[@]}"
|
|
|
|
prepare_dir "${tree_dir_abs}"
|
|
|
|
${pretend} && display_settings && exit 1
|
|
|
|
${clean} && clean_dir "${tree_dir}"
|
|
|
|
${sync} && sync_tree_manjaro
|
|
|
|
${abs} && sync_tree_abs
|