/[gentoo-x86]/net-misc/neatx/neatx-0.3.1_p59-r2.ebuild
Gentoo

Contents of /net-misc/neatx/neatx-0.3.1_p59-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Mar 14 05:20:27 2011 UTC (8 years, 11 months ago) by wormo
Branch: MAIN
  Protect custom $NX_HOME_DIR/.ssh/authorized_keys from being clobbered
  by an upgrade/reinstall (bug #339366)

(Portage version: 2.1.9.42/cvs/Linux x86_64)

1 wormo 1.1 # Copyright 1999-2011 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3     # $Header: /var/cvsroot/gentoo-x86/net-misc/neatx/neatx-0.3.1_p59-r1.ebuild,v 1.3 2010/10/05 21:09:47 maekke Exp $
4    
5     EAPI="2"
6    
7     PYTHON_DEPEND="2"
8     inherit eutils autotools distutils
9    
10     DESCRIPTION="Google implementation of NX server"
11     HOMEPAGE="http://code.google.com/p/neatx/"
12     SRC_URI="mirror://gentoo/${P}.tar.bz2"
13    
14     LICENSE="GPL-2"
15     SLOT="0"
16     KEYWORDS="~amd64 ~x86"
17     IUSE=""
18    
19     DEPEND="dev-python/docutils"
20     RDEPEND="dev-python/pexpect
21     dev-python/simplejson
22     >=dev-python/pygtk-2.14
23     >=dev-python/pygobject-2.14
24     app-portage/portage-utils
25     media-fonts/font-misc-misc
26     media-fonts/font-cursor-misc
27     || ( net-analyzer/gnu-netcat
28     net-analyzer/netcat
29     net-analyzer/netcat6 )
30     net-misc/nx"
31    
32     S=${WORKDIR}/${PN}
33    
34     pkg_setup () {
35     # configure script looks for latest python2 only,
36     # no multiple versions support
37     python_set_active_version 2
38    
39     if [ -z "${NX_HOME_DIR}" ];
40     then
41     export NX_HOME_DIR=/var/lib/neatx/home
42     fi
43     enewuser nx -1 -1 ${NX_HOME_DIR}
44     }
45    
46     src_prepare() {
47     sed -i -e "s/rst2html]/rst2html.py]/" configure.ac \
48     || die "configure.ac sed failed"
49     sed -e "s#/lib/neatx#/neatx#" \
50     -e "/^docdir/s#\$(PACKAGE)#${PF}#" \
51     -i Makefile.am \
52     || die "Makefile.am sed failed"
53     sed -e "/DATA_DIR =/s#/lib/neatx#/neatx#" \
54     -i lib/constants.py || die "constants.py sed failed"
55    
56     eautoreconf
57     }
58    
59     src_compile() {
60     default_src_compile
61     # Scripts are automatically generated, fix them here
62     python_convert_shebangs 2 src/nx*
63     }
64    
65     src_install() {
66     emake install DESTDIR="${D}" || die "Failed to install"
67     fperms 777 /var/lib/neatx/sessions
68     dodir ${NX_HOME_DIR}/.ssh
69     fowners nx:nx ${NX_HOME_DIR}
70     fowners nx:nx ${NX_HOME_DIR}/.ssh
71    
72     insinto /etc
73     newins doc/neatx.conf.example neatx.conf
74    
75     # nc or netcat6 or netcat?
76     if has_version net-analyzer/gnu-netcat; then
77     nc_path="/usr/bin/netcat"
78     elif has_version net-analyzer/netcat6; then
79     nc_path="/usr/bin/nc6"
80     else
81     nc_path="/usr/bin/nc"
82     fi
83     cat >> "${D}"/etc/neatx.conf << EOF
84    
85     netcat-path = ${nc_path}
86     use-xsession = false
87     start-gnome-command = /etc/X11/Sessions/Gnome
88     EOF
89    
90     insinto /usr/share/neatx
91     insopts -m 600 -o nx
92     newins extras/authorized_keys.nomachine authorized_keys.nomachine
93    
94     insinto ${NX_HOME_DIR}/.ssh
95     insopts -m 600 -o nx
96     newins extras/authorized_keys.nomachine authorized_keys
97    
98     # protect ssh key from getting clobbered by future upgrade (bug #339366)
99     echo "CONFIG_PROTECT=\"${NX_HOME_DIR}\"" > "${T}/60${PN}"
100     doenvd "${T}/60${PN}"
101     }
102    
103     pkg_preinst () {
104     # preserve custom ssh key if present (bug #339366)
105     # CONFIG_PROTECT entry created above will only work for future emerges,
106     # not the current one (until bug #276345 gets fixed)
107     if [ -e "${ROOT}/${NX_HOME_DIR}/.ssh/authorized_keys" ] ; then
108     einfo "Preserving existing ssh key: ${NX_HOME_DIR}/.ssh/authorized_keys"
109     insinto ${NX_HOME_DIR}/.ssh
110     insopts -m 600 -o nx
111     newins "${ROOT}/${NX_HOME_DIR}/.ssh/authorized_keys" authorized_keys
112     fi
113     }
114    
115     pkg_postinst () {
116     distutils_pkg_postinst
117    
118     # Other NX servers ebuilds may have already created the nx account
119     # However they use different login shell/home directory paths
120     if [[ ${ROOT} == "/" ]]; then
121     usermod -s /usr/$(get_libdir)/neatx/nxserver-login nx || die "Unable to set login shell of nx user!!"
122     usermod -d ${NX_HOME_DIR} nx || die "Unable to set home directory of nx user!!"
123     else
124     elog "If you had another NX server installed before, please make sure"
125     elog "the nx user account is correctly set to:"
126     elog " * login shell: /usr/$(get_libdir)/neatx/nxserver-login"
127     elog " * home directory: ${NX_HOME_DIR}"
128     fi
129    
130     if has_version net-misc/openssh[-pam]; then
131     elog ""
132     elog "net-misc/openssh was not built with PAM support"
133     elog "You will need to unlock the nx account by setting a password for it"
134     fi
135    
136     elog "If you want to use the default su authentication (rather than ssh)"
137     elog "you must ensure that the nx user is a member of the wheel group."
138     elog "You can add it via \"usermod -a -G wheel nx\""
139     }

  ViewVC Help
Powered by ViewVC 1.1.20