From c65b579e167c6fb265803b9b90a8e54b56b5a976 Mon Sep 17 00:00:00 2001 From: LinuxSquare Date: Mon, 26 Aug 2024 20:38:27 +0200 Subject: [PATCH] Initial dev commit --- config.json | 0 functions/configmgmt | 22 ++++++++++++ novos | 82 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 config.json create mode 100644 functions/configmgmt create mode 100755 novos diff --git a/config.json b/config.json new file mode 100644 index 0000000..e69de29 diff --git a/functions/configmgmt b/functions/configmgmt new file mode 100644 index 0000000..a5bc6aa --- /dev/null +++ b/functions/configmgmt @@ -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" +} diff --git a/novos b/novos new file mode 100755 index 0000000..879c58f --- /dev/null +++ b/novos @@ -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}) [...] +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