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
Version:        3.1.1.6
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
%{?systemd_requires}
%endif
%endif

# 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
%else
Requires:	xorg-x11
%endif
%endif
%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
%endif

# 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
%endif
%if "%{?_initddir}" == ""
%define _initddir %_initrddir
%endif

%description
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).

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

%build
# 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}

%install
# We have too much commands in this specfile. Most of this should have
# been done by make install.
b="%buildroot";
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/";
fi;

mkdir -p \
	"$b/%_localstatedir/lib/x2go" \
	"$b/%_localstatedir/spool/x2goprint";
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
EOF
mkdir -p "$b/%_sysconfdir/sudoers.d";
cat >"$b/%_sysconfdir/sudoers.d/x2go" <<-EOF
	%%x2gousers ALL=(ALL) NOPASSWD: /usr/bin/x2gopgwrapper
EOF
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{x2goserver}{x2gocleansessions}g;
	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
%endif

%pre
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 || :;
fi;
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 || :;
fi;
%if 0%{?_unitdir:1}
%service_add_pre x2gocleansessions.service
%endif

%post
%if 0%{?suse_version}
%if 0%{?suse_version} <= 1130
%run_permissions
%else
%set_permissions %_bindir/x2goprint %_libexecdir/x2go/x2gosqlitewrapper
%endif
%endif
db="%_localstatedir/lib/x2go/x2go_sessions";
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" || :;
fi;
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
%endif

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

%preun
%if 0%{?_unitdir:1}
%service_del_preun x2gocleansessions.service
%else
%if 0%{?suse_version}
%stop_on_removal
%endif
%endif

%postun 
%if 0%{?_unitdir:1}
%service_del_postun x2gocleansessions.service
%else
%if 0%{?suse_version}
%restart_on_update
%insserv_cleanup
%endif
%endif

%files
%defattr(-,root,root)
%config %_sysconfdir/X11/*
%exclude %_sysconfdir/X11/Xresources
%config %_sysconfdir/permissions.d/%name
%config %_sysconfdir/sudoers.d
%config %_sysconfdir/x2go
%_initddir/x2gocleansessions
%if 0%{?_unitdir:1}
%_unitdir
%else
/lib/systemd
%endif
%_bindir/x2gopath
%attr(02755,root,x2goprint) %_bindir/x2goprint
%_bindir/x2go[a-oq-z]*
%_libdir/x2go
%dir %_libexecdir/x2go
%attr(02755,root,x2gouser) %_libexecdir/x2go/x2gosqlitewrapper
%_libexecdir/x2go/x2go[c-rt-z]*
%_libexecdir/x2go/x2gosqlitewrapper.pl
%_libexecdir/x2go/x2gosuspend-agent
%_libexecdir/x2go/x2gosyslog
%_libexecdir/x2go/extensions
%_sbindir/x2go*
%_mandir/man8/x2go*
%_datadir/x2go
%attr(0775,root,x2gouser) %dir %_localstatedir/lib/x2go
%attr(0770,x2goprint,x2goprint) %_localstatedir/spool/x2goprint

%changelog