#!/bin/bash TITLE="DebMirror Manager" VERSION="0.0.3" URL="https://git.3volve.net.za/thisiszeev/debmirrorman" LICENSE="GPL 3" AUTHOR="Ze'ev Schurmann" AUTHORURL="https://reddit.com/u/thisiszeev" source vars.lib.sh source functions.lib.sh source actions.lib.sh if funcValidateSettings; then source "${etcdirectory}/settings.conf" else funcError "Unknown error loading '${etcdirectory}/settings.conf'..." 29 fi if [[ -z "${1}" ]]; then doHelper exit else command="${1,,}" if [[ -z "${commands[${command}]}" ]]; then funcError "Command '${1}' not valid..." 1 else if [[ -n "${2}" ]]; then if [[ "${commandsneedreponame[${command}]}" == "none" ]]; then funcError "Command '${1}' does not support a repo name..." 2 elif [[ "${commandsneedreponame[${command}]}" == "help" ]]; then helpcommand="${2,,}" # if [[ -z "${commands[${helpcommand}]}" ]]; then # funcError "Command '${2}' not valid..." 11 # else if [[ -z "${helpercommands[${helpcommand}]}" ]]; then funcError "No help documentation for command '${2}'..." 12 else ${helpercommands[${helpcommand}]} | less exit fi # fi else funcCheckLocalRepo "${2}" ec=$? if [[ ${ec} == 0 ]]; then ${commands[${command}]} "${2}" exit elif [[ ${ec} == 1 ]]; then funcError "Repo name '${2}' not valid..." 4 elif [[ ${ec} == 2 ]]; then funcError "Repo name '${2}' is not found in '${etcdirectory}/settings.conf'..." 5 elif [[ ${ec} == 3 ]]; then funcError "File '${etcdirectory}/${repo}.repo' does not exist..." 6 else funcError "Unknown error with local repo '${2}'..." 9 fi fi else if [[ "${commandsneedreponame[${command}]}" == "required" ]]; then funcError "Command '${1}' requires a repo name..." 3 else ${commands[${command}]} exit fi fi fi fi funcError "Unknown error with DebMirror Manager..." 127