summaryrefslogtreecommitdiff
blob: b579e6f8ad402e709a525244c4391e534afdb4c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/x2goserver/x2goserver-3.0.1.5.ebuild,v 1.3 2010/06/17 21:57:27 patrick Exp $

EAPI=1
inherit eutils versionator

MAJOR_PV="$(get_version_component_range 1-3)"
FULL_PV="${MAJOR_PV}-$(get_version_component_range 4)"
DESCRIPTION="The X2Go server"
HOMEPAGE="http://x2go.berlios.de"
SRC_URI="http://x2go.obviously-nice.de/deb/pool-lenny/${PN}/${PN}_${FULL_PV}_all.deb"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+fuse ldap postgres sqlite"

DEPEND=""
RDEPEND="app-admin/sudo
	dev-perl/Config-Simple
	net-misc/nx
	virtual/ssh
	fuse? ( sys-fs/sshfs-fuse )
	postgres? ( dev-db/postgresql-server )
	sqlite? ( dev-db/sqlite )"
# Still in the NX overlay for now
#	ldap? ( net-misc/x2goldaptools )"

S=${WORKDIR}

src_unpack() {
	unpack ${A}
	cd "${S}"

	tar xozf data.tar.gz || die "failure unpacking data.tar.gz"

	# Use nxagent directly
	sed -i -e "s/x2goagent/nxagent/" usr/bin/x2gostartagent || die "sed failed"

	if use sqlite ; then
		echo sqlite > etc/x2go/sql
	fi

	epatch "${FILESDIR}"/${PN}-mountdirs_no_desktop_icon.patch
}

src_install() {
	dobin usr/bin/*
	dosbin usr/sbin/*

	exeinto /usr/share/x2go/script
	doexe usr/lib/x2go/script/x2gocreatebase.sh
	doexe usr/lib/x2go/script/x2gosqlite.sh

	insinto /etc/x2go
	doins etc/x2go/sql
	doins etc/x2go/x2goserver.conf

	if use sqlite ; then
		einfo "creating x2go sqlite database directory /var/db/x2go"
		dodir /var/db/x2go
	fi

	if use postgres ; then
		newinitd "${FILESDIR}"/${PN}.init ${PN}
	fi
}

pkg_postinst() {
	if use postgres ; then
		elog "To work, x2goserver needs a configured postgreSQL database"
		elog "	echo -n local > /etc/x2go/sql"
		elog "Sample script to create the database can be found here:"
		elog "    /usr/share/x2go/script/x2gocreatebase.sh"
	fi
	if use sqlite ; then
		elog "To work, x2goserver needs a configured sqlite database"
		elog "Sample script to create the database can be found here:"
		elog "    /usr/share/x2go/script/x2gosqlite.sh"
	fi
	einfo ""
	elog "You also need to give sudo rights on x2gopgwrapper to your users"
	elog "A sudoers example for all members of the group users:"
	elog "    %users ALL=(ALL) NOPASSWD: /usr/bin/x2gopgwrapper"
	elog "To give only a special group access to the x2goserver, "
	elog "change %users to any other group"
}