1; Installation script for NetSurf 2 3(procedure p_append #filename #text 4 (set #file-path (tackon "ENVARC:launch-handler/URL" #protocol)) 5 (set #def-file-path (tackon "ENVARC:launch-handler/URL/defaults" #protocol)) 6 7 (if (exists #file-path) 8 ( 9 (set #inc #file-path) 10 ) 11 ;else 12 ( 13 (set #inc #def-file-path) 14 ) 15 ) 16 17 (textfile 18 (dest #file-path) 19 (include #inc) 20 (append #text) 21 ) 22) 23 24(procedure p_chk_launch-handler #protocol 25 (if (exists (tackon "ENVARC:launch-handler/URL" #protocol)) 26 ( 27 (run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL" #protocol) " NetSurf" (safe)) 28 ) 29 ;else 30 ( 31 (run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL/defaults" #protocol) " NetSurf" (safe)) 32 ) 33 ) 34 35 (set #has_entry (getsize "T:NS_Install.tmp")) 36) 37 38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 39;;; Script execution starts here ;;; 40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 41 42(set osver (getversion "libs:version.library")) 43(set osver (/ osver 65536)) 44 45(if (= @app-name "NetSurfAutoInstall") (set #AutoInstall 1)) 46(set @app-name "NetSurf") 47 48(set #netsurf-readme "NetSurf.readme") 49(if (= (exists #netsurf-readme) 0) 50 ( 51 (set #netsurf-readme "NetSurf_os3.readme") 52 (if (OR (>= osver 50) (< osver 44)) 53 (abort "This archive is for AmigaOS 3.5 or 3.9 ONLY.") 54 ) 55 ) 56 ;else 57 ( 58 (if (< osver 50) 59 (abort "This archive is for AmigaOS 4.0 and higher ONLY.") 60 ) 61 ) 62) 63 64(if (<> #AutoInstall 1) (welcome)) 65 66; (hopefully temporary) workaround for a bug in Installer: 67(if (= @language "dutch") (set @askdir-help "")) 68 69(complete 0) 70 71(set @default-dest (getenv "AppPaths/NetSurf")) 72 73; If env-var did not exist, this is a first time install. 74; For novice users we must take care to put the files somewhere sensible. 75(if (= @default-dest "") 76 ( 77 ; Workaround for Installer bug picking TEXTCLIP: as a sensible location 78 (if (= @default-dest "TextClip:") (set @default-dest "SYS:Internet")) 79 80 (if (= @user-level 0) 81 ( 82 (makedir (tackon @default-dest "NetSurf") (infos)) 83 (set @default-dest (tackon @default-dest "NetSurf")) 84 ) 85 ) 86 ) 87) 88 89(set @default-dest 90 (askdir 91 (prompt "Where would you like to install NetSurf?\n" 92 "(a drawer WILL NOT be created)") 93 (help @askdir-help) 94 (default @default-dest) 95 ) 96) 97 98(complete 5) 99 100(working "Checking existing installation...") 101(set #icon-exists (exists (tackon @default-dest "NetSurf.info"))) 102 103(complete 10) 104 105(set #user (getenv "user")) 106(if (= #user "") (set #user "Default")) 107 108(set #user-dir (tackon (tackon @default-dest "Users") #user)) 109(set #user-options (tackon #user-dir "Choices")) 110(set #options-exist (exists #user-options)) 111(set #searchengines-exist (exists (tackon @default-dest "Resources/SearchEngines"))) 112(set #user-hotlist (tackon #user-dir "Hotlist")) 113(set #hotlist-exist (exists #user-hotlist)) 114(set #old-hotlist (tackon @default-dest "Resources/Hotlist")) 115(set #old-hotlist-exist (exists #old-hotlist)) 116(set #aiss-theme "") 117 118(if (= #options-exist 0) 119 ( 120 (if (exists "TBimages:" (noreq)) 121 (set #aiss-theme "AISS") 122 ) 123 124 (set #themename 125 (askchoice 126 (prompt "Please select theme") 127 (help "AISS theme requires AISS (and def_pointers for 32-bit " 128 "pointers), and will only be shown as an option if " 129 "AISS is installed.\n\n" 130 @askchoice-help) 131 (choices "Default" #aiss-theme) 132 (default 0) 133 ) 134 ) 135 136 (select #themename 137 (set #themeshort "Default") 138 (set #themeshort "AISS") 139 ) 140 141 (set #theme (tackon "PROGDIR:Resources/Themes/" #themeshort)) 142 ) 143) 144 145(complete 15) 146 147(if (>= osver 53) 148 ( 149 (if (= #AutoInstall 1) 150 ( 151 (set #addlaunchhandler 0) 152 ) 153 ;else 154 ( 155 (set #addlaunchhandler 156 (askbool 157 (prompt "Add NetSurf to launch-handler? (recommended)") 158 (help "launch-handler is part of OS4.1 which opens URLs " 159 " by launching a web browser.\n\n" 160 "The installation will update the configuration of " 161 "OS4.1 to allow URLs to be opened by NetSurf.") 162 (default 1) 163 ) 164 ) 165 ) 166 ) 167 ) 168 ;else 169 ( 170 (set #addlaunchhandler 0) 171 ) 172) 173 174(complete 20) 175 176(set #runfixfonts 177 (askbool 178 (prompt "Installer will run FixFonts after NetSurf is installed. " 179 "Unless you have a *very* good reason you should not skip this step.") 180 (help "FixFonts corrects inconsistencies in the Amiga FONTS: structure. " 181 "Running it will prevent NetSurf hitting problems when the fonts are scanned.") 182 (default 1) 183 (choices "Run FixFonts" "Skip") 184 ) 185) 186 187(complete 25) 188 189(working "Installing NetSurf") 190 191(if (= #AutoInstall 0) 192 ( 193 (copyfiles 194 (prompt "Copying NetSurf...") 195 (help @copyfiles-help) 196 (source "NetSurf") 197 (dest @default-dest) 198 (newname "NetSurf") 199 (optional "askuser" "force" "oknodelete") 200 (confirm "expert") 201 ) 202 ) 203;else 204 ( 205 (run "CopyStore NetSurf" @default-dest) 206 ) 207) 208 209(complete 40) 210 211(if #searchengines-exist 212 (rename (tackon @default-dest "Resources/SearchEngines") (tackon @default-dest "Resources/SearchEngines.backup")) 213) 214 215(run "c:filenote Rexx/CloseTabs.nsrx \"Close other tabs\"") 216(run "c:filenote Rexx/ViewSource.nsrx \"View source\"") 217 218(complete 50) 219 220(copyfiles 221 (prompt "Copying files") 222 (source "") 223 (choices "Resources" "Rexx" "NetSurf.guide" #netsurf-readme) 224 (help @copyfiles-help) 225 (dest @default-dest) 226 (infos) 227 (optional "nofail") 228; (all) 229) 230 231(complete 65) 232 233(copyfiles 234 (prompt "Copying additional documentation") 235 (source "") 236 (pattern "(COPYING|ChangeLog)") 237 (help @copyfiles-help) 238 (dest @default-dest) 239 (infos) 240 (optional "nofail") 241) 242 243(complete 70) 244 245(if #themeshort 246 ( 247 (set #theme-icon 248 (tackon "Resources/Themes" 249 (tackon #themeshort "NetSurf.info") 250 ) 251 ) 252 253 (if (exists #theme-icon) 254 ( 255 (copyfiles 256 (prompt "Copying theme icon") 257 (help @copyfiles-help) 258 (source #theme-icon) 259 (dest @default-dest) 260 ) 261 ) 262 ) 263 264 (makedir #user-dir) 265 266 (textfile 267 (prompt "Setting default options") 268 (help @textfile-help) 269 (dest #user-options) 270 (append "theme:" #theme "\n") 271 (append "pubscreen_name:Workbench\n") 272 ) 273 274 (if (= #hotlist-exist 0) 275 (if (= #old-hotlist-exist 1) 276 ( 277 (copyfiles 278 (prompt "Migrating NetSurf 2.x Hotlist") 279 (help @copyfiles-help) 280 (source #old-hotlist) 281 (dest #user-dir) 282 (optional "askuser" "force" "oknodelete") 283 ) 284 ) 285 ) 286 ) 287 ) 288) 289 290(complete 75) 291 292(if (= (exists "ENVARC:Sys/def_css.info") 0) 293 (copyfiles 294 (prompt "Copying default CSS icon") 295 (source "Resources/default.css.info") 296 (newname "def_css.info") 297 (help @copyfiles-help) 298 (dest "ENVARC:Sys") 299 (optional "nofail") 300 ) 301) 302 303(complete 80) 304 305(if (>= osver 53) 306 (if (= (exists "Rexx:NetSurf") 0) 307 ( 308 (textfile 309 (prompt "Creating NetSurf launch helper") 310 (help @textfile-help) 311 (dest "Rexx:NetSurf") 312 (append "/*\n" 313" * Copyright 2013, 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>\n" 314" *\n" 315" * This file is part of NetSurf, http://www.netsurf-browser.org/\n" 316" *\n" 317" * NetSurf is free software; you can redistribute it and/or modify\n" 318" * it under the terms of the GNU General Public License as published by\n" 319" * the Free Software Foundation; version 2 of the License.\n" 320" *\n" 321" * NetSurf is distributed in the hope that it will be useful,\n" 322" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 323" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" 324" * GNU General Public License for more details.\n" 325" *\n" 326" * You should have received a copy of the GNU General Public License\n" 327" * along with this program. If not, see <http://www.gnu.org/licenses/>.\n" 328" */\n" 329"\n" 330"/* This is a convenience script for launching NetSurf from the Shell.\n" 331" * If NetSurf is already running it will open the supplied URL in a new tab.\n" 332" * This can be used in URL Prefs in place of directly calling APPDIR:NetSurf.\n" 333" */\n" 334"\n" 335"options results\n" 336"parse arg url\n" 337"\n" 338"if show('P', 'NETSURF') then do\n" 339" address NETSURF 'OPEN' url 'NEWTAB ACTIVE'\n" 340" address NETSURF 'TOFRONT'\n" 341"end\n" 342"else do\n" 343" address command 'APPDIR:NetSurf URL' url\n" 344"end\n") 345 ) 346 (protect "Rexx:NetSurf" "+se") 347 ) 348 ) 349) 350 351(complete 85) 352 353(if (= #addlaunchhandler 1) 354 ( 355 (working "Adding NetSurf to launch-handler config") 356 (if (= (p_chk_launch-handler "FILE.LH") 0) 357 (p_append "FILE.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"file:///%s*\"\"") 358 ) 359 360 (if (= (p_chk_launch-handler "HTTP.LH") 0) 361 (p_append "HTTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://%s*\"\"") 362 ) 363 364 (if (= (p_chk_launch-handler "HTTPS.LH") 0) 365 (p_append "HTTPS.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"https://%s*\"\"") 366 ) 367 368 (if (= (p_chk_launch-handler "WWW.LH") 0) 369 (p_append "WWW.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://www.%s*\"\"") 370 ) 371 372; (if (= (p_chk_launch-handler "FTP.LH") 0) 373; (p_append "FTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"ftp://%s*\"\"") 374; ) 375 ) 376) 377 378(complete 90) 379 380(working "Running FixFonts") 381 382(if #runfixfonts 383 ( 384 (run "SYS:System/FixFonts") 385 ) 386) 387 388(complete 100) 389 390(if (= #AutoInstall 1) 391 ( 392 (exit (quiet)) 393 ) 394 ( 395 (exit) 396 ) 397) 398