1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Some more fixes to add UDS User space tool at session startup under

gnome & kde (more tests to go)
This commit is contained in:
Adolfo Gómez García 2014-11-19 06:48:52 +01:00
parent 818c317724
commit 58e77aa4f3
10 changed files with 82 additions and 11 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Directories
SOURCEDIR := ../src
LIBDIR := $(DESTDIR)/usr/share/pyshared/UDSActor
BINDIR := $(DESTDIR)/usr/bin
@ -8,6 +9,9 @@ SBINDIR = $(DESTDIR)/usr/sbin
APPSDIR := $(DESTDIR)/usr/share/applications
CFGDIR := $(DESTDIR)/etc/udsactor
POLKITDIR := $(DESTDIR)/usr/share/polkit-1/actions/
XDGAUTOSTARTDIR := $(DESTDIR)/etc/xdg/autostart
KDEAUTOSTARTDIR := $(DESTDIR)/usr/share/autostart
PYC := $(shell find $(SOURCEDIR) -name '*.py[co]')
CACHES := $(shell find $(SOURCEDIR) -name '__pycache__')
@ -20,10 +24,14 @@ install:
mkdir -p $(APPSDIR)
mkdir -p $(CFGDIR)
mkdir -p $(POLKITDIR)
mkdir -p $(XDGAUTOSTARTDIR)
mkdir -p $(KDEAUTOSTARTDIR)
mkdir $(LIBDIR)/img
# Cleans up .pyc and cache folders
rm -f $(PYC) $(CACHES)
cp -r $(SOURCEDIR)/udsactor $(LIBDIR)/udsactor
cp $(SOURCEDIR)/img/uds.png $(LIBDIR)/img
@ -32,16 +40,23 @@ install:
cp $(SOURCEDIR)/setup_dialog_ui.py $(LIBDIR)
# Menu GUI app
cp UDS_Actor_Configuration.desktop $(APPSDIR)
# binaries
cp udsactor $(BINDIR)
cp UDSActorConfig-pkexec $(SBINDIR)
cp desktop/UDS_Actor_Configuration.desktop $(APPSDIR)
# Autostart elements for gnome/kde
cp desktop/UDSActorTool.desktop $(XDGAUTOSTARTDIR)
cp desktop/UDSActorTool.desktop $(KDEAUTOSTARTDIR)
# scripts
cp scripts/udsactor $(BINDIR)
cp scripts/UDSActorConfig-pkexec $(SBINDIR)
cp scripts/UDSActorTool-startup $(BINDIR)
# Policy to run as administrator
cp org.openuds.pkexec.UDSActorConfig.policy $(POLKITDIR)
cp policy/org.openuds.pkexec.UDSActorConfig.policy $(POLKITDIR)
# Fix permissions
chmod 755 $(BINDIR)/udsactor
chmod 755 $(BINDIR)/UDSActorTool-startup
chmod 755 $(LIBDIR)/UDSActorConfig.py
chmod 755 $(LIBDIR)/UDSActorUser.py
chmod 644 $(POLKITDIR)/org.openuds.pkexec.UDSActorConfig.policy

View File

@ -0,0 +1,8 @@
[Desktop Entry]
Name=UDS Actor Tool
Comment=UDS Actor Userspace tools
Exec=/usr/bin/UDSActorTool-startup
Icon=/usr/share/pyshared/UDSActor/img/uds.png
Terminal=false
Type=Application
NoDisplay=true

View File

@ -0,0 +1,4 @@
#!/bin/sh
sleep 5
/usr/bin/UDSActorTool

View File

@ -35,7 +35,7 @@ from __future__ import unicode_literals
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
import cPickle
import pickle
from udsactor import ipc
from udsactor import utils
from udsactor.log import logger
@ -88,7 +88,7 @@ class MessagesProcessor(QtCore.QThread):
elif msgId == ipc.MSG_SCRIPT:
self.script.emit(QtCore.QString.fromUtf8(data))
elif msgId == ipc.MSG_INFORMATION:
self.information.emit(cPickle.loads(data))
self.information.emit(pickle.loads(data))
except Exception as e:
try:
logger.error('Got error on IPC thread {}'.format(utils.exceptionToMessage(e)))
@ -152,7 +152,7 @@ if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
if not QtGui.QSystemTrayIcon.isSystemTrayAvailable():
QtGui.QMessageBox.critical(None, "Systray", "I couldn't detect any system tray on this system.")
# QtGui.QMessageBox.critical(None, "Systray", "I couldn't detect any system tray on this system.")
sys.exit(1)
trayIcon = UDSSystemTray(app)

View File

@ -35,6 +35,7 @@ from os.path import exists, join
CERTFILE = 'UDSActor.pem'
def createSelfSignedCert(force=False):
certFile = join(gettempdir(), CERTFILE)
@ -98,6 +99,3 @@ xtvM
f.write(certData)
return certFile
# At beginning, force certificate creation
createSelfSignedCert(force=True)

View File

@ -0,0 +1,46 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from __future__ import unicode_literals
import sys
from PyQt4 import QtGui
# Simple systray checker
# On startup, if our user app will need systray to be present, so we may give some time
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
if not QtGui.QSystemTrayIcon.isSystemTrayAvailable():
sys.exit(1)
sys.exit(0)