Magellan Linux

Contents of /branches/R11-stable/extras/nxserver-freenx/nxserver-freenx-0.7.3-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15302 - (show annotations) (download)
Wed Jan 2 11:10:31 2013 UTC (11 years, 4 months ago) by niro
File size: 8531 byte(s)
-release branches/R11-stable
1 # $Id$
2
3 PNAME="nxserver-freenx"
4 PVER="0.7.3"
5 PBUILD="r4"
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}/nxclient-wrapper
65 mirror://${PNAME}/freenx.service
66 mirror://${PNAME}/freenx.logrotate
67 mirror://${PNAME}/freenx-check-setup.sh
68 )
69
70 UP2DATE="updatecmd_berlios freenx freenx-server"
71
72 src_prepare()
73 {
74 munpack ${SRCFILE} || die
75 cd ${SRCDIR}
76 # upstream patches from launchpad
77 mpatch ${PNAME}-${PVER}-lp-fixes.patch || die
78 # fix installation of nxredir
79 mpatch ${PNAME}-${PVER}-nxredir.patch || die
80 # auto generate missing ssh keys
81 mpatch ${PNAME}-${PVER}-generate-ssh-keys.patch || die
82 # only use dialog when xterm is installed
83 mpatch ${PNAME}-${PVER}-nxdialog.patch || die
84 # fix ipp handling
85 mpatch ${PNAME}-${PVER}-nxipp.patch || die
86 # fix path handling with symlinks
87 mpatch ${PNAME}-${PVER}-nxpath.patch || die
88 # make the default DPI configurable through node.conf
89 mpatch ${PNAME}-${PVER}-dpi.patch || die
90 # allow agents up to version 3.5
91 mpatch ${PNAME}-${PVER}-agent-version.patch || die
92 # prefer xmessage instead of dialog
93 mpatch ${PNAME}-${PVER}-prefer-xmessage.patch || die
94 # change DISPLAY_BASE to 2000 to avoid conflicts with nasd, cupsd and smbd
95 mpatch ${PNAME}-${PVER}-increase-base-ports.patch || die
96 # do not read from non-existent dirs to fix warnings
97 mpatch ${PNAME}-${PVER}-nxprint-warnings.patch || die
98 # do not load systemwide nxloadconfig
99 mpatch ${PNAME}-${PVER}-ignore-system-nxloadconfig.patch
100
101 # fixup pathes and honor multilib systems
102 sed -i "s:/usr/lib:/usr/$(mlibdir):g" nxloadconfig node.conf.sample || die
103 sed -i "s:^\(NX_DIR=\).*:\1\"/usr/NX\":" nxloadconfig || die
104 sed -i "s:^\(NX_ETC_DIR=\).*:\1\"\$NX_DIR/etc\":" nxloadconfig || die
105 sed -i "s:^\(NX_SESS_DIR=\).*:\1\"\$NX_DIR/var/db\":" nxloadconfig || die
106 sed -i "s:^\(NX_HOME_DIR=\).*:\1\"\$NX_DIR/home/nx\":" nxloadconfig || die
107 sed -i "s:^\(#\{,1\}NOMACHINE_NX_HOME_DIR=\).*:\1\"/usr/NX/home/nx\":" nxloadconfig node.conf.sample || die
108
109 # fixed authorized keys file
110 sed -i 's:authorized_keys2:authorized_keys:g' nxloadconfig || die
111
112 # no more X11R6
113 sed -i 's:/usr/X11R6/bin/xauth:/usr/bin/xauth:g' nxloadconfig || die
114 sed -i 's:/usr/X11R6/bin/xmessage:/usr/bin/xmessage:g' nxdialog || die
115
116 # fix foomatic path
117 sed -i "s:^\(#\{,1\}COMMAND_FOOMATIC=\).*:\1\"/usr/bin/foomatic-ppdfile\":" nxloadconfig node.conf.sample || die
118
119 # do not require openssl for md5sum
120 sed -i "s:^\(#\{,1\}COMMAND_MD5SUM=\).*:\1\"md5sum\":" nxloadconfig node.conf.sample || die
121
122 # fix xkb, font and rgb pathes
123 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
124
125 # no more nx-1.4 version
126 sed -i "s:^\(#\{,1\}ENABLE_AUTORECONNECT_BEFORE_140=\).*:\1\"0\":" nxloadconfig node.conf.sample || die
127
128 # fix so-lib versions and pathes
129 sed -i 's:libXcomp.so:libXcomp.so.3:g' nxloadconfig || die
130 sed -i 's:libXcompext.so:libXcompext.so.3:g' nxloadconfig || die
131 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
132
133 # automatically generate keys
134 sed -i "s:^\(AUTOMATIC=\).*:\1\"yes\":" nxsetup || die
135
136 # fix path to Xession file
137 sed -i "s:^\(#\{,1\}DEFAULT_X_SESSION=\).*:\1\"/usr/$(mlibdir)/X11/xdm/Xsession\":" nxloadconfig node.conf.sample || die
138
139 # use 75dpi as default
140 sed -i "s:^\(#\{,1\}DEFAULT_XDPI=\).*:\1\"75\":" nxloadconfig node.conf.sample || die
141 }
142
143 src_compile()
144 {
145 cd ${SRCDIR}
146 mmake || die
147 }
148
149 src_install()
150 {
151 local i
152
153 cd ${SRCDIR}
154 mmake DESTDIR=${BINDIR} install || die
155
156 # install wrappers for essential binaries
157 minstalldir /usr/bin || die
158 for i in nxdialog nxkeygen nxnode nxpasswd \
159 nxprint nxredir nxserver nxsetup
160 do
161 minstallexec -s nxclient-wrapper /usr/bin/${i} || die
162 done
163 # nxloadconfig gets sourced in all scripts, so symlink this file and do *not* wrap it
164 mlink /usr/NX/bin/nxloadconfig /usr/bin/nxloadconfig || die
165
166 # create needed empty directories and files to ghost-own them
167 minstalldir /usr/NX/etc || die
168 for i in passwords{,.orig} server.id_dsa.pub.key users.id_dsa{,.pub} client.id_dsa.key
169 do
170 memptyfile /usr/NX/etc/${i} || die
171 mchmod 0600 /usr/NX/etc/${i} || die
172 done
173
174 # install the default config file
175 minstallfile node.conf.sample /usr/NX/etc/node.conf || die
176
177 minstalldir /usr/NX/home/nx/.ssh || die
178 mchown -R nx.nx /usr/NX/home/nx || die
179 for i in running closed failed
180 do
181 mkeepdir /usr/NX/var/db/${i} || die
182 mchmod 0700 /usr/NX/var/db/${i} || die
183 done
184
185 minstallunit freenx.service || die
186 minstalllog freenx.logrotate freenx || die
187 minstallexec -s freenx-check-setup.sh /usr/NX/bin/freenx-check-setup || die
188 }
189
190 preinstall()
191 {
192 # block if nomachine nxprint is installed
193 if [[ -n $(magequery -n nxprint) ]]
194 then
195 echo
196 echo "You have 'net-misc/nxprint' installed on your system."
197 echo
198 echo "Both ${PCAT}/${PNAME} and 'net-misc/nxprint'"
199 echo "cannot be installed at the same time. Please uninstall nxprint first!"
200 echo
201 die "net-misc/nxprint found."
202 fi
203
204 # block if nomachine nxnode is installed
205 if [[ -n $(magequery -n nxnode) ]]
206 then
207 echo
208 echo "You have 'net-misc/nxnode' installed on your system."
209 echo
210 echo "Both ${PCAT}/${PNAME} and 'net-misc/nxnode'"
211 echo "cannot be installed at the same time. Please uninstall nxnode first!"
212 echo
213 die "net-misc/nxnode found."
214 fi
215
216 # block if nx free-edition is installed
217 if [[ -n $(magequery -n nxserver-freeedition) ]]
218 then
219 echo
220 echo "You have 'net-misc/nxserver-freeedition' installed on your system."
221 echo
222 echo "Both ${PCAT}/${PNAME} and 'net-misc/nxserver-freeedition'"
223 echo "cannot be installed at the same time. Please uninstall nxserver-freeedition first!"
224 echo
225 die "net-misc/nxserver-freeedition found."
226 fi
227
228 ${MLIBDIR}/mgroupadd nx
229 ${MLIBDIR}/museradd -o "-g nx -s /usr/NX/bin/nxserver -d /usr/NX/home/nx" nx
230 }
231
232 postinstall()
233 {
234 # autoscramble nx system-user password if none was set
235 if [[ -n $(passwd -S nx | grep '[[:space:]][N|L][P| ]') ]]
236 then
237 usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nx
238 fi
239
240 if [[ ! -d /usr/NX/home/nx ]]
241 then
242 install /usr/NX/home/nx
243 fi
244 chown -R nx:root /usr/NX/home/nx
245 chmod 0700 /usr/NX/home/nx
246
247 echo "Running freenx's setup script"
248 ${MROOT}/usr/NX/bin/nxsetup --setup-nomachine-key --install
249
250 mstartunit freenx.service nxserver
251
252 # echo
253 # echo "You must run 'nxsetup --setup-nomachine-key --install' to complete the installation."
254 # echo "You also need to set a password for the user nx or pam permits ssh logins."
255 # echo "To add a NX user run 'nxserver --adduser [username]'"
256 # echo "and set a password with 'nxserver --passwd [username]'."
257 # echo
258 }
259
260 post_remove()
261 {
262 mstopunit freenx.service
263 }
264