Compare commits

...

2 commits

Author SHA1 Message Date
2a532d29e3 fix missing opt_long 2025-04-03 22:08:06 +02:00
9490c876e6 Add plugin function 2025-04-03 22:06:28 +02:00
2 changed files with 19 additions and 3 deletions

11
pms-cli
View file

@ -23,6 +23,7 @@ operations:
$(basename ${0}) {-v --verbose}
$(basename ${0}) {--init} [servername] [network name]
$(basename ${0}) {--datapack} [servername] [datapack dl url]
$(basename ${0}) {--plugin} [servername] [plugin dl url]
$(basename ${0}) {--start} [servername] [port] (ip)
$(basename ${0}) {--stop} [servername]
$(basename ${0}) {--restart} [servername] [port] (ip)
@ -33,8 +34,8 @@ operations:
function version() {
echo -e "Minecraft Podman Server v${PKGVER}
Copyright (C) 2024 Noveria Network
Copyright (C) 2025 Noveria Network
This program may be freely redistributed under
the terms of the ${LICENSE}"
}
@ -44,7 +45,7 @@ the terms of the ${LICENSE}"
###
OPT_SHORT="hVv"
OPT_LONG="help,version,verbose,init:,datapack:,start:,stop:,restart:,attach:,reset:,delete:"
OPT_LONG="help,version,verbose,init:,datapack:,plugin:,start:,stop:,restart:,attach:,reset:,delete:"
TEMP=$(getopt -o ${OPT_SHORT} --long ${OPT_LONG} -n $(basename ${0}) -- "$@")
if [ "$?" != 0 ]; then
@ -75,6 +76,10 @@ while true; do
shift
datapack "${1}" "${3}"
;;
--plugin)
shift
plugin "${1}" "${3}"
;;
--start)
shift
start "${1}" "${3}" "${4}"

11
utils/plugin Normal file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
function plugin() {
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
log e "Directory '${1}' does not exist!"
exit 1
fi
local dir="$(getValueByKey 'PODMAN_DIRECTORY')/${1}/data/plugins"
curl -L "${2}" -o "${dir}/($(echo ${2} | awk -F/ '{print $NF}')"
}