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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# -*- coding: utf-8 -*-
import logging, os
import commands
config_file = "mv_config"
data_config = __import__(config_file, globals(), locals(), [])
def runcmd(cmd):
if data_config.NOOPDEBUG=="FALSE":
pass
else:
cmd = "echo "+cmd
logging.debug(" %s",cmd)
cmdout = commands.getoutput(cmd)
logging.debug(" %s",cmdout)
return cmdout
def services(systemconfig):
logging.debug("______Start of services______")
logging.debug("__End services")
def cp_and_log(srcfile,destfile):
#return
if not os.path.exists(srcfile):
logging.info("%s is not present, skipping...",srcfile)
else:
cmd = ("rsync -arhp %s %s") %(srcfile,destfile)
runcmd(cmd)
def add_service(daemon):
logging.info(" Adding service %s",daemon)
def remove_service(daemon):
logging.info(" Removing service %s",daemon)
def pacinstall(pkg):
logging.info(" Installing %s",pkg)
#extra pkg check
if pkg == "xine":
pacinstall("xine-ui")
elif pkg == "dvdcss":
pacinstall("libdvdcss")
elif pkg == "webmin":
add_service("webmin")
def pacremove(pkg):
logging.info(" Removing %s",pkg)
if pkg == "xine":
pacremove("xine-ui")
elif pkg == "dvdcss":
pacremove("libdvdcss")
elif pkg == "webmin":
remove_service("webmin")
def reloadfe():
logging.info(" Reloading frontend")
logging.info(" LOOK Reloading frontend")
#function reloadfe(){
#PID=`ps -ef |grep mythfrontend|grep -v grep |awk '{print $2 }'`
#/usr/bin/backend_control.sh clearcache behost $dbhost
#if [ x$RESTART_LCD = xtrue ]
#then
#killall -9 mythlcdserver
#fi
#if [ x = x$PID ]
#then
#echo "Mythfrontend not running, will not reload"
#else
#kill -s USR1 $PID
#fi
return
def restartfe():
logging.info(" Restarting frontend")
cmd="killall -9 mythfrontend"
runcmd(cmd)
cmd="killall -9 welcome"
runcmd(cmd)
return
def udev_trigger():
logging.info(" Triggering udev")
cmd = "udevadm settle"
runcmd(cmd)
cmd = "udevadm trigger"
runcmd(cmd)
cmd = "udevadm settle"
runcmd(cmd)
cmd = "udevadm trigger"
runcmd(cmd)
|