#!/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@ if [[ -r @libdir@/messages.sh ]];then source @libdir@/messages.sh fi if [[ -r @libdir@/build-api.sh ]];then source @libdir@/build-api.sh fi manjaro_tools_conf='@sysconfdir@/manjaro-tools.conf' if [[ -f ${manjaro_tools_conf} ]]; then source ${manjaro_tools_conf} fi if [[ -n ${profiledir} ]];then profiledir=${profiledir} else profiledir='@sysconfdir@/sets' fi run(){ if ${create};then create_set elif ${remove};then remove_set elif ${display};then display_set else msg "Available sets: ${profiles}" exit 1 fi } profiles=$(get_profiles) query=false create=false remove=false display=false name='default' usage() { echo "Usage: ${0##*/} [options]" echo " -c Create set" echo " -r Remove set" echo " -d Display set" echo " -q Query sets" echo ' -h This help' echo '' echo '' exit 1 } opts='c:r:d:qh' while getopts "${opts}" arg; do case "${arg}" in c) name="$OPTARG"; create=true ;; r) name="$OPTARG"; remove=true ;; q) query=true ;; d) name="$OPTARG"; display=true;; h) usage ;; esac done shift $(($OPTIND - 1)) if [[ $EUID != 0 ]]; then die 'This script must be run as root.' fi run $@