mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
minetest updated
This commit is contained in:
parent
a950e159a8
commit
7c8b1235e7
@ -30,6 +30,17 @@ from plinth import action_utils
|
||||
CONFIG_FILE = '/etc/minetest/minetest.conf'
|
||||
AUG_PATH = '/files' + CONFIG_FILE + '/.anon'
|
||||
|
||||
def load_augeas():
|
||||
"""Initialize Augeas."""
|
||||
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
||||
augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||
aug.set('/augeas/load/Php/lens', 'Php.lns')
|
||||
aug.set('/augeas/load/Php/incl[last() + 1]', CONFIG_FILE)
|
||||
aug.load()
|
||||
return aug
|
||||
|
||||
aug = load_augeas()
|
||||
|
||||
def parse_arguments():
|
||||
"""Return parsed command line arguments as dictionary"""
|
||||
parser = argparse.ArgumentParser()
|
||||
@ -37,11 +48,11 @@ def parse_arguments():
|
||||
|
||||
configure = subparsers.add_parser('configure', help='Configure Minetest')
|
||||
configure.add_argument('--max_players', help='Set maximum number of players')
|
||||
configure.add_argument('--creative_mode',choices=['true', 'false'],
|
||||
configure.add_argument('--creative_mode', choices=['true', 'false'],
|
||||
help='Set creative mode true/false')
|
||||
configure.add_argument('--enable_pvp',choices=['true', 'false'],
|
||||
configure.add_argument('--enable_pvp', choices=['true', 'false'],
|
||||
help='Set player Vs player true/false')
|
||||
configure.add_argument('--enable_damage',choices=['true', 'false']
|
||||
configure.add_argument('--enable_damage', choices=['true', 'false'],
|
||||
help='Set damage true/false')
|
||||
|
||||
return parser.parse_args()
|
||||
@ -56,51 +67,35 @@ def subcommand_configure(arguments):
|
||||
enable_pvp(arguments.enable_pvp)
|
||||
if arguments.enable_damage:
|
||||
enable_damage(arguments.enable_damage)
|
||||
action_utils.service_restart('minetest-server')
|
||||
|
||||
def set_max_players(max_players):
|
||||
"""Sets the number of max players"""
|
||||
aug = load_augeas()
|
||||
|
||||
aug.set(AUG_PATH + '/max_users', max_players)
|
||||
|
||||
aug.save()
|
||||
action_utils.service_restart('minetest')
|
||||
|
||||
def enable_pvp(choice):
|
||||
def enable_pvp(choice):
|
||||
"""Enables pvp"""
|
||||
aug = load_augeas()
|
||||
|
||||
aug.set(AUG_PATH + '/enable_pvp', choice)
|
||||
|
||||
aug.save()
|
||||
action_utils.service_restart('minetest')
|
||||
|
||||
def set_creative_mode(choice):
|
||||
"""Enables or disables creative mode"""
|
||||
aug = load_augeas()
|
||||
|
||||
aug.set(AUG_PATH + '/creative_mode', choice)
|
||||
|
||||
aug.save()
|
||||
action_utils.service_restart('minetest')
|
||||
|
||||
def enable_damage(choice):
|
||||
"""Enables damage"""
|
||||
aug = load_augeas()
|
||||
|
||||
aug.set(AUG_PATH + '/enable_damage', choice)
|
||||
|
||||
aug.save()
|
||||
action_utils.service_restart('minetest')
|
||||
|
||||
def load_augeas():
|
||||
"""Initialize Augeas."""
|
||||
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
||||
augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||
aug.set('/augeas/load/Php/lens', 'Php.lns')
|
||||
aug.set('/augeas/load/Php/incl[last() + 1]', CONFIG_FILE)
|
||||
aug.load()
|
||||
return aug
|
||||
|
||||
def main():
|
||||
"""Parse arguments and perform all duties"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user