61 lines
1.5 KiB
Bash
61 lines
1.5 KiB
Bash
#!/bin/bash
|
|
|
|
TITLE="DebMirror Manager"
|
|
VERSION="0.0.1"
|
|
URL="https://git.3volve.net.za/thisiszeev/debmirrorman"
|
|
AUTHOR="Ze'ev Schurmann"
|
|
AUTHORURL="https://reddit.com/u/thisiszeev"
|
|
|
|
source vars.lib.sh
|
|
source functions.lib.sh
|
|
source actions.lib.sh
|
|
|
|
if [[ -z "${1}" ]]; then
|
|
doHelper
|
|
exit
|
|
else
|
|
command="${1,,}"
|
|
if [[ -z "${commands[${command}]}" ]]; then
|
|
echo "Command ${1} not valid..."
|
|
exit 1
|
|
else
|
|
if [[ -n "${2}" ]]; then
|
|
if [[ "${commandsneedreponame[${command}]}" == "none" ]]; then
|
|
echo "Command ${1} does not support a repo name..."
|
|
exit 1
|
|
elif [[ "${commandsneedreponame[${command}]}" == "help" ]]; then
|
|
helpcommand="${2,,}"
|
|
if [[ -z "${commands[${helpcommand}]}" ]]; then
|
|
echo "Command ${2} not valid..."
|
|
exit 1
|
|
else
|
|
if [[ -z "${helpercommands[${helpcommand}]}" ]]; then
|
|
echo "No help documentation for command ${2}..."
|
|
exit 1
|
|
else
|
|
${helpercommands[${helpcommand}]}
|
|
exit
|
|
fi
|
|
fi
|
|
else
|
|
if funcCheckLocalRepo "${2}"; then
|
|
${commands[${command}]} "${2}"
|
|
exit
|
|
else
|
|
echo "Invalid local repo name..."
|
|
exit 1
|
|
fi
|
|
fi
|
|
else
|
|
if [[ "${commandsneedreponame[${command}]}" == "required" ]]; then
|
|
echo "Command ${1} requires a repo name..."
|
|
exit 1
|
|
else
|
|
${commands[${command}]}
|
|
exit
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
exit 127
|