Annotation of /trunk/extras/nxserver-freenx/nxserver-freenx-0.7.3-r9.smage2
Parent Directory | Revision Log
Revision 29241 -
(hide annotations)
(download)
Wed May 31 07:50:51 2017 UTC (7 years, 3 months ago) by niro
File size: 9638 byte(s)
Wed May 31 07:50:51 2017 UTC (7 years, 3 months ago) by niro
File size: 9638 byte(s)
auto added: ver bump to 0.7.3-r9
1 | niro | 29241 | # $Id$ |
2 | |||
3 | PNAME="nxserver-freenx" | ||
4 | PVER="0.7.3" | ||
5 | PBUILD="r9" | ||
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.45 | ||
21 | >= sys-apps/gawk-4 | ||
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.24 | ||
33 | >= sys-apps/coreutils-8 | ||
34 | >= sys-apps/util-linux-2.25" | ||
35 | |||
36 | SDEPEND=">= virtual/sed | ||
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 | NXWRAPPER_PVER="" | ||
48 | NXWRAPPER_SRCFILE="nxwrapper2.in" | ||
49 | NXWRAPPER_SRCDIR="${BUILDDIR}/nxwrapper" | ||
50 | |||
51 | SVC_REV="r2936" | ||
52 | CHK_REV="r2935" | ||
53 | |||
54 | sminclude mtools systemd | ||
55 | |||
56 | SRC_URI=( | ||
57 | http://download.berlios.de/freenx/${SRCFILE} | ||
58 | mirror://${PNAME}/${SRCFILE} | ||
59 | mirror://${PNAME}/${PNAME}-${PVER}-lp-fixes.patch | ||
60 | mirror://${PNAME}/${PNAME}-${PVER}-nxredir.patch | ||
61 | mirror://${PNAME}/${PNAME}-${PVER}-generate-ssh-keys.patch | ||
62 | mirror://${PNAME}/${PNAME}-${PVER}-nxdialog.patch | ||
63 | mirror://${PNAME}/${PNAME}-${PVER}-nxipp.patch | ||
64 | mirror://${PNAME}/${PNAME}-${PVER}-nxpath.patch | ||
65 | mirror://${PNAME}/${PNAME}-${PVER}-dpi.patch | ||
66 | mirror://${PNAME}/${PNAME}-${PVER}-agent-version.patch | ||
67 | mirror://${PNAME}/${PNAME}-${PVER}-prefer-xmessage.patch | ||
68 | mirror://${PNAME}/${PNAME}-${PVER}-increase-base-ports.patch | ||
69 | mirror://${PNAME}/${PNAME}-${PVER}-nxprint-warnings.patch | ||
70 | mirror://${PNAME}/${PNAME}-${PVER}-ignore-system-nxloadconfig.patch | ||
71 | mirror://${PNAME}/${PNAME}-${PVER}-agent-startup.patch | ||
72 | mirror://nx/${NXWRAPPER_SRCFILE} | ||
73 | mirror://${PNAME}/freenx.service-${SVC_REV} | ||
74 | mirror://${PNAME}/freenx.logrotate | ||
75 | mirror://${PNAME}/freenx-check-setup.sh-${CHK_REV} | ||
76 | ) | ||
77 | |||
78 | UP2DATE="updatecmd_berlios freenx freenx-server" | ||
79 | |||
80 | SPECIAL_FUNCTIONS="pkg_setup" | ||
81 | |||
82 | pkg_setup() | ||
83 | { | ||
84 | mgroupadd nx | ||
85 | museradd -o "-g nx -s /usr/$(mlibdir)/nx/bin/nxserver -d /var/lib/nxserver/home" nx | ||
86 | } | ||
87 | |||
88 | src_prepare() | ||
89 | { | ||
90 | munpack ${SRCFILE} || die | ||
91 | cd ${SRCDIR} | ||
92 | # upstream patches from launchpad | ||
93 | mpatch ${PNAME}-${PVER}-lp-fixes.patch || die | ||
94 | # fix installation of nxredir | ||
95 | mpatch ${PNAME}-${PVER}-nxredir.patch || die | ||
96 | # auto generate missing ssh keys | ||
97 | mpatch ${PNAME}-${PVER}-generate-ssh-keys.patch || die | ||
98 | # only use dialog when xterm is installed | ||
99 | mpatch ${PNAME}-${PVER}-nxdialog.patch || die | ||
100 | # fix ipp handling | ||
101 | mpatch ${PNAME}-${PVER}-nxipp.patch || die | ||
102 | # fix path handling with symlinks | ||
103 | mpatch ${PNAME}-${PVER}-nxpath.patch || die | ||
104 | # make the default DPI configurable through node.conf | ||
105 | mpatch ${PNAME}-${PVER}-dpi.patch || die | ||
106 | # allow agents up to version 3.5 | ||
107 | mpatch ${PNAME}-${PVER}-agent-version.patch || die | ||
108 | # prefer xmessage instead of dialog | ||
109 | mpatch ${PNAME}-${PVER}-prefer-xmessage.patch || die | ||
110 | # change DISPLAY_BASE to 2000 to avoid conflicts with nasd, cupsd and smbd | ||
111 | mpatch ${PNAME}-${PVER}-increase-base-ports.patch || die | ||
112 | # do not read from non-existent dirs to fix warnings | ||
113 | mpatch ${PNAME}-${PVER}-nxprint-warnings.patch || die | ||
114 | # do not load systemwide nxloadconfig | ||
115 | mpatch ${PNAME}-${PVER}-ignore-system-nxloadconfig.patch | ||
116 | # wait until nxagent has completed startup | ||
117 | mpatch ${PNAME}-${PVER}-agent-startup.patch || die | ||
118 | |||
119 | # fixup pathes and honor multilib systems | ||
120 | sed -i "s:/usr/lib:/usr/$(mlibdir):g" nxloadconfig node.conf.sample || die | ||
121 | sed -i "s:^\(NX_DIR=\).*:\1\"/usr/$(mlibdir)/nx\":" nxloadconfig || die | ||
122 | sed -i "s:^\(NX_ETC_DIR=\).*:\1\"/etc/nxserver\":" nxloadconfig || die | ||
123 | sed -i "s:^\(NX_SESS_DIR=\).*:\1\"/var/lib/nxserver/db\":" nxloadconfig || die | ||
124 | sed -i "s:^\(NX_HOME_DIR=\).*:\1\"/var/lib/nxserver/home\":" nxloadconfig || die | ||
125 | sed -i "s:^\(#\{,1\}NOMACHINE_NX_HOME_DIR=\).*:\1\"/var/lib/nxserver/home\":" nxloadconfig node.conf.sample || die | ||
126 | |||
127 | # fixed authorized keys file | ||
128 | sed -i 's:authorized_keys2:authorized_keys:g' nxloadconfig || die | ||
129 | |||
130 | # no more X11R6 | ||
131 | sed -i 's:/usr/X11R6/bin/xauth:/usr/bin/xauth:g' nxloadconfig || die | ||
132 | sed -i 's:/usr/X11R6/bin/xmessage:/usr/bin/xmessage:g' nxdialog || die | ||
133 | |||
134 | # fix foomatic path | ||
135 | sed -i "s:^\(#\{,1\}COMMAND_FOOMATIC=\).*:\1\"/usr/bin/foomatic-ppdfile\":" nxloadconfig node.conf.sample || die | ||
136 | |||
137 | # do not require openssl for md5sum | ||
138 | sed -i "s:^\(#\{,1\}COMMAND_MD5SUM=\).*:\1\"md5sum\":" nxloadconfig node.conf.sample || die | ||
139 | |||
140 | # fix xkb, font and rgb pathes | ||
141 | 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 | ||
142 | |||
143 | # no more nx-1.4 version | ||
144 | sed -i "s:^\(#\{,1\}ENABLE_AUTORECONNECT_BEFORE_140=\).*:\1\"0\":" nxloadconfig node.conf.sample || die | ||
145 | |||
146 | # fix so-lib versions and pathes | ||
147 | sed -i 's:libXcomp.so:libXcomp.so.3:g' nxloadconfig || die | ||
148 | sed -i 's:libXcompext.so:libXcompext.so.3:g' nxloadconfig || die | ||
149 | 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 | ||
150 | |||
151 | # automatically generate keys | ||
152 | sed -i "s:^\(AUTOMATIC=\).*:\1\"yes\":" nxsetup || die | ||
153 | |||
154 | # fix path to Xession file | ||
155 | sed -i "s:^\(#\{,1\}DEFAULT_X_SESSION=\).*:\1\"/usr/$(mlibdir)/X11/xdm/Xsession\":" nxloadconfig node.conf.sample || die | ||
156 | |||
157 | # use 75dpi as default | ||
158 | sed -i "s:^\(#\{,1\}DEFAULT_XDPI=\).*:\1\"75\":" nxloadconfig node.conf.sample || die | ||
159 | |||
160 | # copy the wrapper | ||
161 | install -d ${NXWRAPPER_SRCDIR} | ||
162 | cp ${SOURCEDIR}/${PNAME}/${NXWRAPPER_SRCFILE} ${NXWRAPPER_SRCDIR}/ || die | ||
163 | } | ||
164 | |||
165 | src_compile() | ||
166 | { | ||
167 | cd ${SRCDIR} | ||
168 | mmake || die | ||
169 | |||
170 | cd ${NXWRAPPER_SRCDIR} | ||
171 | sed -e "s:@@NXLIBDIR@@:/usr/$(mlibdir)/nx:g" \ | ||
172 | -e "s:@@NXLOCALLIBDIR@@:/usr/local/$(mlibdir)/nx:g" \ | ||
173 | ${NXWRAPPER_SRCFILE} > nxwrapper || die | ||
174 | } | ||
175 | |||
176 | src_install() | ||
177 | { | ||
178 | local i | ||
179 | |||
180 | cd ${SRCDIR} | ||
181 | mmake DESTDIR=${BINDIR} install NX_ETC_DIR=/etc/nxserver || die | ||
182 | |||
183 | # install wrappers for essential binaries | ||
184 | minstalldir /usr/bin || die | ||
185 | for i in nxdialog nxkeygen nxnode nxpasswd \ | ||
186 | nxprint nxredir nxserver nxsetup | ||
187 | do | ||
188 | minstallexec ${NXWRAPPER_SRCDIR}/nxwrapper /usr/bin/${i} || die | ||
189 | done | ||
190 | # nxloadconfig gets sourced in all scripts, so symlink this file and do *not* wrap it | ||
191 | mlink /usr/$(mlibdir)/nx/bin/nxloadconfig /usr/bin/nxloadconfig || die | ||
192 | |||
193 | # create needed empty directories and files to ghost-own them | ||
194 | minstalldir /etc/nxserver || die | ||
195 | for i in passwords{,.orig} server.id_dsa.pub.key users.id_dsa{,.pub} client.id_dsa.key | ||
196 | do | ||
197 | memptyfile /etc/nxserver/${i} || die | ||
198 | mchmod 0600 /etc/nxserver/${i} || die | ||
199 | done | ||
200 | |||
201 | # install the default config file | ||
202 | minstallfile node.conf.sample /etc/nxserver/node.conf || die | ||
203 | |||
204 | minstalldir /var/lib/nxserver/home/.ssh || die | ||
205 | mchown -R nx.nx /var/lib/nxserver/home || die | ||
206 | for i in running closed failed | ||
207 | do | ||
208 | mkeepdir /var/lib/nxserver/db/${i} || die | ||
209 | mchmod 0700 /var/lib/nxserver/db/${i} || die | ||
210 | done | ||
211 | |||
212 | minstallunit freenx.service-${SVC_REV} freenx.service || die | ||
213 | minstalllog freenx.logrotate freenx || die | ||
214 | minstallexec -s freenx-check-setup.sh-${CHK_REV} /usr/bin/freenx-check-setup || die | ||
215 | } | ||
216 | |||
217 | preinstall() | ||
218 | { | ||
219 | # block if nomachine nxprint is installed | ||
220 | if [[ -n $(magequery -n nxprint) ]] | ||
221 | then | ||
222 | echo | ||
223 | echo "You have 'net-misc/nxprint' installed on your system." | ||
224 | echo | ||
225 | echo "Both 'net-misc/nxserver-freenx' and 'net-misc/nxprint'" | ||
226 | echo "cannot be installed at the same time. Please uninstall nxprint first!" | ||
227 | echo | ||
228 | die "net-misc/nxprint found." | ||
229 | fi | ||
230 | |||
231 | # deprecated: | ||
232 | # # block if nomachine nxnode is installed | ||
233 | # if [[ -n $(magequery -n nxnode) ]] | ||
234 | # then | ||
235 | # echo | ||
236 | # echo "You have 'net-misc/nxnode' installed on your system." | ||
237 | # echo | ||
238 | # echo "Both 'net-misc/nxserver-freenx' and 'net-misc/nxnode'" | ||
239 | # echo "cannot be installed at the same time. Please uninstall nxnode first!" | ||
240 | # echo | ||
241 | # die "net-misc/nxnode found." | ||
242 | # fi | ||
243 | |||
244 | # deprecated: | ||
245 | # # block if nx free-edition is installed | ||
246 | # if [[ -n $(magequery -n nxserver-freeedition) ]] | ||
247 | # then | ||
248 | # echo | ||
249 | # echo "You have 'net-misc/nxserver-freeedition' installed on your system." | ||
250 | # echo | ||
251 | # echo "Both 'net-misc/nxserver-freenx' and 'net-misc/nxserver-freeedition'" | ||
252 | # echo "cannot be installed at the same time. Please uninstall nxserver-freeedition first!" | ||
253 | # echo | ||
254 | # die "net-misc/nxserver-freeedition found." | ||
255 | # fi | ||
256 | |||
257 | pkg_setup | ||
258 | } | ||
259 | |||
260 | postinstall() | ||
261 | { | ||
262 | # autoscramble nx system-user password if none was set | ||
263 | if [[ -n $(passwd -S nx | grep '[[:space:]][N|L][P| ]') ]] | ||
264 | then | ||
265 | usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nx | ||
266 | fi | ||
267 | |||
268 | if [[ ! -d /var/lib/nxserver/home ]] | ||
269 | then | ||
270 | install /var/lib/nxserver/home | ||
271 | fi | ||
272 | chown -R nx:root /var/lib/nxserver/home | ||
273 | chmod 0700 /var/lib/nxserver/home | ||
274 | |||
275 | echo "Running freenx's setup script" | ||
276 | ${MROOT}/usr/bin/nxsetup --setup-nomachine-key --install | ||
277 | |||
278 | mstartunit freenx.service nxserver | ||
279 | |||
280 | # echo | ||
281 | # echo "You must run 'nxsetup --setup-nomachine-key --install' to complete the installation." | ||
282 | # echo "You also need to set a password for the user nx or pam permits ssh logins." | ||
283 | # echo "To add a NX user run 'nxserver --adduser [username]'" | ||
284 | # echo "and set a password with 'nxserver --passwd [username]'." | ||
285 | # echo | ||
286 | |||
287 | echo | ||
288 | echo "You have to modify your default sshd configuration to accept older ssh-dss keys for freenx." | ||
289 | echo "Add 'PubkeyAcceptedKeyTypes ssh-dss' to your /etc/ssh/sshd_config and restart sshd." | ||
290 | echo | ||
291 | } | ||
292 | |||
293 | postremove() | ||
294 | { | ||
295 | mstopunit freenx.service | ||
296 | } |