LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File x2goserver.spec of Package x2goserver (Project X11:RemoteDesktop:x2go)

# spec file for package x2goserver
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/

Name:           x2goserver
Release:        0
License:        GPL-2.0+
Group:          Productivity/Networking/Remote Desktop
Summary:        X2go tools for session administration
Url:            http://x2go.org/

#DL-URL:	http://code.x2go.org/releases/source/x2goserver/
#Git-Clone:	git://code.x2go.org/x2goserver
#Git-Web:	http://code.x2go.org/gitweb?p=x2goserver.git;a=summary
Source:         %name-%version.tar.gz
Source2:        %name-%version.tar.gz.asc
Source3:	%name-rpmlintrc
Source4:	x2gocleansessions.service
Patch1:		x2gopath.diff
# Was in an old x2goserver packages. Still needed?
#Patch??:       x2goserver-sqlite3.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:	man2html xz
%if "%{?_vendor}" == "suse"
BuildRequires:	fdupes
%if 0%{?suse_version} >= 1210
BuildRequires:	systemd

# bindir:
# x2golistdesktops -> ls, grep, xwininfo
# x2gomountdirs -> ln, mount, sshfs
# x2goprint -> su
# x2goterminate -> kill
# x2goresume-session -> awk, kill, cat
# x2goruncommand -> basename, kill
# x2goruncommand -> canoneof(firefox,iceweasel,abrowser,konqueror,galeon,chromium-browser)
# x2goruncommand -> canoneof(thunderbird,icedove,kmail,evolution)
# x2goruncommand -> canoneof(loffice,ooffice)
# x2goruncommand -> canoneof(konsole,gnome-terminal,lxterminal,rxvt,xterm)
# x2goserver-run-extensions -> find
# x2gosetkeyboard -> cat, cut, egrep, head, tail, setxkbmap
# x2goshowblocks -> lsof, grep, su
# x2gostartagent -> awk, date, mcookie, perl, sed, xauth, xwininfo, x2goagent
# x2gosuspendsession -> awk, killall
# x2goterminate-session -> awk, kill, sleep, rm
# x2goumount-session -> fusermount, canoneof(kdialog,zenity)
# x2goversion -> cat, egrep, head, cut, ls
# sbindir:
# x2gocleansessions -> tail, hostname, su
# x2godbadmin -> makepasswd
# x2golistsessions_root -> tail, su
# libexecdir/x2go:
# nothing new.
# - sudo is NOT used, you can grep the source for that.
Requires:	gawk, coreutils, findutils, grep
Requires:	sed, sshfs, util-linux
Requires:	fuse, psmisc, lsof
Requires:	xorg-x11-xauth
Requires:	makepasswd

Requires:	perl(Config::Simple), perl(Cwd), perl(DBD::SQLite) >= 1.27
Requires:	perl(DBD::Pg), perl(DBI), perl(File::BaseDir)
Requires:	perl(File::Basename), perl(File::Copy), perl(File::Path)
Requires:	perl(Getopt::Long)
Requires:	perl(Sys::Hostname), perl(Sys::Syslog) >= 0.14
Requires:	perl(POSIX)

Requires:	x2goagent
## openssh?
%if 0%{?suse_version}
Requires(pre):	pwdutils
BuildRequires:	pwdutils
PreReq:		permissions
Requires:	iproute2 perl-base util-linux
%if 0%{?suse_version} >= 1220
Requires:	setxkbmap xmessage xwininfo
Requires:	xorg-x11
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
Requires(pre):	shadow-utils
Requires(pre):	shadow-utils
Requires:	iproute perl xorg-x11-fonts-misc xorg-x11-utils which

# No need for DBD::Pg here because only the SQLite DB is created in %post
Requires(post):	perl(Config::Simple), perl(DBD::SQLite), perl(DBI)
BuildRequires:	perl(Config::Simple), perl(DBD::SQLite), perl(DBI)

%if "%{?sles_version}" == "11"
# libexecdir is set to %_exec_prefix/%_lib. What gives?
%define _libexecdir %_exec_prefix/lib
%if "%{?_initddir}" == ""
%define _initddir %_initrddir

X2go is a "server based computing environment" combining the
advantages of different existing solutions. This package contains the
main daemon and tools for session administrations (scripts).

%if 0%{?__xz:1}
%setup -q
tar -xf "%{S:0}" --use=xz;
%setup -DTq
%patch -P 1 -p1

# Distro-specific.
perl -i -pe '
	s{^lib\x29.*}{lib\x29 echo -n "%_libdir/x2go";;};
	s{^libexec\x29.*}{libexec\x29 echo -n "%_libexecdir/x2go";;};
	s{^xinerama\x29.*}{xinerama\x29 echo -n "%_libexecdir/NX3/%_lib/Xinerama";;};
' x2goserver/bin/x2gopath;
chmod a+x x2goserver/bin/x2gopath;
make %{?_smp_mflags}

