Initial dev commit

This commit is contained in:
LinuxSquare 2024-08-26 20:38:27 +02:00
commit c65b579e16
3 changed files with 104 additions and 0 deletions

0
config.json Normal file
View file

22
functions/configmgmt Normal file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
readonly CONFIG_ROOT="/srv/ansible"
function config_help() {
echo "Printing config help"
}
# Pulls all ansible playbooks from the remote git repo
function config_pull() {
echo "Pulling latest changes of repo"
}
# Executes an ansible-playbook on top.ansible.yml
function config_full() {
echo "Executing full playbook run"
}
# Execute on a single playbook ansible-playbook
function config_single() {
echo "Executing single playbook"
}

82
novos Executable file
View file

@ -0,0 +1,82 @@
#!/usr/bin/env bash
# CONSTANTS
readonly PKGVER="0.0.1"
readonly LICENSE="GNU AGPLv3"
readonly ROOTPATH="$(dirname $(readlink -f $(which ${0})))"
#readonly CONFIG="/usr/local/noveria/etc/novos/novos.json
readonly CONFIG="./config.json"
for util in ${ROOTPATH}/functions/*; do
source ${util}
done
# VARIABLES
declare debuglevel=3
function usage() {
cat << EOF
usage: $(basename ${0}) <operation> [...]
operations:
$(basename ${0}) {-h --help}
$(basename ${0}) {-V --version}
$(basename ${0}) {-v --verbose}
$(basename ${0}) {--init} [servername] [network name]
$(basename ${0}) {--datapack} [servername] [datapack dl url]
$(basename ${0}) {--start} [servername] [port] (ip)
$(basename ${0}) {--stop} [servername]
$(basename ${0}) {--restart} [servername] [port] (ip)
$(basename ${0}) {--attach} [servername]
$(basename ${0}) {--reset} [servername]
$(basename ${0}) {--delete} [servername]
EOF
}
function version() {
cat << EOF
Novos v${PKGVER}
Copyright (C) 2024 Noveria Network
This program may be freely redistributed under
the terms of the ${LICENSE}
EOF
}
###
## SCRIPT START
###
while true; do
case "${1}" in
-h|--help)
usage
exit 0
;;
-V|--version)
version
exit 0
;;
-v|--verbose)
debuglevel=4
break
;;
config)
parent="$1"
cmd="$2"
shift; shift
type ${parent}_${cmd} &> /dev/null
if [[ $? -eq 0 ]]; then
${parent}_${cmd} $@
exit 0
fi
${parent}_help
exit 1
;;
*)
echo "Invalid argument. Type $(basename $0) -h for help!"
exit 1
;;
esac
shift
done