moved into main for pisi 2.0

This commit is contained in:
2015-07-04 15:12:13 +03:00
parent 3b48e10776
commit b88266550d
35 changed files with 2498 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
from comar.service import *
serviceType = "server"
serviceDesc = _({"en": "DHCP Daemon",
"tr": "DHCP Servisi"})
serviceConf = "dhcpd"
MSG_NM_NOT_RUNNING = _({"en": "NetworkManager service is not running",
"tr": "NetworkManager hizmeti çalışmıyor",
})
PIDFILE = "/run/dhcpd.pid"
TIMEOUT = config.get("TIMEOUT", 10)
@synchronized
def start():
try:
startDependencies("NetworkManager")
# Prevent race condition between NM and dhcpd
if run("/usr/bin/nm-online -q -t %s" % TIMEOUT) != 0:
# NM is not running
fail(MSG_NM_NOT_RUNNING)
except:
pass
startService(command="/usr/sbin/dhcpd",
args="-cf %s %s %s" % (config.get("DHCPD_CONF", "/etc/dhcp/dhcpd.conf"), config.get("DHCPD_ARGS", ""), config.get("INTERFACES", "")),
pidfile=PIDFILE,
donotify=True)
@synchronized
def stop():
stopService(pidfile=PIDFILE,
donotify=True)
def status():
return isServiceRunning(PIDFILE)
+39
View File
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
from comar.service import *
serviceType = "server"
serviceDesc = _({"en": "DHCPv6 Daemon",
"tr": "DHCPv6 Servisi"})
serviceConf = "dhcpd6"
MSG_NM_NOT_RUNNING = _({"en": "NetworkManager service is not running",
"tr": "NetworkManager hizmeti çalışmıyor",
})
PIDFILE = "/run/dhcpd6.pid"
TIMEOUT = config.get("TIMEOUT", 10)
@synchronized
def start():
try:
startDependencies("NetworkManager")
# Prevent race condition between NM and dhcpd
if run("/usr/bin/nm-online -q -t %s" % TIMEOUT) != 0:
# NM is not running
fail(MSG_NM_NOT_RUNNING)
except:
pass
startService(command="/usr/sbin/dhcpd",
args="-6 -cf %s %s %s" % (config.get("DHCPD_CONF", "/etc/dhcp/dhcpd.conf"), config.get("DHCPD_ARGS", ""), config.get("INTERFACES", "")),
pidfile=PIDFILE,
donotify=True)
@synchronized
def stop():
stopService(pidfile=PIDFILE,
donotify=True)
def status():
return isServiceRunning(PIDFILE)
+24
View File
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from comar.service import *
serviceType = "server"
serviceDesc = _({"en": "DHCP Relay Server",
"tr": "DHCP Relay Servisi"})
serviceConf = "dhcrelay"
pidfile = "/run/dhcrelay.pid"
@synchronized
def start():
startService(command="/usr/sbin/dhcrelay",
args="%s %s" % (config.get("DHCPD_ARGS", ""), config.get("INTERFACES", "")),
donotify=True)
@synchronized
def stop():
stopService(command="/usr/sbin/dhcpd",
pidfile=pidfile,
donotify=True)
def status():
return isServiceRunning(pidfile)
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/python
import os
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
if not os.path.exists("/var/lib/dhcpd/dhcpd.leases"):
os.system("/bin/touch /var/lib/dhcpd/dhcpd.leases")
if not os.path.exists("/var/lib/dhcpd/dhcpd6.leases"):
os.system("/bin/touch /var/lib/dhcpd/dhcpd6.leases")