Merge pull request #81 from jjchico/migration_cleanup

Small config migration code clean-up
This commit is contained in:
Jason M. Wood 2015-07-13 16:31:13 -06:00
commit 8abc406349

31
mscs
View File

@ -1714,6 +1714,21 @@ migrateOldMSCSConfig() {
fi
}
# ---------------------------------------------------------------------------
# Migrate all worlds from old-style MSCS configuration if necessary.
# ---------------------------------------------------------------------------
migrateWorldsConfig() {
if [ ! -f "$WORLDS_LOCATION/mscs-worlds-config-migrated" ]; then
echo "Migrating worlds to new mscs.properties config file if needed"
for WORLD in $(getAvailableWorlds); do
migrateOldMSCSConfig "$WORLD"
done
execute "touch '$WORLDS_LOCATION/mscs-worlds-config-migrated'" $USER_NAME
echo "Remove file '$WORLDS_LOCATION/mscs-worlds-config-migrated' to repeat"
echo "the migration process in the next execution."
fi
}
# ---------------------------------------------------------------------------
# Migrate old disabled worlds if any.
# ---------------------------------------------------------------------------
@ -1748,20 +1763,12 @@ migrateOldDisabledWorlds() {
# Only root or $USER_NAME should execute this script
checkPermission
# Migrate config of not already migrated worlds
migrateWorldsConfig
# Migrate old version's disabled worlds if any
migrateOldDisabledWorlds
# Migrate config of not already migrated worlds
if [ ! -f "$WORLDS_LOCATION/mscs-worlds-config-migrated" ]; then
echo "Migrating worlds to new mscs.properties config file if needed"
for WORLD in $(getAvailableWorlds); do
migrateOldMSCSConfig "$WORLD"
done
execute "touch '$WORLDS_LOCATION/mscs-worlds-config-migrated'" $USER_NAME
echo "Remove file '$WORLDS_LOCATION/mscs-worlds-config-migrated' to repeat"
echo "the migration process in the next execution."
fi
# Make sure that Java, Perl, Python, Wget, Rdiff-backup, and Socat are installed.
if [ ! -e "$JAVA" ]; then
printf "ERROR: Java not found!\n"
@ -1801,8 +1808,6 @@ if [ ! -e "$SOCAT" ]; then
fi
# Respond to the command line arguments.
case "$1" in
start)