moved into main repo for pisi 2.0

This commit is contained in:
ayhanyalcinsoy
2015-06-19 13:37:40 +03:00
parent 9050f3df88
commit 217df81789
37 changed files with 2418 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
ownerships = {
"/run/cups" : "root:lp",
"/var/log/cups" : "root:lp",
}
CUPSD_CONFIG_FILE = "/etc/cups/cupsd.conf"
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
for directory,owners in ownerships.items():
if os.path.exists(directory):
os.system("chown %s %s" % (owners, directory))
# Replace possible pnpadmin leftover from cupsd.conf
if os.path.exists(CUPSD_CONFIG_FILE):
cupsd = open(CUPSD_CONFIG_FILE, "r").read()
open(CUPSD_CONFIG_FILE, "w").write(re.sub("pnpadmin", "lpadmin", cupsd))
+50
View File
@@ -0,0 +1,50 @@
from comar.service import *
import os
serviceType = "server"
serviceDefault = "on"
serviceDesc = _({"en": "CUPS Printer Server",
"tr": "CUPS Yazıcı Sunucusu"})
serviceConf = "cups"
PIDFILE = "/run/cups/cupsd.pid"
@synchronized
def start():
# FIXME: After avahi before hal
startDependencies("avahi")
# Load ppdev and lp drivers if wanted
if config.get("LOAD_LP_MODULE") == "yes":
os.system("/sbin/modprobe -q lp")
os.system("/sbin/modprobe -q ppdev")
startService(command="/usr/sbin/cupsd",
donotify=True)
os.system("pidof -o %PPID /usr/sbin/cupsd > " + PIDFILE)
# Tell udevd to replay printer events
# One for low-level usb
os.system("udevadm trigger --subsystem-match=usb \
--attr-match=bInterfaceClass=07 \
--attr-match=bInterfaceSubClass=01 \
--action=add")
# One for usblp backend
os.system("udevadm trigger --subsystem-match=usb \
--property-match=DEVNAME=\"/dev/usb/lp*\" \
--action=add")
@synchronized
def reload():
if os.path.exists(PIDFILE):
# 1 is SIGHUP
os.kill(int(open(PIDFILE, "r").read().strip()), 1)
@synchronized
def stop():
stopService(pidfile=PIDFILE, donotify=True)
if os.path.isfile(PIDFILE): os.unlink(PIDFILE)
def status():
return isServiceRunning(pidfile=PIDFILE)