create core package
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from comar.service import *
|
||||
|
||||
import os
|
||||
|
||||
serviceType = "local"
|
||||
serviceDesc = _({"en": "Name Service Caching Daemon",
|
||||
"tr": "İsim Hizmeti Önbellek Sunucusu"})
|
||||
serviceDefault = "on"
|
||||
|
||||
|
||||
MSG_ERR_STRTSRVC = {"en": "Unable to start service.",
|
||||
"tr": "Servis başlatılamadı.",
|
||||
}
|
||||
|
||||
RUNDIR = "/var/run/nscd"
|
||||
DBDIR = "/var/db/nscd"
|
||||
|
||||
CONFFILE = "/etc/nscd.conf"
|
||||
PIDFILE = "%s/nscd.pid" % RUNDIR
|
||||
SOCKETFILE = "%s/socket" % RUNDIR
|
||||
|
||||
|
||||
@synchronized
|
||||
def start():
|
||||
if not os.path.exists(CONFFILE):
|
||||
fail(_(MSG_ERR_STRTSRVC))
|
||||
|
||||
for i in [RUNDIR, DBDIR]:
|
||||
if not os.path.exists(i):
|
||||
os.makedirs(i, mode=0755)
|
||||
|
||||
startService(command="/usr/sbin/nscd",
|
||||
pidfile=PIDFILE,
|
||||
detach=True)
|
||||
|
||||
@synchronized
|
||||
def stop():
|
||||
stopService(pidfile=PIDFILE,
|
||||
donotify=True)
|
||||
|
||||
# if nscd drops priviledges it can't delete these
|
||||
for i in [PIDFILE, SOCKETFILE]:
|
||||
if os.path.exists(i):
|
||||
os.unlink(i)
|
||||
|
||||
def status():
|
||||
return isServiceRunning(pidfile=PIDFILE)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#/usr/bin/python
|
||||
|
||||
import os
|
||||
|
||||
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
|
||||
if os.path.exists("/usr/sbin/iconvconfig"):
|
||||
# Generate fastloading iconv module configuration file.
|
||||
os.popen("/usr/sbin/iconvconfig --prefix=/")
|
||||
|
||||
# Reload init ...
|
||||
os.popen("/sbin/init U &> /dev/null")
|
||||
Reference in New Issue
Block a user