summaryrefslogtreecommitdiff
path: root/frontends/amiga/dist/Install
blob: 55631905e6d99ca8d87d824ca3c1d885032cc493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
; Installation script for NetSurf

(procedure p_append #filename #text
	(set #file-path (tackon "ENVARC:launch-handler/URL" #protocol))
	(set #def-file-path (tackon "ENVARC:launch-handler/URL/defaults" #protocol))

	(if (exists #file-path)
		(
			(set #inc #file-path)
		)
		;else
		(
			(set #inc #def-file-path)
		)
	)

	(textfile
		(dest #file-path)
		(include #inc)
		(append #text)
	)
)

(procedure p_chk_launch-handler #protocol
	(if (exists (tackon "ENVARC:launch-handler/URL" #protocol))
		(
			(run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL" #protocol) " NetSurf" (safe))
		)
		;else
		(
			(run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL/defaults" #protocol) " NetSurf" (safe))
		)
	)

	(set #has_entry (getsize "T:NS_Install.tmp"))
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Script execution starts here ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(set osver (getversion "libs:version.library"))
(set osver (/ osver 65536))

(if (= @app-name "NetSurfAutoInstall") (set #AutoInstall 1))
(set @app-name "NetSurf")

(set #netsurf-readme "NetSurf.readme")
(if (= (exists #netsurf-readme) 0)
	(
		(set #netsurf-readme "NetSurf_os3.readme")
		(if (OR (>= osver 50) (< osver 44))
			(abort "This archive is for AmigaOS 3.5 or 3.9 ONLY.")
		)
	)
	;else
	(
		(if (< osver 50)
			(abort "This archive is for AmigaOS 4.0 and higher ONLY.")
		)
	)
)

(if (<> #AutoInstall 1) (welcome))

; (hopefully temporary) workaround for a bug in Installer:
(if (= @language "dutch") (set @askdir-help ""))

(complete 0)

(set @default-dest (getenv "AppPaths/NetSurf"))

; If env-var did not exist, this is a first time install.
; For novice users we must take care to put the files somewhere sensible.
(if (= @default-dest "")
	(
		; Workaround for Installer bug picking TEXTCLIP: as a sensible location
		(if (= @default-dest "TextClip:") (set @default-dest "SYS:Internet"))

		(if (= @user-level 0)
			(
				(makedir (tackon @default-dest "NetSurf") (infos))
				(set @default-dest (tackon @default-dest "NetSurf"))
			)
		)
	)
)

(set @default-dest
	(askdir
		(prompt "Where would you like to install NetSurf?\n"
				"(a drawer WILL NOT be created)")
		(help @askdir-help)
		(default @default-dest)
	)
)

(complete 5)

(working "Checking existing installation...")
(set #icon-exists (exists (tackon @default-dest "NetSurf.info")))

(complete 10)

(set #user (getenv "user"))
(if (= #user "") (set #user "Default"))

(set #user-dir (tackon (tackon @default-dest "Users") #user))
(set #user-options (tackon #user-dir "Choices"))
(set #options-exist (exists #user-options))
(set #searchengines-exist (exists (tackon @default-dest "Resources/SearchEngines")))
(set #user-hotlist (tackon #user-dir "Hotlist"))
(set #hotlist-exist (exists #user-hotlist))
(set #old-hotlist (tackon @default-dest "Resources/Hotlist"))
(set #old-hotlist-exist (exists #old-hotlist))
(set #aiss-theme "")

(if (= #options-exist 0)
	(
		(if (exists "TBimages:" (noreq))
			(set #aiss-theme "AISS")
		)

		(set #themename
   			(askchoice
  				(prompt "Please select theme")
 	      		(help "AISS theme requires AISS (and def_pointers for 32-bit "
						"pointers), and will only be shown as an option if "
						"AISS is installed.\n\n"
						@askchoice-help)
				(choices "Default" #aiss-theme)
       			(default 0)
   			)
		)

		(select #themename
			(set #themeshort "Default")
			(set #themeshort "AISS")
		)

		(set #theme (tackon "PROGDIR:Resources/Themes/" #themeshort))
	)
)

(complete 15)

(if (>= osver 53)
	(
		(if (= #AutoInstall 1)
			(
				(set #addlaunchhandler 0)
			)
			;else
			(
				(set #addlaunchhandler
					(askbool
						(prompt "Add NetSurf to launch-handler? (recommended)")
						(help "launch-handler is part of OS4.1 which opens URLs "
							" by launching a web browser.\n\n"
							"The installation will update the configuration of "
							"OS4.1 to allow URLs to be opened by NetSurf.")
						(default 1)
					)
				)
			)
		)
	)
	;else
	(
		(set #addlaunchhandler 0)
	)
)

(complete 20)

(set #runfixfonts
	(askbool
		(prompt "Installer will run FixFonts after NetSurf is installed.  "
			"Unless you have a *very* good reason you should not skip this step.")
		(help "FixFonts corrects inconsistencies in the Amiga FONTS: structure. "
			"Running it will prevent NetSurf hitting problems when the fonts are scanned.")
		(default 1)
		(choices "Run FixFonts" "Skip")
	)
)

(complete 25)

(working "Installing NetSurf")

(if (= #AutoInstall 0)
	(
		(copyfiles
			(prompt "Copying NetSurf...")
			(help @copyfiles-help)
			(source "NetSurf")
			(dest @default-dest)
			(newname "NetSurf")
			(optional "askuser" "force" "oknodelete")
			(confirm "expert")
		)
	)
;else
	(
		(run "CopyStore NetSurf" @default-dest)
	)
)

(complete 40)

(if #searchengines-exist
	(rename (tackon @default-dest "Resources/SearchEngines") (tackon @default-dest "Resources/SearchEngines.backup"))
)

(run "c:filenote Rexx/CloseTabs.nsrx \"Close other tabs\"")
(run "c:filenote Rexx/ViewSource.nsrx \"View source\"")

(complete 50)

(copyfiles
	(prompt "Copying files")
	(source "")
	(choices "Resources" "Rexx" "NetSurf.guide" #netsurf-readme)
	(help @copyfiles-help)
	(dest @default-dest)
	(infos)
	(optional "nofail")
;	(all)
)

(complete 65)

(copyfiles
	(prompt "Copying additional documentation")
	(source "")
	(pattern "(COPYING|ChangeLog)")
	(help @copyfiles-help)
	(dest @default-dest)
	(infos)
	(optional "nofail")
)

(complete 70)

(if #themeshort
	(
		(set #theme-icon
			(tackon "Resources/Themes"
				(tackon #themeshort "NetSurf.info")
			)
		)

		(if (exists #theme-icon)
			(
				(copyfiles
					(prompt "Copying theme icon")
					(help @copyfiles-help)
					(source #theme-icon)
					(dest @default-dest)
				)
			)
		)

		(makedir #user-dir)

		(textfile
			(prompt "Setting default options")
			(help @textfile-help)
			(dest #user-options)
			(append "theme:" #theme "\n")
			(append "pubscreen_name:Workbench\n")
		)

		(if (= #hotlist-exist 0)
			(if (= #old-hotlist-exist 1)
				(
					(copyfiles
						(prompt "Migrating NetSurf 2.x Hotlist")
						(help @copyfiles-help)
						(source #old-hotlist)
						(dest #user-dir)
						(optional "askuser" "force" "oknodelete")
					)
				)
			)
		)
	)
)

(complete 75)

; Force disable use of AltiVec if we don't have it
(if (database "vectorunit" "0")
	(
		(textfile
			(dest "ENVARC:JSIMD_FORCENONE")
			(append "1")
		)
	)
)

(if (= (exists "ENVARC:Sys/def_css.info") 0)
	(copyfiles
		(prompt "Copying default CSS icon")
		(source "Resources/default.css.info")
		(newname "def_css.info")
		(help @copyfiles-help)
		(dest "ENVARC:Sys")
		(optional "nofail")
	)
)

(complete 80)

(if (>= osver 53)
	(if (= (exists "Rexx:NetSurf") 0)
		(
			(textfile
				(prompt "Creating NetSurf launch helper")
				(help @textfile-help)
				(dest "Rexx:NetSurf")
				(append "/*\n"
" * Copyright 2013 Chris Young <chris@unsatisfactorysoftware.co.uk>\n"
" *\n"
" * This file is part of NetSurf, http://www.netsurf-browser.org/\n"
" *\n"
" * NetSurf is free software; you can redistribute it and/or modify\n"
" * it under the terms of the GNU General Public License as published by\n"
" * the Free Software Foundation; version 2 of the License.\n"
" *\n"
" * NetSurf is distributed in the hope that it will be useful,\n"
" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
" * GNU General Public License for more details.\n"
" *\n"
" * You should have received a copy of the GNU General Public License\n"
" * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n"
" */\n"
"\n"
"/* This is a convenience script for launching NetSurf from the Shell.\n"
" * If NetSurf is already running it will open the supplied URL in a new tab.\n"
" * This can be used in URL Prefs in place of directly calling APPDIR:NetSurf.\n"
" */\n"
"\n"
"options results\n"
"parse arg url\n"
"\n"
"if show('P', 'NETSURF') then do\n"
" address NETSURF 'OPEN' url 'NEWTAB'\n"
" address NETSURF 'TOFRONT'\n"
"end\n"
"else do\n"
" address command 'APPDIR:NetSurf URL' url\n"
"end\n")
			)
			(protect "Rexx:NetSurf" "+se")
		)
	)
)

(complete 85)

(if (= #addlaunchhandler 1)
	(
		(working "Adding NetSurf to launch-handler config")
		(if (= (p_chk_launch-handler "FILE.LH") 0)
			(p_append "FILE.LH" "ClientName=\"NETSURF\"   ClientPath=\"Rexx:NetSurf\"   CMDFORMAT=\"*\"file:///%s*\"\"")
		)

		(if (= (p_chk_launch-handler "HTTP.LH") 0)
			(p_append "HTTP.LH" "ClientName=\"NETSURF\"   ClientPath=\"Rexx:NetSurf\"   CMDFORMAT=\"*\"http://%s*\"\"")
		)

		(if (= (p_chk_launch-handler "HTTPS.LH") 0)
			(p_append "HTTPS.LH" "ClientName=\"NETSURF\"   ClientPath=\"Rexx:NetSurf\"   CMDFORMAT=\"*\"https://%s*\"\"")
		)

		(if (= (p_chk_launch-handler "WWW.LH") 0)
			(p_append "WWW.LH" "ClientName=\"NETSURF\"   ClientPath=\"Rexx:NetSurf\"   CMDFORMAT=\"*\"http://www.%s*\"\"")
		)

;		(if (= (p_chk_launch-handler "FTP.LH") 0)
;			(p_append "FTP.LH" "ClientName=\"NETSURF\"   ClientPath=\"Rexx:NetSurf\"   CMDFORMAT=\"*\"ftp://%s*\"\"")
;		)
	)
)

(complete 90)

(working "Running FixFonts")

(if #runfixfonts
	(
		(run "SYS:System/FixFonts")
	)
)

(complete 100)

(if (= #AutoInstall 1)
	(
		(exit (quiet))
	)
	(
		(exit)
	)
)