Magellan Linux

Contents of /trunk/extras/nxserver-freenx/nxserver-freenx-0.7.3-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12502 - (show annotations) (download)
Tue Jun 5 13:07:00 2012 UTC (12 years ago) by niro
File size: 8394 byte(s)
-fixed installation
1 # $Id$
2
3 PNAME="nxserver-freenx"
4 PVER="0.7.3"
5 PBUILD="r2"
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 nxloadconfig nxnode nxpasswd \
159 nxprint nxredir nxserver nxsetup
160 do
161 minstallexec -s nxclient-wrapper /usr/bin/${i} || die
162 done
163
164 # create needed empty directories and files to ghost-own them
165 minstalldir /usr/NX/etc || die
166 for i in passwords{,.orig} server.id_dsa.pub.key users.id_dsa{,.pub} client.id_dsa.key
167 do
168 memptyfile /usr/NX/etc/${i} || die
169 mchmod 0600 /usr/NX/etc/${i} || die
170 done
171
172 # install the default config file
173 minstallfile node.conf.sample /usr/NX/etc/node.conf || die
174
175 minstalldir /usr/NX/home/nx/.ssh || die
176 mchown -R nx.nx /usr/NX/home/nx || die
177 for i in running closed failed
178 do
179 minstalldir /usr/NX/var/db/${i} || die
180 mchmod 0700 /usr/NX/var/db/${i} || die
181 done
182
183 minstallunit freenx.service || die
184 minstalllog freenx.logrotate freenx || die
185 minstallexec -s freenx-check-setup.sh /usr/NX/bin/freenx-check-setup || die
186 }
187
188 preinstall()
189 {
190 # block if nomachine nxprint is installed
191 if [[ -n $(magequery -n nxprint) ]]
192 then
193 echo
194 echo "You have 'net-misc/nxprint' installed on your system."
195 echo
196 echo "Both ${PCAT}/${PNAME} and 'net-misc/nxprint'"
197 echo "cannot be installed at the same time. Please uninstall nxprint first!"
198 echo
199 die "net-misc/nxprint found."
200 fi
201
202 # block if nomachine nxnode is installed
203 if [[ -n $(magequery -n nxnode) ]]
204 then
205 echo
206 echo "You have 'net-misc/nxnode' installed on your system."
207 echo
208 echo "Both ${PCAT}/${PNAME} and 'net-misc/nxnode'"
209 echo "cannot be installed at the same time. Please uninstall nxnode first!"
210 echo
211 die "net-misc/nxnode found."
212 fi
213
214 # block if nx free-edition is installed
215 if [[ -n $(magequery -n nxserver-freeedition) ]]
216 then
217 echo
218 echo "You have 'net-misc/nxserver-freeedition' installed on your system."
219 echo
220 echo "Both ${PCAT}/${PNAME} and 'net-misc/nxserver-freeedition'"
221 echo "cannot be installed at the same time. Please uninstall nxserver-freeedition first!"
222 echo
223 die "net-misc/nxserver-freeedition found."
224 fi
225
226 ${MLIBDIR}/mgroupadd nx
227 ${MLIBDIR}/museradd -o "-g nx -s /usr/NX/bin/nxserver -d /usr/NX/home/nx" nx
228 }
229
230 postinstall()
231 {
232 # autoscramble nx system-user password if none was set
233 if [[ -n $(passwd -S nx | grep '[[:space:]][N|L][P| ]') ]]
234 then
235 usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nx
236 fi
237
238 if [[ ! -d /usr/NX/home/nx ]]
239 then
240 install /usr/NX/home/nx
241 fi
242 chown -R nx:root /usr/NX/home/nx
243 chmod 0700 /usr/NX/home/nx
244
245 echo "Running freenx's setup script"
246 ${MROOT}/usr/NX/bin/nxsetup --setup-nomachine-key --install
247
248 mstartunit freenx.service nxserver
249
250 echo
251 # echo "You must run 'nxsetup --setup-nomachine-key --install' to complete the installation."
252 echo "You also need to set a password for the user nx or pam permits ssh logins."
253 echo "To add a NX user run 'nxserver --adduser [username]'"
254 echo "and set a password with 'nxserver --passwd [username]'."
255 echo
256 }
257
258 post_remove()
259 {
260 mstopunit freenx.service
261 }
262