blob: 5d432a113bbbbb9b2c2d5bf53d794f464785df25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# -*- coding: utf-8 -*-
import logging, mv_common
import os, re
config_file = "mv_config"
def setup_ddns(systemconfig):
if mv_common.read_config(mv_common.module_config,"ddns") == False :
logging.info("____Skipping of DDNS, config disabled____")
return
logging.info("____Start of setup_ddns____")
if systemconfig.get("DDnsEnable") == "1":
logging.debug(" Enabling DDNS")
mv_common.pacinstall("ddclient")
mv_common.cp_and_log("/etc/ddclient/ddclient.conf.dynamic.dyndns.sample",
"/etc/ddclient/ddclient.conf")
cmd = ''' sed -i -e "s/your-dynamic-dyndns-login/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig.get("DDnslogin"))
mv_common.runcmd(cmd)
cmd = ''' sed -i -e "s/your-dynamic-dyndns-password/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig.get("DDnspassword"))
mv_common.runcmd(cmd)
cmd = ''' sed -i -e "s/your-dynamic-dyndns-host/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig.get("DDnshostname"))
mv_common.runcmd(cmd)
mv_common.add_service("ddclient")
else:
logging.debug(" Disabling DDNS")
mv_common.remove_service("ddclient")
logging.info("__End of ddns\n")
|