mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
bind: Move setup to action script
This commit is contained in:
parent
aded0f6be0
commit
95265426a9
16
actions/bind
16
actions/bind
@ -32,6 +32,7 @@ def parse_arguments():
|
||||
"""Return parsed command line arguments as dictionary"""
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||
subparsers.add_parser('setup', help='Setup for BIND')
|
||||
|
||||
configure = subparsers.add_parser('configure', help='Configure Minetest')
|
||||
configure.add_argument('--set-forwarding', choices=['true', 'false'],
|
||||
@ -42,6 +43,21 @@ def parse_arguments():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def subcommand_setup(_):
|
||||
"""Setup BIND configuration."""
|
||||
f = open(CONFIG_FILE, "r")
|
||||
contents = f.readlines()
|
||||
f.close()
|
||||
|
||||
contents.insert(0, value1)
|
||||
contents.insert(4, value2)
|
||||
contents.insert(15, value3)
|
||||
|
||||
f = open(CONFIG_FILE, "w")
|
||||
contents = "".join(contents)
|
||||
f.write(contents)
|
||||
f.close()
|
||||
|
||||
def subcommand_configure(arguments):
|
||||
"""Configure BIND."""
|
||||
|
||||
|
||||
@ -113,22 +113,12 @@ def diagnose():
|
||||
results.append(action_utils.diagnose_port_listening(53, 'udp6'))
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def default_config():
|
||||
"""Initialize config file for BIND"""
|
||||
"""Setp BIND configuration"""
|
||||
actions.superuser_run('bind', ['setup'])
|
||||
f = open(CONFIG_FILE, "r")
|
||||
contents = f.readlines()
|
||||
f.close()
|
||||
|
||||
contents.insert(0, value1)
|
||||
contents.insert(4, value2)
|
||||
contents.insert(15, value3)
|
||||
|
||||
f = open(CONFIG_FILE, "w")
|
||||
contents = "".join(contents)
|
||||
f.write(contents)
|
||||
f.close()
|
||||
|
||||
|
||||
def get_default():
|
||||
"""Get initial value for forwarding"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user