|
1 From 45cdceb023897ee25d4d82434f570d63ccf43df8 Mon Sep 17 00:00:00 2001 |
|
2 From: Alan Coopersmith <[email protected]> |
|
3 Date: Sat, 2 Jan 2016 19:59:16 -0800 |
|
4 Subject: [PATCH] Solaris paths |
|
5 |
|
6 Various fixes to deal with where we install things on Solaris: |
|
7 |
|
8 - Only run hacks from the hacks dir, not $PATH |
|
9 |
|
10 - Find helper programs even though they are not in $PATH |
|
11 |
|
12 - Show author names when reading RSS feeds from sites like blogs.sun.com |
|
13 |
|
14 - Show Solaris package names in demo app when hacks are not installed |
|
15 |
|
16 - Use gnome-help to display man pages nicely, without requiring internet |
|
17 access (which some customers at secure sites won't have configured), |
|
18 instead of opening a web browser to view the man page at jwz.org or |
|
19 opening a gnome-terminal to run the man command. |
|
20 |
|
21 Mostly not acceptable upstream. |
|
22 |
|
23 Backport notes: this change relies on the gnome-help version delivered in |
|
24 Solaris 11 that supports "man:xscreensaver" style URL's to display man pages. |
|
25 When backporting to Solaris 10 you will probably want to uncomment the |
|
26 lines shown for GNOME 2.4/2.6. |
|
27 |
|
28 Also, you'll need to fix the package names shown when the hacks are not |
|
29 installed to be the older SUNWxscreensaver-* for Solaris 10. |
|
30 --- |
|
31 driver/Makefile.in | 9 ++++--- |
|
32 driver/XScreenSaver.ad.in | 14 +++++++--- |
|
33 driver/demo-Gtk.c | 4 +-- |
|
34 driver/subprocs.c | 54 ++++++++++++++++++++++++++++++++++++-- |
|
35 driver/xscreensaver-demo.glade2.in | 4 +-- |
|
36 driver/xscreensaver-text | 6 ++++- |
|
37 driver/xscreensaver.man | 5 ++-- |
|
38 hacks/glx/Makefile.in | 4 +-- |
|
39 8 files changed, 81 insertions(+), 19 deletions(-) |
|
40 |
|
41 diff --git a/driver/Makefile.in b/driver/Makefile.in |
|
42 index c132304..a5b94bf 100644 |
|
43 --- a/driver/Makefile.in |
|
44 +++ b/driver/Makefile.in |
|
45 @@ -27,7 +27,7 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ |
|
46 GTK_DATADIR = @GTK_DATADIR@ |
|
47 GTK_APPDIR = $(GTK_DATADIR)/applications |
|
48 GTK_ICONDIR = $(GTK_DATADIR)/pixmaps |
|
49 -GTK_GLADEDIR = $(GTK_DATADIR)/xscreensaver/glade |
|
50 +GTK_GLADEDIR = $(prefix)/lib/xscreensaver/config |
|
51 HACK_CONF_DIR = @HACK_CONF_DIR@ |
|
52 |
|
53 CC = @CC@ |
|
54 @@ -36,8 +36,11 @@ CFLAGS = @CFLAGS@ |
|
55 LDFLAGS = @LDFLAGS@ |
|
56 DEFS = @DEFS@ |
|
57 INTL_DEFS = -DLOCALEDIR=\"$(localedir)\" |
|
58 -SUBP_DEFS = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' |
|
59 -GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' |
|
60 +SUBP_DEFS = $(DEFS) -DHACK_PATH='"@HACKDIR@"' \ |
|
61 + -DDEFAULT_PATH_PREFIX='"@HACKDIR@:$(libexecdir)"' \ |
|
62 + -DHELPER_PATH='"$(libexecdir)"' |
|
63 +GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' \ |
|
64 + -DBINDIR='"$(bindir)"' |
|
65 CONF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' |
|
66 |
|
67 LIBS = @LIBS@ |
|
68 diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in |
|
69 index 22d5bcb..3e1ff8a 100644 |
|
70 --- a/driver/XScreenSaver.ad.in |
|
71 +++ b/driver/XScreenSaver.ad.in |
|
72 @@ -91,18 +91,24 @@ GetViewPortIsFullOfLies: False |
|
73 |
|
74 ! This is the URL loaded by the "Help" button on the splash screen, |
|
75 ! and by the "Documentation" menu item in xscreensaver-demo. |
|
76 -*helpURL: http://www.jwz.org/xscreensaver/man.html |
|
77 +*helpURL: man:xscreensaver |
|
78 |
|
79 ! loadURL -- how the "Help" buttons load the helpURL (/bin/sh syntax.) |
|
80 ! manualCommand -- how the "Documentation" buttons display man pages. |
|
81 ! |
|
82 ! And there are so very many options to choose from! |
|
83 ! |
|
84 +! Modern GNOME: |
|
85 +! |
|
86 +*loadURL: gnome-help '%s' |
|
87 +*manualCommand: gnome-help 'man:%s' |
|
88 +! |
|
89 ! Gnome 2.4, 2.6: (yelp can't display man pages, as of 2.6.3) |
|
90 ! |
|
91 -@GNOME24@*loadURL: @WITH_BROWSER@ '%s' |
|
92 -@GNOME24@*manualCommand: gnome-terminal --title '%s manual' \ |
|
93 -@GNOME24@ --command '/bin/sh -c "man %s; read foo"' |
|
94 +!*loadURL: gnome-terminal --title 'xscreensaver manual' \ |
|
95 +! --command '/bin/ksh -c "man xscreensaver; read foo"' |
|
96 +!*manualCommand: gnome-terminal --title '%s manual' \ |
|
97 +! --command '/bin/ksh -c "man %s; read foo"' |
|
98 ! |
|
99 ! Gnome 2.2: |
|
100 ! |
|
101 diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c |
|
102 index 27d2316..6c449f2 100644 |
|
103 --- a/driver/demo-Gtk.c |
|
104 +++ b/driver/demo-Gtk.c |
|
105 @@ -994,7 +994,7 @@ restart_menu_cb (GtkWidget *widget, gpointer user_data) |
|
106 flush_dialog_changes_and_save (s); |
|
107 xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL); |
|
108 sleep (1); |
|
109 - if (system ("xscreensaver -nosplash &") < 0) |
|
110 + if (system (BINDIR "/xscreensaver -nosplash &") < 0) |
|
111 fprintf (stderr, "%s: fork error\n", blurb()); |
|
112 |
|
113 await_xscreensaver (s); |
|
114 @@ -4969,7 +4969,7 @@ main (int argc, char **argv) |
|
115 |
|
116 if (init_results == 1) |
|
117 { |
|
118 - system ("xscreensaver -nosplash &"); |
|
119 + system (BINDIR "/xscreensaver -nosplash &"); |
|
120 return 0; |
|
121 } |
|
122 |
|
123 diff --git a/driver/subprocs.c b/driver/subprocs.c |
|
124 index ecbaeb2..9414df1 100644 |
|
125 --- a/driver/subprocs.c |
|
126 +++ b/driver/subprocs.c |
|
127 @@ -14,6 +14,7 @@ |
|
128 # include "config.h" |
|
129 #endif |
|
130 |
|
131 +#include <sys/stat.h> |
|
132 #include <ctype.h> |
|
133 #include <stdio.h> |
|
134 #include <string.h> |
|
135 @@ -799,6 +800,8 @@ print_path_error (const char *program) |
|
136 free (cmd); |
|
137 perror (buf); |
|
138 |
|
139 +/* mali - security issue do not want to display user's path */ |
|
140 +#ifdef EXPOSE_USER_PATH |
|
141 if (errno == ENOENT && |
|
142 (token = getenv("PATH"))) |
|
143 { |
|
144 @@ -829,6 +832,7 @@ print_path_error (const char *program) |
|
145 } |
|
146 fprintf (stderr, "\n"); |
|
147 } |
|
148 +#endif |
|
149 } |
|
150 |
|
151 |
|
152 @@ -885,12 +889,42 @@ fork_and_exec (saver_screen_info *ssi, const char *command) |
|
153 return forked; |
|
154 } |
|
155 |
|
156 +static Bool |
|
157 +check_if_hacks_dir_exists(Bool verbose_p) |
|
158 +{ |
|
159 + const char hackdir[] = HACK_PATH; |
|
160 + |
|
161 + int status; |
|
162 + struct stat st; |
|
163 + |
|
164 + status = stat (hackdir, &st); |
|
165 + |
|
166 + if (status == 0 && S_ISDIR(st.st_mode)) |
|
167 + { |
|
168 + return True; |
|
169 + } |
|
170 + else |
|
171 + { |
|
172 + if (verbose_p) |
|
173 + { |
|
174 + fprintf(stderr, |
|
175 + "%s: Warning: dir: %s missing. Will not run hacks\n", |
|
176 + blurb(), hackdir); |
|
177 + } |
|
178 + return False; |
|
179 + } |
|
180 +} |
|
181 |
|
182 void |
|
183 spawn_screenhack (saver_screen_info *ssi) |
|
184 { |
|
185 saver_info *si = ssi->global; |
|
186 saver_preferences *p = &si->prefs; |
|
187 + char* complete_hack_command; |
|
188 + |
|
189 + if (si->prefs.verbose_p) |
|
190 + fprintf(stderr, "--> spawn_screenhack()\n"); |
|
191 + |
|
192 XFlush (si->dpy); |
|
193 |
|
194 if (!monitor_powered_on_p (si)) |
|
195 @@ -970,6 +1004,12 @@ spawn_screenhack (saver_screen_info *ssi) |
|
196 ; |
|
197 } |
|
198 |
|
199 + if ((new_hack >= 0) && |
|
200 + (check_if_hacks_dir_exists(p->verbose_p) == False)) |
|
201 + { |
|
202 + new_hack = -1; |
|
203 + } |
|
204 + |
|
205 if (new_hack < 0) /* don't run a hack */ |
|
206 { |
|
207 ssi->current_hack = -1; |
|
208 @@ -1017,7 +1057,17 @@ spawn_screenhack (saver_screen_info *ssi) |
|
209 if (si->selection_mode < 0) |
|
210 si->selection_mode = 0; |
|
211 |
|
212 - forked = fork_and_exec (ssi, hack->command); |
|
213 + /* We need complete path to hack command else any executable |
|
214 + * with the same name in the path gets executed. |
|
215 + */ |
|
216 + complete_hack_command = malloc (10 + strlen(hack->command) + |
|
217 + strlen (HACK_PATH)); |
|
218 + sprintf(complete_hack_command, HACK_PATH"/%s", hack->command); |
|
219 + |
|
220 + |
|
221 + forked = fork_and_exec (ssi, complete_hack_command); |
|
222 + free (complete_hack_command); |
|
223 + |
|
224 switch ((int) forked) |
|
225 { |
|
226 case -1: /* fork failed */ |
|
227 @@ -1196,7 +1246,7 @@ get_best_gl_visual (saver_info *si, Screen *screen) |
|
228 char *av[10]; |
|
229 int ac = 0; |
|
230 |
|
231 - av[ac++] = "xscreensaver-gl-helper"; |
|
232 + av[ac++] = HELPER_PATH "/xscreensaver-gl-helper"; |
|
233 av[ac] = 0; |
|
234 |
|
235 if (pipe (fds)) |
|
236 diff --git a/driver/xscreensaver-demo.glade2.in b/driver/xscreensaver-demo.glade2.in |
|
237 index ad0095d..40e47f6 100644 |
|
238 --- a/driver/xscreensaver-demo.glade2.in |
|
239 +++ b/driver/xscreensaver-demo.glade2.in |
|
240 @@ -927,8 +927,8 @@ Installed</property> |
|
241 <property name="visible">True</property> |
|
242 <property name="label" translatable="yes">Very few (or no) screen savers appear to be available. |
|
243 |
|
244 -This probably means that the "xscreensaver-extras" and |
|
245 -"xscreensaver-gl-extras" packages are not installed.</property> |
|
246 +This probably means that the “desktop/xscreensaver/hacks” and |
|
247 +“desktop/xscreensaver/hacks/hacks-gl” packages are not installed.</property> |
|
248 <property name="use_underline">False</property> |
|
249 <property name="use_markup">False</property> |
|
250 <property name="justify">GTK_JUSTIFY_CENTER</property> |
|
251 diff --git a/driver/xscreensaver-text b/driver/xscreensaver-text |
|
252 index 8199829..921d5c7 100755 |
|
253 --- a/driver/xscreensaver-text |
|
254 +++ b/driver/xscreensaver-text |
|
255 @@ -569,12 +569,15 @@ sub reformat_rss($) { |
|
256 $i++; |
|
257 |
|
258 my ($title, $body1, $body2, $body3); |
|
259 + my $author; |
|
260 |
|
261 $title = $3 if (m@<((TITLE) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
262 $body1 = $3 if (m@<((DESCRIPTION) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
263 $body2 = $3 if (m@<((CONTENT) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
264 $body3 = $3 if (m@<((SUMMARY) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
265 |
|
266 + $author = $3 if (m@<((DC:CREATOR) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
267 + |
|
268 # If there are both <description> and <content> or <content:encoded>, |
|
269 # use whichever one contains more text. |
|
270 # |
|
271 @@ -598,10 +601,11 @@ sub reformat_rss($) { |
|
272 |
|
273 $title = rss_field_to_html ($title || ''); |
|
274 $body1 = rss_field_to_html ($body1 || ''); |
|
275 + $author = rss_field_to_html ($author || ''); |
|
276 |
|
277 $title = '' if ($body1 eq $title); # Identical in Twitter's atom feed. |
|
278 |
|
279 - $out .= reformat_html ("$title<P>$body1", $wiki_p ? 'wiki' : 'rss'); |
|
280 + $out .= reformat_html ("$title<BR>$author<P>$body1", $wiki_p ? 'wiki' : 'rss'); |
|
281 $out .= "\n"; |
|
282 } |
|
283 |
|
284 diff --git a/driver/xscreensaver.man b/driver/xscreensaver.man |
|
285 index 11f5b02..9ad7509 100644 |
|
286 --- a/driver/xscreensaver.man |
|
287 +++ b/driver/xscreensaver.man |
|
288 @@ -97,9 +97,8 @@ xscreensaver-command -restart |
|
289 If you want to set the system-wide defaults, then make your edits to |
|
290 the xscreensaver app-defaults file, which should have been installed |
|
291 when xscreensaver itself was installed. The app-defaults file will |
|
292 -usually be named /usr/lib/X11/app-defaults/XScreenSaver, but different |
|
293 -systems might keep it in a different place (for example, |
|
294 -/usr/openwin/lib/app-defaults/XScreenSaver on Solaris.) |
|
295 +usually be named /usr/share/X11/app-defaults/XScreenSaver, but different |
|
296 +systems might keep it in a different place. |
|
297 |
|
298 When settings are changed in the Preferences dialog box (see above) |
|
299 the current settings will be written to the \fI.xscreensaver\fP file. |
|
300 diff --git a/hacks/glx/Makefile.in b/hacks/glx/Makefile.in |
|
301 index 211d356..23c68d4 100644 |
|
302 --- a/hacks/glx/Makefile.in |
|
303 +++ b/hacks/glx/Makefile.in |
|
304 @@ -303,7 +303,7 @@ install-program:: $(EXES) |
|
305 # the xscreensaver-gl-helper program, in $bindir |
|
306 install-program:: $(EXES) |
|
307 @exes="@GL_UTIL_EXES@" ; \ |
|
308 - idir="$(install_prefix)$(bindir)" ; \ |
|
309 + idir="$(install_prefix)$(libexecdir)" ; \ |
|
310 if [ "$$exes" != "" ]; then \ |
|
311 if [ ! -d $$idir ]; then \ |
|
312 $(INSTALL_DIRS) $$idir ; \ |
|
313 @@ -372,7 +372,7 @@ uninstall-program:: |
|
314 # the xscreensaver-gl-helper program, in $bindir |
|
315 uninstall-program:: |
|
316 @exes="$(GL_UTIL_EXES)" ; \ |
|
317 - idir="$(install_prefix)$(bindir)" ; \ |
|
318 + idir="$(install_prefix)$(libexecdir)" ; \ |
|
319 for program in $$exes; do \ |
|
320 echo rm -f $$idir/$$program ; \ |
|
321 rm -f $$idir/$$program ; \ |
|
322 -- |
|
323 2.6.1 |
|
324 |