Annotation of /branches/R11-stable/extras/nxserver-freenx/nxserver-freenx-0.7.3-r5.smage2
Parent Directory | Revision Log
Revision 17715 -
(hide annotations)
(download)
Tue Jun 25 15:01:22 2013 UTC (11 years, 3 months ago) by niro
Original Path: trunk/extras/nxserver-freenx/nxserver-freenx-0.7.3-r5.smage2
File size: 8713 byte(s)
Tue Jun 25 15:01:22 2013 UTC (11 years, 3 months ago) by niro
Original Path: trunk/extras/nxserver-freenx/nxserver-freenx-0.7.3-r5.smage2
File size: 8713 byte(s)
-added patch to fix some timeout races and fix preinstall messages
1 | niro | 17715 | # $Id$ |
2 | |||
3 | PNAME="nxserver-freenx" | ||
4 | PVER="0.7.3" | ||
5 | PBUILD="r5" | ||
6 | |||
7 | PCAT="net-misc" | ||
8 | |||
9 | DESCRIPTION="A free NX server implementation." | ||
10 | HOMEPAGE="http://freenx.berlios.de/" | ||
11 | |||
12 | # binutils is only needed for the strings binary! | ||
13 | DEPEND=">= net-misc/nxcomp-3.5 | ||
14 | >= net-misc/nxcompsh-3.5 | ||
15 | >= net-misc/nxcompshad-3.5 | ||
16 | >= net-misc/nxcompext-3.5 | ||
17 | >= net-misc/nxlibs-3.5 | ||
18 | >= net-misc/nxagent-3.5 | ||
19 | >= net-misc/openssh-6 | ||
20 | >= dev-util/expect-5.43 | ||
21 | >= sys-apps/gawk-1.3.5 | ||
22 | >= net-misc/netcat-0.7.1 | ||
23 | >= net-misc/rdesktop-1 | ||
24 | >= virtual/vnc-client | ||
25 | >= x11-apps/sessreg-1 | ||
26 | >= x11-apps/xauth-1 | ||
27 | >= x11-apps/xdm-1 | ||
28 | >= x11-apps/xrdb-1 | ||
29 | >= x11-apps/xmessage-1 | ||
30 | >= media-fonts/font-misc-misc-1 | ||
31 | >= media-fonts/font-cursor-misc-1 | ||
32 | >= sys-dev/binutils-2.18 | ||
33 | >= sys-apps/coreutils-8 | ||
34 | >= sys-apps/util-linux-2.20" | ||
35 | |||
36 | SDEPEND=">= sys-apps/sed-4 | ||
37 | >= x11-misc/imake-1 | ||
38 | >= x11-misc/gccmakedep-1" | ||
39 | |||
40 | PROVIDE="virtual/nxprint | ||
41 | virtual/nxnode | ||
42 | virtual/nxserver" | ||
43 | |||
44 | SRCFILE="freenx-server-${PVER}.tar.gz" | ||
45 | SRCDIR="${BUILDDIR}/freenx-server-${PVER}" | ||
46 | |||
47 | sminclude mtools | ||
48 | |||
49 | SRC_URI=( | ||
50 | http://download.berlios.de/freenx/${SRCFILE} | ||
51 | mirror://${PNAME}/${SRCFILE} | ||
52 | mirror://${PNAME}/${PNAME}-${PVER}-lp-fixes.patch | ||
53 | mirror://${PNAME}/${PNAME}-${PVER}-nxredir.patch | ||
54 | mirror://${PNAME}/${PNAME}-${PVER}-generate-ssh-keys.patch | ||
55 | mirror://${PNAME}/${PNAME}-${PVER}-nxdialog.patch | ||
56 | mirror://${PNAME}/${PNAME}-${PVER}-nxipp.patch | ||
57 | mirror://${PNAME}/${PNAME}-${PVER}-nxpath.patch | ||
58 | mirror://${PNAME}/${PNAME}-${PVER}-dpi.patch | ||
59 | mirror://${PNAME}/${PNAME}-${PVER}-agent-version.patch | ||
60 | mirror://${PNAME}/${PNAME}-${PVER}-prefer-xmessage.patch | ||
61 | mirror://${PNAME}/${PNAME}-${PVER}-increase-base-ports.patch | ||
62 | mirror://${PNAME}/${PNAME}-${PVER}-nxprint-warnings.patch | ||
63 | mirror://${PNAME}/${PNAME}-${PVER}-ignore-system-nxloadconfig.patch | ||
64 | mirror://${PNAME}/${PNAME}-${PVER}-agent-startup.patch | ||
65 | mirror://${PNAME}/nxclient-wrapper | ||
66 | mirror://${PNAME}/freenx.service | ||
67 | mirror://${PNAME}/freenx.logrotate | ||
68 | mirror://${PNAME}/freenx-check-setup.sh | ||
69 | ) | ||
70 | |||
71 | UP2DATE="updatecmd_berlios freenx freenx-server" | ||
72 | |||
73 | src_prepare() | ||
74 | { | ||
75 | munpack ${SRCFILE} || die | ||
76 | cd ${SRCDIR} | ||
77 | # upstream patches from launchpad | ||
78 | mpatch ${PNAME}-${PVER}-lp-fixes.patch || die | ||
79 | # fix installation of nxredir | ||
80 | mpatch ${PNAME}-${PVER}-nxredir.patch || die | ||
81 | # auto generate missing ssh keys | ||
82 | mpatch ${PNAME}-${PVER}-generate-ssh-keys.patch || die | ||
83 | # only use dialog when xterm is installed | ||
84 | mpatch ${PNAME}-${PVER}-nxdialog.patch || die | ||
85 | # fix ipp handling | ||
86 | mpatch ${PNAME}-${PVER}-nxipp.patch || die | ||
87 | # fix path handling with symlinks | ||
88 | mpatch ${PNAME}-${PVER}-nxpath.patch || die | ||
89 | # make the default DPI configurable through node.conf | ||
90 | mpatch ${PNAME}-${PVER}-dpi.patch || die | ||
91 | # allow agents up to version 3.5 | ||
92 | mpatch ${PNAME}-${PVER}-agent-version.patch || die | ||
93 | # prefer xmessage instead of dialog | ||
94 | mpatch ${PNAME}-${PVER}-prefer-xmessage.patch || die | ||
95 | # change DISPLAY_BASE to 2000 to avoid conflicts with nasd, cupsd and smbd | ||
96 | mpatch ${PNAME}-${PVER}-increase-base-ports.patch || die | ||
97 | # do not read from non-existent dirs to fix warnings | ||
98 | mpatch ${PNAME}-${PVER}-nxprint-warnings.patch || die | ||
99 | # do not load systemwide nxloadconfig | ||
100 | mpatch ${PNAME}-${PVER}-ignore-system-nxloadconfig.patch | ||
101 | # wait until nxagent has completed startup | ||
102 | mpatch ${PNAME}-${PVER}-agent-startup.patch || die | ||
103 | |||
104 | # fixup pathes and honor multilib systems | ||
105 | sed -i "s:/usr/lib:/usr/$(mlibdir):g" nxloadconfig node.conf.sample || die | ||
106 | sed -i "s:^\(NX_DIR=\).*:\1\"/usr/NX\":" nxloadconfig || die | ||
107 | sed -i "s:^\(NX_ETC_DIR=\).*:\1\"\$NX_DIR/etc\":" nxloadconfig || die | ||
108 | sed -i "s:^\(NX_SESS_DIR=\).*:\1\"\$NX_DIR/var/db\":" nxloadconfig || die | ||
109 | sed -i "s:^\(NX_HOME_DIR=\).*:\1\"\$NX_DIR/home/nx\":" nxloadconfig || die | ||
110 | sed -i "s:^\(#\{,1\}NOMACHINE_NX_HOME_DIR=\).*:\1\"/usr/NX/home/nx\":" nxloadconfig node.conf.sample || die | ||
111 | |||
112 | # fixed authorized keys file | ||
113 | sed -i 's:authorized_keys2:authorized_keys:g' nxloadconfig || die | ||
114 | |||
115 | # no more X11R6 | ||
116 | sed -i 's:/usr/X11R6/bin/xauth:/usr/bin/xauth:g' nxloadconfig || die | ||
117 | sed -i 's:/usr/X11R6/bin/xmessage:/usr/bin/xmessage:g' nxdialog || die | ||
118 | |||
119 | # fix foomatic path | ||
120 | sed -i "s:^\(#\{,1\}COMMAND_FOOMATIC=\).*:\1\"/usr/bin/foomatic-ppdfile\":" nxloadconfig node.conf.sample || die | ||
121 | |||
122 | # do not require openssl for md5sum | ||
123 | sed -i "s:^\(#\{,1\}COMMAND_MD5SUM=\).*:\1\"md5sum\":" nxloadconfig node.conf.sample || die | ||
124 | |||
125 | # fix xkb, font and rgb pathes | ||
126 | sed -i "s:^\(#\{,1\}AGENT_EXTRA_OPTIONS_X=\).*:\1\"-nolisten tcp -co /usr/share/X11/rgb.txt -fp /usr/share/fonts/misc,/usr/share/fonts/75dpi,/usr/share/fonts/100dpi,/usr/share/fonts/TTF,/usr/share/fonts/Type1 -xkbdir /usr/share/X11/xkb\":" nxloadconfig node.conf.sample || die | ||
127 | |||
128 | # no more nx-1.4 version | ||
129 | sed -i "s:^\(#\{,1\}ENABLE_AUTORECONNECT_BEFORE_140=\).*:\1\"0\":" nxloadconfig node.conf.sample || die | ||
130 | |||
131 | # fix so-lib versions and pathes | ||
132 | sed -i 's:libXcomp.so:libXcomp.so.3:g' nxloadconfig || die | ||
133 | sed -i 's:libXcompext.so:libXcompext.so.3:g' nxloadconfig || die | ||
134 | sed -i 's:libXrender.so.1.2:libXrender.so.1.2.2\:$APPLICATION_LIBRARY_PATH/libXcompsh.so.3\:$APPLICATION_LIBRARY_PATH/libXcompshad.so.3:g' nxloadconfig || die | ||
135 | |||
136 | # automatically generate keys | ||
137 | sed -i "s:^\(AUTOMATIC=\).*:\1\"yes\":" nxsetup || die | ||
138 | |||
139 | # fix path to Xession file | ||
140 | sed -i "s:^\(#\{,1\}DEFAULT_X_SESSION=\).*:\1\"/usr/$(mlibdir)/X11/xdm/Xsession\":" nxloadconfig node.conf.sample || die | ||
141 | |||
142 | # use 75dpi as default | ||
143 | sed -i "s:^\(#\{,1\}DEFAULT_XDPI=\).*:\1\"75\":" nxloadconfig node.conf.sample || die | ||
144 | } | ||
145 | |||
146 | src_compile() | ||
147 | { | ||
148 | cd ${SRCDIR} | ||
149 | mmake || die | ||
150 | } | ||
151 | |||
152 | src_install() | ||
153 | { | ||
154 | local i | ||
155 | |||
156 | cd ${SRCDIR} | ||
157 | mmake DESTDIR=${BINDIR} install || die | ||
158 | |||
159 | # install wrappers for essential binaries | ||
160 | minstalldir /usr/bin || die | ||
161 | for i in nxdialog nxkeygen nxnode nxpasswd \ | ||
162 | nxprint nxredir nxserver nxsetup | ||
163 | do | ||
164 | minstallexec -s nxclient-wrapper /usr/bin/${i} || die | ||
165 | done | ||
166 | # nxloadconfig gets sourced in all scripts, so symlink this file and do *not* wrap it | ||
167 | mlink /usr/NX/bin/nxloadconfig /usr/bin/nxloadconfig || die | ||
168 | |||
169 | # create needed empty directories and files to ghost-own them | ||
170 | minstalldir /usr/NX/etc || die | ||
171 | for i in passwords{,.orig} server.id_dsa.pub.key users.id_dsa{,.pub} client.id_dsa.key | ||
172 | do | ||
173 | memptyfile /usr/NX/etc/${i} || die | ||
174 | mchmod 0600 /usr/NX/etc/${i} || die | ||
175 | done | ||
176 | |||
177 | # install the default config file | ||
178 | minstallfile node.conf.sample /usr/NX/etc/node.conf || die | ||
179 | |||
180 | minstalldir /usr/NX/home/nx/.ssh || die | ||
181 | mchown -R nx.nx /usr/NX/home/nx || die | ||
182 | for i in running closed failed | ||
183 | do | ||
184 | mkeepdir /usr/NX/var/db/${i} || die | ||
185 | mchmod 0700 /usr/NX/var/db/${i} || die | ||
186 | done | ||
187 | |||
188 | minstallunit freenx.service || die | ||
189 | minstalllog freenx.logrotate freenx || die | ||
190 | minstallexec -s freenx-check-setup.sh /usr/NX/bin/freenx-check-setup || die | ||
191 | } | ||
192 | |||
193 | preinstall() | ||
194 | { | ||
195 | # block if nomachine nxprint is installed | ||
196 | if [[ -n $(magequery -n nxprint) ]] | ||
197 | then | ||
198 | echo | ||
199 | echo "You have 'net-misc/nxprint' installed on your system." | ||
200 | echo | ||
201 | echo "Both 'net-misc/nxserver-freenx' and 'net-misc/nxprint'" | ||
202 | echo "cannot be installed at the same time. Please uninstall nxprint first!" | ||
203 | echo | ||
204 | die "net-misc/nxprint found." | ||
205 | fi | ||
206 | |||
207 | # block if nomachine nxnode is installed | ||
208 | if [[ -n $(magequery -n nxnode) ]] | ||
209 | then | ||
210 | echo | ||
211 | echo "You have 'net-misc/nxnode' installed on your system." | ||
212 | echo | ||
213 | echo "Both 'net-misc/nxserver-freenx' and 'net-misc/nxnode'" | ||
214 | echo "cannot be installed at the same time. Please uninstall nxnode first!" | ||
215 | echo | ||
216 | die "net-misc/nxnode found." | ||
217 | fi | ||
218 | |||
219 | # block if nx free-edition is installed | ||
220 | if [[ -n $(magequery -n nxserver-freeedition) ]] | ||
221 | then | ||
222 | echo | ||
223 | echo "You have 'net-misc/nxserver-freeedition' installed on your system." | ||
224 | echo | ||
225 | echo "Both 'net-misc/nxserver-freenx' and 'net-misc/nxserver-freeedition'" | ||
226 | echo "cannot be installed at the same time. Please uninstall nxserver-freeedition first!" | ||
227 | echo | ||
228 | die "net-misc/nxserver-freeedition found." | ||
229 | fi | ||
230 | |||
231 | ${MLIBDIR}/mgroupadd nx | ||
232 | ${MLIBDIR}/museradd -o "-g nx -s /usr/NX/bin/nxserver -d /usr/NX/home/nx" nx | ||
233 | } | ||
234 | |||
235 | postinstall() | ||
236 | { | ||
237 | # autoscramble nx system-user password if none was set | ||
238 | if [[ -n $(passwd -S nx | grep '[[:space:]][N|L][P| ]') ]] | ||
239 | then | ||
240 | usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nx | ||
241 | fi | ||
242 | |||
243 | if [[ ! -d /usr/NX/home/nx ]] | ||
244 | then | ||
245 | install /usr/NX/home/nx | ||
246 | fi | ||
247 | chown -R nx:root /usr/NX/home/nx | ||
248 | chmod 0700 /usr/NX/home/nx | ||
249 | |||
250 | echo "Running freenx's setup script" | ||
251 | ${MROOT}/usr/NX/bin/nxsetup --setup-nomachine-key --install | ||
252 | |||
253 | mstartunit freenx.service nxserver | ||
254 | |||
255 | # echo | ||
256 | # echo "You must run 'nxsetup --setup-nomachine-key --install' to complete the installation." | ||
257 | # echo "You also need to set a password for the user nx or pam permits ssh logins." | ||
258 | # echo "To add a NX user run 'nxserver --adduser [username]'" | ||
259 | # echo "and set a password with 'nxserver --passwd [username]'." | ||
260 | # echo | ||
261 | } | ||
262 | |||
263 | post_remove() | ||
264 | { | ||
265 | mstopunit freenx.service | ||
266 | } | ||
267 |