Python3 switch and systemd boot
This commit is contained in:
parent
a2b5bb5f10
commit
e516a65b68
2
debian/postinst
vendored
2
debian/postinst
vendored
|
@ -20,7 +20,7 @@ set -e
|
|||
|
||||
case "$1" in
|
||||
configure)
|
||||
update-rc.d mediaserver defaults
|
||||
systemctl enable mediaserver.service
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
|
|
2
debian/prerm
vendored
2
debian/prerm
vendored
|
@ -19,7 +19,7 @@ set -e
|
|||
|
||||
case "$1" in
|
||||
remove|upgrade|deconfigure)
|
||||
update-rc.d -f mediaserver remove
|
||||
systemctl disable mediaserver.service
|
||||
;;
|
||||
|
||||
failed-upgrade)
|
||||
|
|
12
lib/systemd/system/mediaserver.service
Normal file
12
lib/systemd/system/mediaserver.service
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Start Mediaserver
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/startx /usr/sbin/mediaserver
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
KillMode=process
|
||||
TimeoutSec=infinity
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
major=4 # Major version
|
||||
minor=0 # Minor version
|
||||
micro=0 # Bugfix version
|
||||
|
||||
# code to generate version string from above data
|
||||
version_string = "{0}.{1}.{2}".format(major,minor,micro)
|
|
@ -1,7 +1,7 @@
|
|||
import dbus
|
||||
import dbus.service
|
||||
import dbus.mainloop.glib
|
||||
import event
|
||||
from . import event
|
||||
|
||||
class NoConnectionError(Exception):
|
||||
pass
|
||||
|
@ -70,7 +70,7 @@ class DBusSmartObject:
|
|||
def _initialize_new_connection(self):
|
||||
# test if service is available on the selected bus. Skip otherwise
|
||||
if self._dbus_object.NameHasOwner(self._service, dbus_interface=self._dbus_interface):
|
||||
print "Initializing new connection to {0}".format(self._service)
|
||||
print("Initializing new connection to {0}".format(self._service))
|
||||
|
||||
self._bus = dbus.Bus(self._bus_type)
|
||||
self.busobject = self._bus.get_object(self._service, self._object_path)
|
||||
|
@ -82,7 +82,7 @@ class DBusSmartObject:
|
|||
else:
|
||||
self._beenconnected = True
|
||||
else:
|
||||
print "Could not create connection to {0}".format(self._service)
|
||||
print("Could not create connection to {0}".format(self._service))
|
||||
# bus object is not available - so disconnect the bus
|
||||
|
||||
if self._bus is not None:
|
||||
|
@ -91,7 +91,7 @@ class DBusSmartObject:
|
|||
|
||||
def _close_existing_connection(self):
|
||||
if self._bus is not None:
|
||||
print "Lost connection to {0}".format(self._service)
|
||||
print("Lost connection to {0}".format(self._service))
|
||||
#self._bus.close()
|
||||
self._bus = None
|
||||
self.busobject = None
|
||||
|
@ -109,7 +109,7 @@ class DBusSmartObject:
|
|||
self._initialize_new_connection()
|
||||
|
||||
def call(self,method, *args, **kwargs):
|
||||
if kwargs.has_key("interface"):
|
||||
if "interface" in kwargs:
|
||||
interface = kwargs["interface"]
|
||||
else:
|
||||
interface = self._interface
|
||||
|
@ -132,8 +132,8 @@ class DBusSmartObject:
|
|||
default = None
|
||||
try:
|
||||
return self.call(method, *args, **kwargs)
|
||||
except NoConnectionError as x:
|
||||
print "Could not call {0} because there is currently no connection to {1}".format(method,self._service)
|
||||
except NoConnectionError:
|
||||
print("Could not call {0} because there is currently no connection to {1}".format(method,self._service))
|
||||
return default
|
||||
|
||||
def connected(self):
|
||||
|
|
2
sbin/mediaserver
Normal file → Executable file
2
sbin/mediaserver
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
import mediaserver.mediaserver
|
||||
|
||||
mediaserver.mediaserver.Run()
|
10
setup.py
10
setup.py
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
'''KHMedia applications.
|
||||
Includes scheduled recorder, music player, sound level meter and a webcam viewer
|
||||
|
@ -7,7 +7,6 @@ Includes scheduled recorder, music player, sound level meter and a webcam viewer
|
|||
from distutils.core import setup
|
||||
from distutils.extension import Extension
|
||||
from glob import glob
|
||||
from mediaserver import VERSION
|
||||
|
||||
# patch distutils if it's too old to cope with the "classifiers" or
|
||||
# "download_url" keywords
|
||||
|
@ -20,7 +19,7 @@ if version < '2.2.3':
|
|||
if __name__ == '__main__':
|
||||
setup(
|
||||
name = 'mediaserver',
|
||||
version = VERSION.version_string,
|
||||
version = "4.0.5",
|
||||
description = 'Mediacore mediaserver',
|
||||
long_description = __doc__,
|
||||
author = 'Miqra Engineering',
|
||||
|
@ -39,13 +38,12 @@ if __name__ == '__main__':
|
|||
'Topic :: Multimedia :: Sound/Audio :: Players',
|
||||
],
|
||||
packages=['mediaserver'],
|
||||
package_data={'mediaserver': ['image/*', ]},
|
||||
package_data={'mediaserver': ['images/*', ]},
|
||||
data_files = [
|
||||
# note that some files are forced to /usr/share/... instead of just share/..
|
||||
# this is because the system does not look in /usr/local/share/... for those files, but only in /usr/share/...
|
||||
('/usr/share/mediaserver', glob('usr-share-mediaserver/*')),
|
||||
('/etc/dbus-1/system.d', glob('etc/dbus-1/system.d/*')),
|
||||
('/etc/init.d', glob('etc/init.d/*')),
|
||||
('/lib/systemd/system', glob('lib/systemd/system/*')),
|
||||
('bin', glob('bin/*')),
|
||||
('sbin', glob('sbin/*')),
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue
Block a user