1
0
mirror of https://github.com/msmhq/msm.git synced 2024-08-30 18:12:35 +00:00
Conflicts:
	msm.conf
This commit is contained in:
Matt Sicker 2012-09-01 10:01:51 -05:00
commit 58378250cf
13 changed files with 1135 additions and 481 deletions

@ -11,11 +11,94 @@ Maintainers:
Change Log
----------
### [0.8.11](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.10...0.8.11)
* Fixed issue [#76][#76], where tab completing "help" or "update" would exit the terminal.
* Made "help" and "update" reserved names to prevent clashing with server names.
[#76]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/76
### [0.8.10](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.9...0.8.10)
* Improved versioning to use the latest Minecraft version by default, and tell the user what's happening and how to control it themselves. Fixes issue [#79][#79].
* Improved install script to also create the default minecraft user, and the default install location directories.
[#79]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/79
### [0.8.9](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.8...0.8.9)
* Improved install script to update MSM without input
### [0.8.8](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.7...0.8.8)
* Added an MSM install script.
* Fixed bug in update code which prevent cleaning download directory.
### [0.8.7](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.6...0.8.7)
* Improved upon 0.8.6 to to prevent MSM complaing when not being invoked by either the "root" or MSM user.
### [0.8.6](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.5...0.8.6)
* Prevent script complaing that `This command must be executed as the user "root"` after every command. Fixes [#77][#77] and [#78][#78].
[#77]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/77
[#78]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/78
### [0.8.5](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.4...0.8.5)
* Fixed `msm update` output showing the "created files" section only when files were being *updated*.
### [0.8.4](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.3...0.8.4)
* Fixed logic in `msm update` which allowed MSM to think everything was already updated.
### [0.8.3](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.2...0.8.3)
* Fixed a bug in `msm update` checks, which caused a `command not found` error.
### [0.8.2](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.1...0.8.2)
* Improved `msm update` output to make more sense.
### [0.8.1](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.8.0...0.8.1)
* Added bash completion for `msm update`
* Improved `msm update` to work when upgrading from older versions, and handle updating the update code.
### [0.8.0](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.7.5...0.8.0)
* Added the `msm update` command, which downloads and installs new versions of MSM.
* Added the `msm-version` server config setting. Add this to `server.properties` to allow MSM to interact correctly with your server (e.g. `msm-version=minecraft/1.3.1`.)
* Removed all confirmation settings, such as `DEFAULT_CONFIRM_SAVE_ON` and `msm-confirm-save-all` etc, this functionality is handled by new [versioning files][versioning-files].
* Fixed issues [#43][#43], [#58][#58], [#59][#59], [#60][#60], [#61][#61], [#63][#63], [#67][#67] and [#68][#68]. By accomodating different Minecraft versions using versioning files.
[#43]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/43
[#58]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/58
[#59]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/59
[#60]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/60
[#61]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/61
[#63]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/63
[#67]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/67
[#68]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/68
[versioning-files]: https://github.com/marcuswhybrow/minecraft-server-manager/tree/master/versioning
### [0.7.5](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.7.4...0.7.5)
* Fixed issue [#69][#69] where pressing tab after `msm config` or `msm start` would disconnect the terminal session.
[#64]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/69
[#69]: https://github.com/marcuswhybrow/minecraft-server-manager/issues/69
### [0.7.4](https://github.com/marcuswhybrow/minecraft-server-manager/compare/0.7.3...0.7.4)

@ -2,6 +2,14 @@
A single init script which makes running multiple Minecraft/Bukkit servers easier for us admins.
## Quick Debian Install
Install MSM on a debian box using my install script:
wget -qO- http://git.io/KxE3HQ | sh
Have a read of the script first if calms you: http://git.io/KxE3HQ
## Getting Started
* [Install][install] MSM on your box.

@ -33,7 +33,7 @@ _msm() {
if [ -d "$SETTINGS_SERVER_STORAGE_PATH" ]; then
local servers="$(ls -1 "$SETTINGS_SERVER_STORAGE_PATH")"
fi
options="help start stop restart version server jargroup all config $servers"
options="help start stop restart version update server jargroup all config $servers"
else
case "${COMP_WORDS[1]}" in
stop|restart)
@ -68,7 +68,7 @@ _msm() {
esac
fi
;;
start|config)
start|config|help|update)
# Do nothing, just don't execute the server logic
;;
*)

1119
init/msm

File diff suppressed because it is too large Load Diff

47
install.sh Normal file

@ -0,0 +1,47 @@
echo "This script requires superuser access to install files to /etc."
echo "You will be prompted for your password by sudo."
# Clear existing sudo credentials
sudo -k
# run script as sudo
sudo sh <<SCRIPT
echo "\033[1;32mMSM INSTALL: Updating sources\033[m"
apt-get update
echo "\n\033[1;32mMSM INSTALL: Installing required packages\033[m"
apt-get install screen rsync zip
echo "\n\033[1;32mMSM INSTALL: Creating default user \"minecraft\"\033[m"
adduser --system minecraft
echo "\n\033[1;32mMSM INSTALL: Creating MSM directories\033[m"
mkdir -p /opt/msm
chown minecraft:minecraft /opt/msm
echo "\n\033[1;32mMSM INSTALL: Downloading latest MSM configuration file\033[m"
wget https://raw.github.com/marcuswhybrow/minecraft-server-manager/latest/msm.conf -O /etc/msm.conf
echo "\n\033[1;32mMSM INSTALL: Downloading latest MSM cron file\033[m"
wget https://raw.github.com/marcuswhybrow/minecraft-server-manager/latest/cron/msm -O /etc/cron.d/msm
service cron reload
echo "\n\033[1;32mMSM INSTALL: Downloading latest MSM version\033[m"
wget https://raw.github.com/marcuswhybrow/minecraft-server-manager/latest/init/msm -O /etc/init.d/msm
echo "\n\033[1;32mMSM INSTALL: Giving it the necessary permissions\033[m"
chmod 755 /etc/init.d/msm
echo "\n\033[1;32mMSM INSTALL: Enabling automatic startup and shutdown\033[m"
update-rc.d msm defaults
echo "\n\033[1;32mMSM INSTALL: Making MSM accessible as the command \"msm\"\033[m"
ln -s /etc/init.d/msm /usr/local/bin/msm
echo "\n\033[1;32mMSM INSTALL: Asking MSM to update itself\033[m"
/etc/init.d/msm update --noinput
echo "\n\033[1;32mMSM INSTALL: Done. Type \"msm help\" to get started. Have fun!\033[m"
SCRIPT

@ -24,6 +24,9 @@ SERVER_STORAGE_PATH="/opt/msm/servers"
# Where runnable jar files for use by servers are stored
JAR_STORAGE_PATH="/opt/msm/jars"
# Where versioning data is stored to help MSM accomodate all Minecraft versions
VERSIONING_STORAGE_PATH="/opt/msm/versioning"
# Where RAM enambled worlds are stored
# This needs to be a path located inside the mounted ramdisk for your system
@ -159,69 +162,3 @@ DEFAULT_MESSAGE_COMPLETE_BACKUP_STARTED="Backing up entire server."
# The default message to send to players when a serer finishes backing up the
# entire server directory:
DEFAULT_MESSAGE_COMPLETE_BACKUP_FINISHED="Backup complete."
# The message once logged confirms the "save-on" command has finished
DEFAULT_CONFIRM_SAVE_ON="CONSOLE: Enabl(ing|ed) level saving..|Turned on world auto-saving"
# The message once logged confirms the "save-off" command has finished
DEFAULT_CONFIRM_SAVE_OFF="CONSOLE: Disabl(ing|ed) level saving..|Turned off world auto-saving"
# The message once logged confirms the "save-all" command has finished
DEFAULT_CONFIRM_SAVE_ALL="CONSOLE: Save complete.|Saved the world"
# The message once logged confirms the server has started up
DEFAULT_CONFIRM_START="Done"
# The start of the message logged when a player is kicked successfully
DEFAULT_CONFIRM_KICK="CONSOLE: Kicking |Kicked "
# The start of the message logged when an attempt is made to kick an offline player
DEFAULT_CONFIRM_KICK_FAIL="Can't find user |That player cannot be found"
# The start of the message logged when the server time is set
DEFAULT_CONFIRM_TIME_SET="CONSOLE: Set time to|Set the time to "
# The start of the message logged when the server time cannot be set
DEFAULT_CONFIRM_TIME_SET_FAIL="Unable to convert time value|.+ is not a valid number"
# The start of the message logged when the server time is set
DEFAULT_CONFIRM_TIME_ADD="CONSOLE: Added .+ to time|Added .+ to the time"
# The start of the message logged when the server time cannot be set
DEFAULT_CONFIRM_TIME_ADD_FAIL="Unable to convert time value|.+ is not a valid number"
# The start of the message logged when downfall is toggled
DEFAULT_CONFIRM_TOGGLEDOWNFALL="CONSOLE: Toggling downfall (on|off) for world|Toggled downfall"
# The start of the message logged when the togglefownfall command is given a
# world name that does not exist
DEFAULT_CONFIRM_TOGGLEDOWNFALL_FAIL=".\[31m;1mNo world exists with the name"
# The message logged when an online user has their game mode changed
DEFAULT_CONFIRM_GAMEMODE="CONSOLE: Setting .+ to game mode (1|0)"
# The message logged when a player cannot be found when changing game mode
DEFAULT_CONFIRM_GAMEMODE_FAIL_NO_USER="Can't find user .+"
# The message logged when a player is already in the specified game mode
DEFAULT_CONFIRM_GAMEMODE_FAIL_NO_CHANGE=".+ already has game mode (1|0)"
# The message logged when a player is successfully given an entity
DEFAULT_CONFIRM_GIVE="CONSOLE: Giving .+ some .+ (.+)|Given .+"
# The message logged when a player cannot be found when using the give command
DEFAULT_CONFIRM_GIVE_FAIL_NO_USER="Can't find user .+|That player cannot be found"
# The message logged when an item ID or name is invalid
DEFAULT_CONFIRM_GIVE_FAIL_NO_ITEM="There's no item called .+|.+ is not a valid number"
# The message logged when a user is given experience
DEFAULT_CONFIRM_XP="CONSOLE: Giving .+ exp to .+"
# The message logged when giving experience, and the player name cannot be found
DEFAULT_CONFIRM_XP_FAIL_NO_USER="Can't find user .+"
# The message logged when the experience amount given is an invalid format
DEFAULT_CONFIRM_XP_FAIL_INVALID_AMOUNT="Invalid exp count: .+|.+ is not a valid number"

134
test.sh

@ -8,21 +8,21 @@ TMP_DIR="/tmp/msmtest"
TEST_RAM="256"
# Exit codes
declare -r EX_OK=0
declare -r EX_INVALID_USER=64
declare -r EX_INVALID_COMMAND=65
declare -r EX_INVALID_ARGUMENT=66
declare -r EX_SERVER_STOPPED=67
declare -r EX_SERVER_RUNNING=68
declare -r EX_NAME_NOT_FOUND=69
declare -r EX_FILE_NOT_FOUND=70
declare -r EX_DUPLICATE_NAME=71
declare -r EX_LOGS_NOT_ROLLED=72
declare -r EX_CONF_ERROR=73
EX_OK=0
EX_INVALID_USER=64
EX_INVALID_COMMAND=65
EX_INVALID_ARGUMENT=66
EX_SERVER_STOPPED=67
EX_SERVER_RUNNING=68
EX_NAME_NOT_FOUND=69
EX_FILE_NOT_FOUND=70
EX_DUPLICATE_NAME=71
EX_LOGS_NOT_ROLLED=72
EX_CONF_ERROR=73
oneTimeSetUp() {
# Variables used in tests
SCRIPT="${MSM_SCRIPT:-${DIR}/init/msm}"
TEST_SCRIPT="${MSM_TEST_SCRIPT:-${DIR}/init/msm}"
export MSM_CONF="${TMP_DIR}/msm.conf"
}
@ -31,6 +31,9 @@ setUp() {
# Create the testing conf from the default one
mkdir -p "$TMP_DIR" && chown "$USERNAME" "$TMP_DIR"
cp "$DEFUALT_CONF" "$MSM_CONF" && chown "$USERNAME" "$MSM_CONF"
# Coppy versioning files
cp -r "${DIR}/versioning" "${TMP_DIR}/versioning"
# Overwrite variables to use for testing purposes
echo "" >> "$MSM_CONF"
@ -38,6 +41,7 @@ setUp() {
echo "SERVER_STORAGE_PATH=\"${TMP_DIR}/servers\"" >> "$MSM_CONF"
echo "JAR_STORAGE_PATH=\"${TMP_DIR}/jars\"" >> "$MSM_CONF"
echo "RAMDISK_STORAGE_PATH=\"${TMP_DIR}/fakeramdisk\"" >> "$MSM_CONF"
echo "VERSIONING_STORAGE_PATH=\"${TMP_DIR}/versioning\"" >> "$MSM_CONF"
echo "WORLD_ARCHIVE_PATH=\"${TMP_DIR}/archives/worlds\"" >> "$MSM_CONF"
echo "LOG_ARCHIVE_PATH=\"${TMP_DIR}/archives/logs\"" >> "$MSM_CONF"
echo "BACKUP_ARCHIVE_PATH=\"${TMP_DIR}/archives/backups\"" >> "$MSM_CONF"
@ -46,7 +50,7 @@ setUp() {
echo "DEFAULT_SCREEN_NAME=\"msmtest-{SERVER_NAME}\"" >> "$MSM_CONF"
echo "DEFAULT_INVOCATION=\"java -Xmx${TEST_RAM}M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:+AggressiveOpts -jar {JAR} nogui\"" >> "$MSM_CONF"
source $SCRIPT
source $TEST_SCRIPT
# Variables accessible by all tests, which are set by the stdall, stderr,
# stdout and quiet utility functions.
@ -135,7 +139,7 @@ quiet() {
### "msm server list" tests
test_listing_no_servers() {
expect_stderr_empty $SCRIPT server list
expect_stderr_empty $TEST_SCRIPT server list
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
@ -144,7 +148,7 @@ test_listing_no_servers() {
test_reserved_server_names() {
manager_property SERVER_STORAGE_PATH
for name in "start" "stop" "restart" "server" "version" "jargroup" "all"; do
expect_stderr $SCRIPT server create $name
expect_stderr $TEST_SCRIPT server create $name
assertEquals "Incorrect exit code when creating server name \"$name\"." $EX_INVALID_ARGUMENT $EXIT_CODE
assertFalse "Server \"$name\" directory was created when it should not have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/$name\" ]"
done
@ -152,7 +156,7 @@ test_reserved_server_names() {
test_common_invalid_server_names() {
manager_property SERVER_STORAGE_PATH
expect_stderr $SCRIPT server create "name with spaces"
expect_stderr $TEST_SCRIPT server create "name with spaces"
assertEquals "Incorrect exit code when creating server name \"name with spaces\"." $EX_INVALID_ARGUMENT $EXIT_CODE
assertFalse "Server \"name with spaces\" directory was created when it should not have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/name with spaces\" ]"
}
@ -160,7 +164,7 @@ test_common_invalid_server_names() {
test_valid_edge_case_server_names() {
manager_property SERVER_STORAGE_PATH
for name in "serverstart" "CapitalLetters" "0987654321" "name-with-dashes" "name_with_underscores" "Combination-of_different1Things2"; do
expect_stderr_empty $SCRIPT server create $name
expect_stderr_empty $TEST_SCRIPT server create $name
assertEquals "Incorrect exit code when creating server name \"$name\"." $EX_OK $EXIT_CODE
assertTrue "Server \"$name\" directory was NOT created when it should have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/$name\" ]"
done
@ -168,7 +172,7 @@ test_valid_edge_case_server_names() {
test_creating_server_without_any_jargroups() {
manager_property SERVER_STORAGE_PATH
expect_stderr_empty $SCRIPT server create example
expect_stderr_empty $TEST_SCRIPT server create example
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
assertTrue "Server was not created." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/example\" ]"
}
@ -176,9 +180,9 @@ test_creating_server_without_any_jargroups() {
# Assumes: test_create_server_without_any_jargroups
test_creating_server_when_that_name_already_exists() {
# Create server "example"
quiet $SCRIPT server create example
quiet $TEST_SCRIPT server create example
# Create another server called "example", should be prevented
expect_stderr $SCRIPT server create example
expect_stderr $TEST_SCRIPT server create example
assertEquals "Incorrect exit code." $EX_DUPLICATE_NAME $EXIT_CODE
}
@ -187,12 +191,12 @@ test_creating_server_when_that_name_already_exists() {
test_creating_server_with_jar_groups() {
# Create the "minecraft" jar group, which is used by default when creating
# new servers.
quiet $SCRIPT jargroup create minecraft "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar"
quiet $TEST_SCRIPT jargroup create minecraft "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar"
# Create a new server that will use the "minecraft" jar group.
expect_stderr_empty $SCRIPT server create example
expect_stderr_empty $TEST_SCRIPT server create example
# Script must be sourced again to recognise the new server
source $SCRIPT
source $TEST_SCRIPT
manager_property SERVER_STORAGE_PATH
server_get_id "example"
@ -208,14 +212,14 @@ test_creating_server_with_jar_groups() {
### "msm server delete" tests
test_deleting_server_that_does_not_exist() {
expect_stderr $SCRIPT server delete example
expect_stderr $TEST_SCRIPT server delete example
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
}
# Assumes: test_creating_server_without_any_jargroups
test_deleting_server_that_exists_and_is_stopped() {
quiet $SCRIPT server create example
expect_stderr_empty $SCRIPT server delete example <<< "y"
quiet $TEST_SCRIPT server create example
expect_stderr_empty $TEST_SCRIPT server delete example <<< "y"
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
assertFalse "Server directory was not removed." "[ -d \"$SERVER_STORAGE_PATH/example\" ]"
@ -224,14 +228,14 @@ test_deleting_server_that_exists_and_is_stopped() {
### "msm server rename" tests
test_renaming_server_that_does_not_exist() {
expect_stderr $SCRIPT server rename example example_new_name
expect_stderr $TEST_SCRIPT server rename example example_new_name
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
}
# Assumes: test_creating_server_without_any_jargroups
test_renaming_server_that_exists_and_is_stopped() {
quiet $SCRIPT server create example
expect_stderr_empty $SCRIPT server rename example example_new_name
quiet $TEST_SCRIPT server create example
expect_stderr_empty $TEST_SCRIPT server rename example example_new_name
manager_property SERVER_STORAGE_PATH
@ -247,64 +251,64 @@ test_renaming_server_that_exists_and_is_stopped() {
### "msm <server> stop" tests
test_stopped_server_stop() {
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver stop
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver stop
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
### "msm <server> status" tests
test_stopped_server_status() {
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver status
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver status
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
### "msm <server> connected" tests
test_stopped_server_connected() {
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver connected
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver connected
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
### "msm <server> worlds list" tests
test_stopped_server_worlds_list_none() {
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver worlds list
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver worlds list
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
### "msm <server> worlds load" tests
test_stopped_server_worlds_load_none() {
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver worlds load
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver worlds load
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
### "msm <server> worlds ram" tests
test_stopped_server_worlds_ram_name_not_found() {
quiet $SCRIPT server create stoppedserver
expect_stderr $SCRIPT stoppedserver worlds ram non_existant_world_name
quiet $TEST_SCRIPT server create stoppedserver
expect_stderr $TEST_SCRIPT stoppedserver worlds ram non_existant_world_name
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
}
### "msm <server> worlds todisk" tests
test_stopped_server_worlds_todisk_none() {
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver worlds todisk
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver worlds todisk
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
### "msm <server> worlds backup" tests
test_stopped_server_worlds_todisk_none() {
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver worlds backup
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver worlds backup
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
@ -315,8 +319,8 @@ test_stopped_server_worlds_todisk_none() {
### "msm <server> logroll" tests
test_stopped_server_logroll_empty() {
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver logroll
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver logroll
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
@ -325,8 +329,8 @@ test_stopped_server_logroll_empty() {
test_stopped_server_backup() {
manager_property BACKUP_ARCHIVE_PATH
quiet $SCRIPT server create stoppedserver
expect_stdout $SCRIPT stoppedserver backup
quiet $TEST_SCRIPT server create stoppedserver
expect_stdout $TEST_SCRIPT stoppedserver backup
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
assertNotNull "Server backup was not created." "find '$SETTINGS_BACKUP_ARCHIVE_PATH/stoppedserver' -mindepth 1 -maxdepth 1 -type f -name '*.zip'"
}
@ -334,9 +338,9 @@ test_stopped_server_backup() {
### "msm <server> jar" tests
test_stopped_server_jar() {
quiet $SCRIPT server create stoppedserver
quiet $TEST_SCRIPT server create stoppedserver
source $SCRIPT
source $TEST_SCRIPT
server_get_id "stoppedserver"
local sid="$RETURN"
@ -347,10 +351,10 @@ test_stopped_server_jar() {
rm -f "$JAR_PATH"
# Create new jargroup
quiet $SCRIPT jargroup create newgroup "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar"
quiet $TEST_SCRIPT jargroup create newgroup "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar"
# Assign jargroup's latest jar to server
expect_stdout $SCRIPT stoppedserver jar newgroup
expect_stdout $TEST_SCRIPT stoppedserver jar newgroup
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
assertTrue "Server jar (${SERVER_JAR_PATH[$sid]}) was not linked." "[ -f \"${SERVER_JAR_PATH[$sid]}\" ]"
@ -501,14 +505,14 @@ test_stopped_server_jar() {
test_reserved_jargroup_names() {
for name in "start" "stop" "restart" "server" "version" "jargroup" "all"; do
expect_stderr $SCRIPT jargroup create "$name" https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
expect_stderr $TEST_SCRIPT jargroup create "$name" https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
assertEquals "Incorrect exit code when creating jar group name \"$name\"." $EX_INVALID_ARGUMENT $EXIT_CODE
assertFalse "Jar group \"$name\" directory was created when it should not have been." "[ -d \"$JAR_STORAGE_PATH/$name\" ]"
done
}
test_common_invalid_jargroups_names() {
expect_stderr $SCRIPT jargroup create "name with spaces" https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
expect_stderr $TEST_SCRIPT jargroup create "name with spaces" https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
assertEquals "Incorrect exit code when creating jar group name \"name with spaces\"." $EX_INVALID_ARGUMENT $EXIT_CODE
assertFalse "Jar group \"name with spaces\" directory was created when it should not have been." "[ -d \"$JAR_STORAGE_PATH/name with spaces\" ]"
}
@ -516,43 +520,43 @@ test_common_invalid_jargroups_names() {
test_valid_edge_case_jargroup_names() {
manager_property JAR_STORAGE_PATH
for name in "serverstart" "CapitalLetters" "0987654321" "name-with-dashes" "name_with_underscores" "Combination-of_different1Things2"; do
expect_stderr_empty $SCRIPT jargroup create $name https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
expect_stderr_empty $TEST_SCRIPT jargroup create $name https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
assertEquals "Incorrect exit code when creating jar group name \"$name\"." $EX_OK $EXIT_CODE
assertTrue "Jar group \"$name\" directory was NOT created when it should have been." "[ -d \"$SETTINGS_JAR_STORAGE_PATH/$name\" ]"
done
}
test_creating_jargroup() {
expect_stderr_empty $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
expect_stderr_empty $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
# Assumes: test_creating_jargroup
test_creating_jargroup_when_that_name_already_exists() {
quiet $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
expect_stderr $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
quiet $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
expect_stderr $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
assertEquals "Incorrect exit code." $EX_DUPLICATE_NAME $EXIT_CODE
}
### "msm jargroup list" test
test_listing_no_jargroups() {
expect_stderr_empty $SCRIPT jargroup list
expect_stderr_empty $TEST_SCRIPT jargroup list
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
# Assumes: test_creating_jargroup
test_listing_one_jargroup() {
quiet $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
expect_stderr_empty $SCRIPT jargroup list
quiet $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
expect_stderr_empty $TEST_SCRIPT jargroup list
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}
# Assumes: test_creating_jargroup
test_listing_multiple_jargroups() {
quiet $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
quiet $SCRIPT jargroup create craftbukkit http://dl.bukkit.org/latest-rb/craftbukkit.jar
expect_stderr_empty $SCRIPT jargroup list
quiet $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
quiet $TEST_SCRIPT jargroup create craftbukkit http://dl.bukkit.org/latest-rb/craftbukkit.jar
expect_stderr_empty $TEST_SCRIPT jargroup list
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
}

@ -0,0 +1,3 @@
# MSM version file for CraftBukkit 1.2.0 and above
extends "minecraft/1.2.0"

@ -0,0 +1,3 @@
# MSM version file for CraftBukkit 1.3.0 and above
extends "minecraft/1.3.0"

@ -0,0 +1,56 @@
# MSM version file for Minecraft 1.2.0 and above
console_event START:30 "Done"
console_command WHITELIST_ON "whitelist on"
console_command WHITELIST_OFF "whitelist off"
console_command WHITELIST_ADD "whitelist add <player>"
console_command WHITELIST_REMOVE "whitelist remove <player>"
console_command WHITELIST_LIST "whitelist list"
console_command WHITELIST_RELOAD "whitelist reload"
console_command BLACKLIST_PLAYER_ADD "ban <player>"
console_command BLACKLIST_PLAYER_REMOVE "pardon <player>"
console_command BLACKLIST_PLAYER_LIST "banlist"
console_command BLACKLIST_IP_ADD "ban-ip <address>"
console_command BLACKLIST_IP_REMOVE "pardon-ip <address>"
console_command BLACKLIST_IP_LIST "banlist ips"
console_command OP_ADD "op <player>"
console_command OP_REMOVE "deop <player>"
console_command GAMEMODE "gamemode <player> <mode>" \
"CONSOLE: Setting <player> to game mode (1|0)" \
"Can't find user <player>" \
"<player> already has game mode (1|0)"
console_command KICK "kick <player>" \
"CONSOLE: Kicking <player>" \
"Can't find user <player>"
console_command SAY "say <message>"
console_command TOGGLEDOWNFALL "toggledownfall" \
"CONSOLE: Toggling downfall (on|off) for world" \
"No world exists with the name"
console_command GIVE "give <player> <item> <amount> <damage>" \
"CONSOLE: Giving <player> some .+ (.+)" \
"Can't find user <player>" \
"There's no item called <item>"
console_command XP "xp <player> <amount>" \
"CONSOLE: Giving <amount> exp to <player>" \
"Can't find user <player>" \
"Invalid exp count: <amount>"
console_command CONNECTED "list" \
"Connected players:"
console_command TIME_SET "time set <time>" \
"CONSOLE: Set time to <time>" \
"Unable to convert time value"
console_command TIME_ADD "time add <time>" \
"CONSOLE: Added <time> to time" \
"Unable to convert time value"
console_command SAVE_ON "save-on" \
"CONSOLE: Enabling level saving.."
console_command SAVE_OFF "save-off" \
"CONSOLE: Disabling level saving.."
console_command SAVE_ALL:10 "save-all" \
"CONSOLE: Save complete."

@ -1,30 +0,0 @@
log-confirmations:
events:
start: "Done"
commands:
save-on: "CONSOLE: Enabling level saving.."
save-off: "CONSOLE: Disabling level saving.."
save-all: "CONSOLE: Save complete."
kick:
success: "CONSOLE: Kicking "
no-user: "Can't find user "
time:
set-success: "CONSOLE: Set time to"
set-format-error: "Unable to convert time value"
add-success: "CONSOLE: Added .+ to time"
add-format-error: "Unable to convert time value"
toggledownfall:
success: "CONSOLE: Toggling downfall on|off for world"
no-world: ".\[31m;1mNo world exists with the name"
gamemode:
success: "CONSOLE: Setting .+ to game mode (1|0)"
no-user: "Can't find user .+"
no-change: ".+ already has game mode (1|0)"
give:
success: "CONSOLE: Giving .+ some .+ (.+)"
no-user: "Can't find user .+"
no-item: "There's no item called .+"
xp:
success: "CONSOLE: Giving .+ exp to .+"
no-user: "Can't find user .+"
invalid-amount: "Invalid exp count: .+"

@ -0,0 +1,47 @@
# MSM version file for Minecraft 1.3.0 and above
extends "minecraft/1.2.0"
console_command GAMEMODE "gamemode <mode> <player>" \
"That player cannot be found" \
"The number you have entered (<mode>) is too big, it must be at most 2" \
"The number you have entered (<mode>) is too small, it must be at least 0" \
"'<mode>' is not a valid number"
console_command KICK "kick <player>" \
"Kicked <player> from the game" \
"That player cannot be found"
console_command TIME_SET "time set <time>" \
"Set the time to <time>" \
"The number you have entered (<time>) is too small, it must be at least 0" \
"'<time>' is not a valid number"
console_command TIME_ADD "time add <time>" \
"Added <time> to the time" \
"The number you have entered (<time>) is too small, it must be at least 0" \
"'<time>' is not a valid number"
console_command TOGGLEDOWNFALL "toggledownfall" \
"Toggled downfall"
console_command GIVE "give <player> <item> <amount> <damage>" \
"Given .+ (ID <item>) \* <amount> to <player>" \
"That player cannot be found" \
"'<item>' is not a valid number"
console_command XP "xp <amount> <player>" \
"Given <amount> experience to <player>" \
"That player cannot be found" \
"'<amount>' is not a valid number" \
"The number you have entered (<amount>) is too small, it must be at least 0"
console_command CONNECTED "list" \
"([^\ ]*)?(, [^\ ]+)*$" \
"$"
console_command SAVE_ON "save-on" \
"Turned on world auto-saving"
console_command SAVE_OFF "save-off" \
"Turned off world auto-saving"
console_command SAVE_ALL:10 "save-all" \
"Saved the world"

11
versioning/versions.txt Normal file

@ -0,0 +1,11 @@
# This file is a manifest of server versions MSM can handle.
# MSM downloads this file to check which versions are available
# for download, each line points to a versioning file.
# Vanilla Minecraft versions
minecraft/1.2.0
minecraft/1.3.0
# CraftBukkit versions
craftbukkit/1.2.0
craftbukkit/1.3.0