# We have too much commands in this specfile. Most of this should have
# been done by make install.
make install DESTDIR="%buildroot" \
	PREFIX="%_prefix" LIBDIR="%_libexecdir/x2go" \
	INSTALL_DIR="install -dm0755" \
	INSTALL_FILE="install -pm0644" \
	INSTALL_PROGRAM="install -pm0755"
mkdir -p "$b/%_libdir/x2go";
if [ "%_libexecdir" != "%_libdir" ]; then
	mv "$b/%_libexecdir/x2go"/*.pm "$b/%_libdir/x2go/";

mkdir -p \
	"$b/%_localstatedir/lib/x2go" \
find "$b" -type f -exec chmod u-s "{}" "+" -exec chmod g-s "{}" "+";
find "$b" -type f -name ".*" -size 0 -delete;
mkdir -p "$b/%_sysconfdir/permissions.d";
cat >"$b/%_sysconfdir/permissions.d/%name" <<-EOF
	%_bindir/x2goprint	root:x2goprint	02755
	%_libexecdir/x2go/x2gosqlitewrapper	root:x2gouser	02755
mkdir -p "$b/%_sysconfdir/sudoers.d";
cat >"$b/%_sysconfdir/sudoers.d/x2go" <<-EOF
	%%x2gousers ALL=(ALL) NOPASSWD: /usr/bin/x2gopgwrapper
mkdir -p "$b/%_sysconfdir/X11/Xsession.d";
# Ignoring this file again in %files so as to jump over
# "ERROR: link target for /etc/x2go/Xresources not found"
touch "$b/%_sysconfdir/X11/Xresources";
mkdir -p "$b/%_initddir";
install -pm0755 debian/x2goserver.init "$b/%_initddir/x2gocleansessions";
perl -i -pe '
	s{Default-Start:.*}{Default-Start:	3 5}g;
	s{Default-Stop:.*}{Default-Stop:	0 1 2 6}g;
' "$b/%_initddir/x2gocleansessions";
mkdir -p "$b/lib/systemd/system";
install -pm0644 "%{SOURCE3}" "$b/lib/systemd/system/";
mkdir -p "$b/%_localstatedir/lib/x2go";

%if "%{?fdupes:fdupes}" != ""
%fdupes %buildroot

if ! /usr/bin/getent group x2gouser >/dev/null 2>/dev/null && \
   /usr/sbin/groupadd -r x2gouser; then
	/usr/bin/getent passwd x2gouser >/dev/null 2>/dev/null || \
	/usr/sbin/useradd -c "X2go server/user" -d %_localstatedir/lib/x2go \
		-g x2gouser -r -s /bin/false x2gouser || :;
if ! /usr/bin/getent group x2goprint >/dev/null 2>/dev/null && \
   /usr/sbin/groupadd -r x2goprint; then
	/usr/bin/getent passwd x2goprint >/dev/null 2>/dev/null || \
	/usr/sbin/useradd -c "X2go server/print" \
		-d %_localstatedir/spool/x2goprint \
		-g x2goprint -r -s /bin/false x2goprint || :;
%if 0%{?_unitdir:1}
%service_add_pre x2gocleansessions.service

%if 0%{?suse_version}
%if 0%{?suse_version} <= 1130
%set_permissions %_bindir/x2goprint %_libexecdir/x2go/x2gosqlitewrapper
if test ! -e "$db"; then
	"%_sbindir/x2godbadmin" --create;
	# Uff. Ignore return codes to make rpmlint's test %%post run succeed.
	chgrp x2gouser "$db" || :;
	chmod ug=rw "$db" || :;
echo "NOTE: You do not need to edit /etc/sudoers. This is already done by this package providing a /etc/sudoers.d/x2go file.";
echo "NOTE: Users permitted to use X2go should be put into the \"x2gousers\" group.";
%if 0%{?_unitdir:1}
%service_add_post x2gocleansessions.service

%if 0%{?suse_version}
%verify_permissions -e %_bindir/x2goprint %_libexecdir/x2go/x2gosqlitewrapper

%if 0%{?_unitdir:1}
%service_del_preun x2gocleansessions.service
%if 0%{?suse_version}

%if 0%{?_unitdir:1}
%service_del_postun x2gocleansessions.service
%if 0%{?suse_version}

%config %_sysconfdir/X11/*
%exclude %_sysconfdir/X11/Xresources
%config %_sysconfdir/permissions.d/%name
%config %_sysconfdir/sudoers.d
%config %_sysconfdir/x2go
%if 0%{?_unitdir:1}
%attr(02755,root,x2goprint) %_bindir/x2goprint
%dir %_libexecdir/x2go
%attr(02755,root,x2gouser) %_libexecdir/x2go/x2gosqlitewrapper
%attr(0775,root,x2gouser) %dir %_localstatedir/lib/x2go
%attr(0770,x2goprint,x2goprint) %_localstatedir/spool/x2goprint