* Added script to build rpm for RH based distros

* Added spec file to create rpm (more work needs to be done)
* Making compatible Linux Actor with RH based distros
* A lot of work :)
This commit is contained in:
Adolfo Gómez García 2014-11-20 11:54:19 +01:00
parent 58e77aa4f3
commit 66653b0602
11 changed files with 104 additions and 11 deletions

1
actors/.gitignore vendored
View File

@ -5,3 +5,4 @@ udsactor*.build
udsactor*.changes
/udsactor_1.7.0.dsc
/udsactor_1.7.0.tar.xz
/udsactor-1.7.0-1.noarch.rpm

View File

@ -3,11 +3,12 @@
# Directories
SOURCEDIR := ../src
LIBDIR := $(DESTDIR)/usr/share/pyshared/UDSActor
LIBDIR := $(DESTDIR)/usr/share/UDSActor
BINDIR := $(DESTDIR)/usr/bin
SBINDIR = $(DESTDIR)/usr/sbin
APPSDIR := $(DESTDIR)/usr/share/applications
CFGDIR := $(DESTDIR)/etc/udsactor
INITDIR := $(DESTDIR)/etc/init.d
POLKITDIR := $(DESTDIR)/usr/share/polkit-1/actions/
XDGAUTOSTARTDIR := $(DESTDIR)/etc/xdg/autostart
KDEAUTOSTARTDIR := $(DESTDIR)/usr/share/autostart
@ -18,6 +19,7 @@ CACHES := $(shell find $(SOURCEDIR) -name '__pycache__')
clean:
rm -rf $(PYC) $(CACHES) $(DESTDIR)
install:
rm -rf $(DESTDIR)
mkdir -p $(LIBDIR)
mkdir -p $(BINDIR)
mkdir -p $(SBINDIR)
@ -57,10 +59,19 @@ install:
# Fix permissions
chmod 755 $(BINDIR)/udsactor
chmod 755 $(BINDIR)/UDSActorTool-startup
chmod 755 $(SBINDIR)/UDSActorConfig-pkexec
chmod 755 $(LIBDIR)/UDSActorConfig.py
chmod 755 $(LIBDIR)/UDSActorUser.py
chmod 644 $(POLKITDIR)/org.openuds.pkexec.UDSActorConfig.policy
# If for red hat based, copy init.d
ifeq ($(DISTRO),rh)
mkdir -p $(INITDIR)
cp debian/init $(INITDIR)/udsactor
ln -s /usr/share/UDSActor/UDSActorConfig.py $(SBINDIR)/UDSActorConfig
ln -s /usr/share/UDSActor/UDSActorUser.py $(BINDIR)/UDSActorTool
endif
# chmod 0755 $(BINDIR)/udsactor
uninstall:
rm -rf $(LIBDIR)

9
actors/linux/buildrpm.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
top=`pwd`
#rm -rf rpm
for folder in SOURCES BUILD RPMS SPECS SRPMS; do
mkdir -p rpm/$folder
done
rpmbuild -v -bb --clean --target noarch 'udsactor-1.7.0.spec' 2>&1

View File

@ -1,6 +1,6 @@
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: uds-actor
# Provides: udsactor
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
@ -9,7 +9,7 @@
### END INIT INFO
#
. /lib/lsb/init-functions
# . /lib/lsb/init-functions
case "$1" in
start|stop|restart)

View File

@ -1,2 +1,2 @@
/usr/share/pyshared/UDSActor/UDSActorConfig.py /usr/sbin/UDSActorConfig
/usr/share/pyshared/UDSActor/UDSActorUser.py /usr/bin/UDSActorTool
/usr/share/UDSActor/UDSActorConfig.py /usr/sbin/UDSActorConfig
/usr/share/UDSActor/UDSActorUser.py /usr/bin/UDSActorTool

View File

@ -6,3 +6,7 @@ Icon=/usr/share/pyshared/UDSActor/img/uds.png
Terminal=false
Type=Application
NoDisplay=true
X-KDE-autostart-after=panel
X-KDE-StartupNotify=false
X-DBUS-StartupType=Unique
X-KDE-UniqueApplet=true

View File

@ -1,4 +1,6 @@
#!/bin/sh
# Simple hack to wait for systray to be present
sleep 5
/usr/bin/UDSActorTool
# Exec tool
exec /usr/bin/UDSActorTool

View File

@ -1,6 +1,6 @@
#!/bin/sh
FOLDER=/usr/share/pyshared/UDSActor
FOLDER=/usr/share/UDSActor
cd $FOLDER
python -m udsactor.linux.UDSActorService $@

View File

@ -0,0 +1,59 @@
%define _topdir %(echo $PWD)/rpm
%define name udsactor
%define version 1.7.0
%define release 1
%define buildroot %{_topdir}/%{name}-%{version}-%{release}-root
BuildRoot: %{buildroot}
Name: %{name}
Version: %{version}
Release: %{release}
Summary: Actor for Universal Desktop Services (UDS) Broker
License: BSD3
Group: Admin
Requires: python-six python-requests PyQt4
%define _rpmdir ../
%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%install
curdir=`pwd`
cd ../..
make DESTDIR=$RPM_BUILD_ROOT DISTRO=rh install
cd $curdir
%clean
rm -rf $RPM_BUILD_ROOT
curdir=`pwd`
cd ../..
make DESTDIR=$RPM_BUILD_ROOT DISTRO=rh clean
cd $curdir
%post
#!/bin/sh
%preun
#!/bin/sh
%postun
#!/bin/sh
%description
This package provides the required components to allow this machine to work on an environment managed by UDS Broker.
%files
%defattr(-,root,root)
/etc/udsactor
/etc/xdg/autostart/UDSActorTool.desktop
/etc/init.d/udsactor
/usr/bin/UDSActorTool-startup
/usr/bin/udsactor
/usr/bin/UDSActorTool
/usr/sbin/UDSActorConfig
/usr/sbin/UDSActorConfig-pkexec
/usr/share/UDSActor/*
/usr/share/applications/UDS_Actor_Configuration.desktop
/usr/share/autostart/UDSActorTool.desktop
/usr/share/polkit-1/actions/org.openuds.pkexec.UDSActorConfig.policy

View File

@ -122,7 +122,10 @@ class Api(object):
self.mac = None
self.url = "{}://{}/rest/actor/".format(('http', 'https')[ssl], self.host)
self.secretKey = six.text_type(uuid.uuid4())
try:
self.newerRequestLib = 'verify' in requests.sessions.Session.__attrs__
except:
self.newerRequestLib = False
# Disable logging requests messages except for errors, ...
logging.getLogger("requests").setLevel(logging.ERROR)

View File

@ -44,7 +44,11 @@ from udsactor.linux.daemon import Daemon
from udsactor.linux import renamer
import sys
import prctl
try:
from prctl import set_proctitle
except Exception: # Platform may not include prctl, so in case it's not available, we let the "name" as is
def set_proctitle(_):
pass
class UDSActorSvc(Daemon, CommonService):
@ -79,7 +83,7 @@ class UDSActorSvc(Daemon, CommonService):
initCfg()
logger.debug('Running Daemon')
prctl.set_proctitle('UDSActorDaemon')
set_proctitle('UDSActorDaemon')
# Linux daemon will continue running unless something is requested to
if self.interactWithBroker() is False: