mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Sketched out the "jars remote create" option
This commit is contained in:
41
msm
41
msm
@ -12,15 +12,20 @@
|
|||||||
# Description:
|
# Description:
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
|
|
||||||
|
# See http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit for
|
||||||
|
# more information on debain init.d scripts, which may help you understand
|
||||||
|
# this script.
|
||||||
|
|
||||||
|
|
||||||
source "msm.config"
|
source "msm.config"
|
||||||
|
|
||||||
WHITELIST="white-list.txt"
|
WHITELIST="white-list.txt"
|
||||||
BANNED_IPS="banned-ips.txt"
|
BANNED_IPS="banned-ips.txt"
|
||||||
BANNED_PLAYERS="banned-players.txt"
|
BANNED_PLAYERS="banned-players.txt"
|
||||||
|
|
||||||
# See http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit for
|
JAR_REMOTE_TARGET="target.txt"
|
||||||
# more information on debain init.d scripts, which may help you understand
|
|
||||||
# this script.
|
|
||||||
|
|
||||||
### Utility Functions
|
### Utility Functions
|
||||||
|
|
||||||
@ -37,19 +42,39 @@ manager_create_server() {
|
|||||||
local regex="[a-zA-Z0-9\-_]+"
|
local regex="[a-zA-Z0-9\-_]+"
|
||||||
|
|
||||||
if [[ $1 =~ $regex ]]; then
|
if [[ $1 =~ $regex ]]; then
|
||||||
if [[ -e ${SERVER_STORAGE_PATH}/$1 ]]; then
|
if [[ -e $SERVER_STORAGE_PATH/$1 ]]; then
|
||||||
echo "A server with that name already exists."
|
echo "A server with that name already exists."
|
||||||
exit 1
|
exit 2
|
||||||
else
|
else
|
||||||
printf "Creating server directory... "
|
printf "Creating server directory... "
|
||||||
as_user "mkdir -p ${SERVER_STORAGE_PATH}/$1"
|
as_user "mkdir -p $SERVER_STORAGE_PATH/$1"
|
||||||
as_user "touch $SERVER_STORAGE_PATH/$1/$WHITELIST"
|
as_user "touch $SERVER_STORAGE_PATH/$1/$WHITELIST"
|
||||||
as_user "touch $SERVER_STORAGE_PATH/$1/$BANNED_IPS"
|
as_user "touch $SERVER_STORAGE_PATH/$1/$BANNED_IPS"
|
||||||
as_user "touch $SERVER_STORAGE_PATH/$1/$BANNED_PLAYERS"
|
as_user "touch $SERVER_STORAGE_PATH/$1/$BANNED_PLAYERS"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "Invalid name: may only contain letters, numbers, a dash or an underscore."
|
echo "Invalid name: may only contain letters, numbers, a dash or an underscore."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
manager_jars_remote_create() {
|
||||||
|
local regex="[a-zA-Z0-9\-_]+"
|
||||||
|
|
||||||
|
if [[ $1 =~ $regex ]]; then
|
||||||
|
if [[ -e $JAR_STORAGE_PATH/$1 ]]; then
|
||||||
|
echo "A remote with that name already exists."
|
||||||
|
exit 2
|
||||||
|
else
|
||||||
|
printf "Create a remote jar group... "
|
||||||
|
as_user "mkdir -p $JAR_STORAGE_PATH/$1"
|
||||||
|
as_user "echo \"$2\" > $JAR_STORAGE_PATH/$1/$JAR_REMOTE_TARGET"
|
||||||
|
echo "Done."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Invalid name: may only contain letters, numbers, a dash or an underscore."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +94,6 @@ case "$1" in
|
|||||||
create)
|
create)
|
||||||
# Create a new server
|
# Create a new server
|
||||||
manager_create_server $2
|
manager_create_server $2
|
||||||
|
|
||||||
;;
|
;;
|
||||||
delete)
|
delete)
|
||||||
# Delete an existing server, with confirmation
|
# Delete an existing server, with confirmation
|
||||||
@ -83,6 +107,7 @@ case "$1" in
|
|||||||
remote)
|
remote)
|
||||||
case "$3" in
|
case "$3" in
|
||||||
create)
|
create)
|
||||||
|
manager_jars_remote_create $4 $5
|
||||||
;;
|
;;
|
||||||
delete)
|
delete)
|
||||||
;;
|
;;
|
||||||
|
Reference in New Issue
Block a user