2014-10-07 01:16:29 +02:00
|
|
|
#!/bin/bash
|
2014-10-08 11:11:19 +02:00
|
|
|
#
|
|
|
|
# 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.
|
2014-10-07 01:16:29 +02:00
|
|
|
|
2014-10-08 13:14:28 +02:00
|
|
|
version=@version@
|
|
|
|
|
2015-01-09 21:39:29 +01:00
|
|
|
SYSCONFDIR='@sysconfdir@'
|
2015-06-09 00:01:31 +02:00
|
|
|
LIBDIR='@libdir@'
|
2015-01-09 21:39:29 +01:00
|
|
|
|
2015-06-09 00:01:31 +02:00
|
|
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
|
|
|
import ${LIBDIR}/util.sh
|
2014-10-07 01:16:29 +02:00
|
|
|
|
2015-01-16 23:39:17 +01:00
|
|
|
load_user_info
|
|
|
|
|
2015-01-17 00:25:39 +01:00
|
|
|
load_config "${USER_CONFIG}/manjaro-tools.conf"
|
2015-01-16 23:39:17 +01:00
|
|
|
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
|
|
|
|
2014-10-07 10:34:33 +02:00
|
|
|
query=false
|
2014-10-07 17:27:39 +02:00
|
|
|
create=false
|
|
|
|
remove=false
|
2015-01-16 23:39:17 +01:00
|
|
|
show=false
|
2015-01-15 18:15:24 +01:00
|
|
|
iso_mode=false
|
2014-10-07 01:16:29 +02:00
|
|
|
|
2015-01-16 23:39:17 +01:00
|
|
|
name='default'
|
|
|
|
|
2014-10-07 01:16:29 +02:00
|
|
|
usage() {
|
2015-02-13 15:17:00 +01:00
|
|
|
echo "Usage: ${0##*/} [options]"
|
|
|
|
echo " -c <name> Create set"
|
|
|
|
echo " -r <name> Remove set"
|
|
|
|
echo " -s <name> Show set"
|
|
|
|
echo " -i Iso mode"
|
|
|
|
echo " -q Query sets"
|
|
|
|
echo ' -h This help'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
exit $1
|
2014-10-07 01:16:29 +02:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:19:49 +01:00
|
|
|
orig_argv=("$@")
|
|
|
|
|
2015-01-16 23:50:25 +01:00
|
|
|
opts='c:r:s:qih'
|
2014-10-07 01:16:29 +02:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
2015-02-13 15:17:00 +01:00
|
|
|
case "${arg}" in
|
|
|
|
c) name="$OPTARG"; create=true ;;
|
|
|
|
r) name="$OPTARG"; remove=true ;;
|
|
|
|
s) name="$OPTARG"; show=true;;
|
|
|
|
i) iso_mode=true ;;
|
|
|
|
q) query=true ;;
|
|
|
|
h|?) usage 0 ;;
|
|
|
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
|
|
|
esac
|
2014-10-07 01:16:29 +02:00
|
|
|
done
|
|
|
|
|
2014-10-07 17:27:39 +02:00
|
|
|
shift $(($OPTIND - 1))
|
2014-10-07 10:34:33 +02:00
|
|
|
|
2014-11-13 00:19:49 +01:00
|
|
|
check_root "$0" "${orig_argv[@]}"
|
2014-10-07 10:34:33 +02:00
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
if ${create};then
|
2015-02-13 15:17:00 +01:00
|
|
|
if ${iso_mode}; then
|
2015-03-05 10:50:45 +01:00
|
|
|
create_set "${sets_dir_iso}" "profile.conf"
|
2015-02-13 15:17:00 +01:00
|
|
|
else
|
|
|
|
create_set "${sets_dir_pkg}" "PKGBUILD"
|
|
|
|
fi
|
2014-11-16 23:18:01 +01:00
|
|
|
elif ${remove};then
|
2015-02-13 15:17:00 +01:00
|
|
|
if ${iso_mode}; then
|
|
|
|
remove_set "${sets_dir_iso}"
|
|
|
|
else
|
|
|
|
remove_set "${sets_dir_pkg}"
|
|
|
|
fi
|
2015-01-16 23:39:17 +01:00
|
|
|
elif ${show};then
|
2015-02-13 15:17:00 +01:00
|
|
|
if ${iso_mode}; then
|
|
|
|
show_set "${sets_dir_iso}"
|
|
|
|
else
|
|
|
|
show_set "${sets_dir_pkg}"
|
|
|
|
fi
|
2014-11-16 23:18:01 +01:00
|
|
|
else
|
2015-02-13 15:17:00 +01:00
|
|
|
if ${iso_mode}; then
|
|
|
|
msg "Available sets: $(load_sets ${sets_dir_iso})"
|
|
|
|
else
|
|
|
|
msg "Available sets: $(load_sets ${sets_dir_pkg})"
|
|
|
|
fi
|
|
|
|
fi
|