home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 123 / af123sub.adf / WebVision.lzx / WebVision / Install_WebVision < prev    next >
Text File  |  1999-03-02  |  8KB  |  357 lines

  1. ; $VER: Install WebVision 2.1 (17.2.99)
  2. ;
  3. ; WebVision webcam viewer, by Troels Walsted Hansen <troels@stud.cs.uit.no>
  4. ; Copyright Ultima Thule Software © 1999, All Rights Reserved.
  5. ;
  6. ; Installer script for WebVision.
  7.  
  8. (set #exitmsg "\n\nThank you for installing WebVision.\n\nRemember to register if you use it for more than 30 days.")
  9.  
  10. ; Welcome screen
  11.  
  12. (welcome "\nThis installer script will install WebVision.\nThe ultimate webcam viewer")
  13.  
  14. ; Check the environment
  15.  
  16. (if (< (/ @installer-version 65536) 43)
  17.     (abort "The WebVision installation script needs Installer\n"
  18.     "version 43 or higher. It is available from Aminet.")
  19. )
  20.  
  21. (if (< (/ (getversion) 65536) 39)
  22.     (abort "WebVision needs AmigaOS 3.0 or higher.\n")
  23. )
  24.  
  25. (if
  26.     (not (= (exists "MUI:" (noreq)) 2))
  27.     (abort "WebVision needs MUI 3.8 or higher.\n")
  28. )
  29.  
  30. ; Some smartass previous installation detection
  31.  
  32. (procedure p_tackoff string1 string2
  33.     (set #p_tackoff_result string1)
  34.  
  35.     (if
  36.         (>= (strlen string1) (strlen string2))
  37.  
  38.         (
  39.             (set #p_tackoff_diff (- (strlen string1) (strlen string2)))
  40.  
  41.             (if
  42.                 (= string2 (substr string1 #p_tackoff_diff (strlen string2)))
  43.  
  44.                 (set #p_tackoff_result (substr string1 0 #p_tackoff_diff))
  45.             )
  46.         )
  47.     )
  48.  
  49.     (#p_tackoff_result)
  50. )
  51.  
  52. (set #oldpath (getenv "WebVision_LASTUSEDDIR"))
  53.  
  54. (if
  55.     #oldpath
  56.  
  57.     (set @default-dest (p_tackoff #oldpath "WebVision"))
  58.  
  59.     (
  60.         (set #oldpath (getenv "WebTV_LASTUSEDDIR"))
  61.  
  62.         (if #oldpath
  63.             (set @default-dest (p_tackoff #oldpath "WebTV"))
  64.         )
  65.     )
  66. )
  67.  
  68. ; Ask for destination directory
  69.  
  70. (set #destdir
  71.     (askdir
  72.         (prompt "Select destination directory. A directory called \"WebVision\" will be created here.")
  73.         (help @askdir-help)
  74.         (default @default-dest)
  75.     )
  76. )
  77. (set @default-dest (tackon #destdir "WebVision"))
  78.  
  79. ; RobR detection
  80.  
  81. (if
  82.     (= (expandpath "") (expandpath @default-dest))
  83.     (abort "Please select a different directory than the one you're installing from.\n")
  84. )
  85.  
  86. ; Create installation directory and copy icon for it
  87.  
  88. (makedir @default-dest)
  89.  
  90. (copyfiles
  91.     (source "/WebVision.info")
  92.     (dest #destdir)
  93. )
  94.  
  95. ; Copy files
  96.  
  97. (copyfiles
  98.     (prompt "The following files will be installed:")
  99.     (help @copyfiles-help)
  100.     (source "")
  101.     (choices "WebVision" "WebVision.guide" "Registration" "Register" "DockBrushes")
  102.     (dest @default-dest)
  103.     (confirm)
  104.     (infos)
  105. )
  106.  
  107. ; Install OpenURL
  108.  
  109. (if 
  110.     (askbool
  111.         (prompt "Would you like to install the OpenURL package version 2.0?\n\nOpenURL is a shared library that allows easy sending of URLs to webbrowsers. The library is used extensively in WebVision, and is also supported by such programs as AmIRC and YAM.\n\nWithout it, you can only send URLs to the clipboard.\n\n")
  112.         (help "It is quite harmless to install this. You will get four new files, a library called openurl.library, a handler called OpenURL-Handler, a prefs program and a MUI class called Popport.mcc which is used by the prefs program.")
  113.         (choices "Install" "Don't install")
  114.         (default 1)
  115.     )
  116.  
  117.     (
  118.         (copylib
  119.             (prompt "Installing the OpenURL library")
  120.             (help @copyfiles-help)
  121.             (source "OpenURL/openurl.library")
  122.             (dest "Libs:")
  123.         )
  124.  
  125.         (copylib
  126.             (prompt "Installing the OpenURL handler")
  127.             (help @copyfiles-help)
  128.             (source "OpenURL/OpenURL-Handler")
  129.             (dest "L:")
  130.         )
  131.  
  132.         (copyfiles
  133.             (prompt "Installing the OpenURL preference program")
  134.             (help @copyfiles-help)
  135.             (source "OpenURL/OpenURL")
  136.             (dest "SYS:Prefs")
  137.             (infos)
  138.             (noposition)
  139.         )
  140.         
  141.         (copylib
  142.             (prompt "Installing the Popport.mcc MUI class")
  143.             (help @copyfiles-help)
  144.             (source "OpenURL/Popport.mcc")
  145.             (dest "MUI:Libs/MUI")
  146.         )
  147.  
  148.         (if
  149.             (askbool
  150.                 (prompt "You should run the OpenURL preferences program now to set your browser path(s). Would you like me to launch it?\n\nNote: You should quit all OpenURL using apps now, to allow the old version of the library to be flushed from memory.")
  151.                 (help "")
  152.                 (default 1)
  153.             )
  154.  
  155.             (
  156.                 (run "Avail FLUSH >NIL:")
  157.                 (run "SYS:Prefs/OpenURL")
  158.             )
  159.         )
  160.     )
  161. )
  162.  
  163. ; Check for prior installations
  164.  
  165. (set #webtvpath (getenv "WebTV_LASTUSEDDIR"))
  166.  
  167. (if #webtvpath
  168.     (set #webtvinstalled
  169.         (and
  170.             (= (exists (tackon #webtvpath "WebTV"))     1)
  171.             (= (exists (tackon #webtvpath "WebVision")) 0)
  172.         )
  173.     )
  174.  
  175.     (set #webtvinstalled 0)
  176. )
  177.  
  178. ; Copy old files over from old WebTV installation
  179.  
  180. (if
  181.     #webtvinstalled
  182.  
  183.     (set
  184.         #copyoldfiles
  185.         (askbool
  186.             (prompt "An installation of WebTV has been detected. Would you like to copy over the keyfile (if you have one), the site configuration file and the MUI configuration file from this installation?")
  187.             (help "The following operations are performed:\nCopy WebTV.key TO WebVision.key\nCopy WebTV.sites TO WebVision.sites\nCopy ENV:mui/WEBTV.1.prefs TO ENV:mui/WEBVISION.1.prefs\nCopy ENVARC:mui/WEBTV.1.prefs TO ENVARC:mui/WEBVISION.1.prefs")
  188.             (default 1)
  189.         )
  190.     )
  191.  
  192.     (set #copyoldfiles 0)
  193. )
  194.  
  195. (if
  196.     #copyoldfiles
  197.  
  198.     (
  199.         (copyfiles
  200.             (source (tackon #webtvpath "WebTV.sites"))
  201.             (dest @default-dest)
  202.             (newname "WebVision.sites")
  203.             (optional "nofail")
  204.         )
  205.  
  206.         (copyfiles
  207.             (source (tackon #webtvpath "WebTV.key"))
  208.             (dest @default-dest)
  209.             (newname "WebVision.key")
  210.             (optional "nofail")
  211.         )
  212.  
  213.         (copyfiles
  214.             (source "ENV:mui/WEBTV.1.prefs")
  215.             (dest "ENV:mui")
  216.             (newname "WEBVISION.1.prefs")
  217.             (optional "nofail")
  218.         )
  219.  
  220.         (copyfiles
  221.             (source "ENVARC:mui/WEBTV.1.prefs")
  222.             (dest "ENVARC:mui")
  223.             (newname "WEBVISION.1.prefs")
  224.             (optional "nofail")
  225.         )
  226.     )
  227. )
  228.  
  229. ; Optionally install script to make V work
  230.  
  231. (if
  232.     (askbool
  233.         (prompt "The Voyager webbrowser supports WebTV through sending URLs to it from the context menu of images.  To make this work with WebVision you will need a small script to send the URL on to WebVision.  Would you like to install this script?")
  234.         (help "A script called WebTV is installed in the WebVision directory and the WebTV_LASTUSEDDIR is set to point to the WebVision directory.")
  235.         (default 1)
  236.     )
  237.  
  238.     (
  239.         (copyfiles
  240.             (source "WebTV")
  241.             (dest @default-dest)
  242.         )
  243.  
  244.         (protect
  245.             (tackon @default-dest "WebTV")
  246.             "+s"
  247.         )
  248.  
  249.         (run (cat "Echo " @default-dest " >ENV:WebTV_LASTUSEDDIR NOLINE"))
  250.         (run (cat "Echo " @default-dest " >ENVARC:WebTV_LASTUSEDDIR NOLINE"))
  251.     )
  252. )
  253.  
  254. ; Optionally avoid adult cams in the installation and future auto updates
  255.  
  256. (if
  257.     (= @user-level 0)
  258.     (
  259.         (set #restore-novice-level 1)
  260.         (user 1)                        ; yes, I know this is evil
  261.     )
  262.     (set #restore-novice-level 0)
  263. )
  264.  
  265. (if
  266.     (askbool
  267.         (prompt "WebVision is distributed together with a list of camsites.  Some of these sites are only intended for adult audiences.  If you like, these sites can be left out of the installation.\n\nAdditionally, through the new automatic sitelist update feature (registered users only) you may get new sites that are only suitable for adult audiences. If you like, you can filter out such sites when using the update service.\n\nAvoid adult webcams?")
  268.         (help "The filter setting can be changed later inside the WebVision settings window if you wish.")
  269.         (default 1)
  270.     )
  271.  
  272.     (
  273.         (textfile
  274.             (dest "ENV:WebVision.settings")
  275.             (include "ENV:WebVision.settings")
  276.             (append "NoAdult: Yes\n")
  277.         )
  278.  
  279.         (textfile
  280.             (dest "ENVARC:WebVision.settings")
  281.             (include "ENVARC:WebVision.settings")
  282.             (append "NoAdult: Yes\n")
  283.         )
  284.  
  285.         (set #newsitefile "WebVision.sites")
  286.     )
  287.  
  288.     (set #newsitefile "WebVision_Adult.sites")
  289. )
  290.  
  291. (if
  292.     #restore-novice-level
  293.     (user 0)
  294. )
  295.  
  296. ; Check for prior existance of sitefile
  297.  
  298. (set #oldsitefile (tackon @default-dest "WebVision.sites"))
  299.  
  300. (if
  301.     (exists #oldsitefile)
  302.  
  303.     (set #sitefilechoice
  304.         (askchoice
  305.             (prompt "You have a web camera site configuration file called WebVision.sites already.")
  306.             (help "Overwriting should be safe if you haven't configured any cameras of your own. Appending may create duplicate entries.")
  307.             (choices "pOverwrite old with new file" "Append new file to old one" "Put old sites into \"Old sites\" group" "Skip copying new file")
  308.             (default 2)
  309.         )
  310.     )
  311.  
  312.     (set #sitefilechoice 0)
  313. )
  314.  
  315. ; Overwrite
  316.  
  317. (if 
  318.     (= #sitefilechoice 0)
  319.  
  320.     (copyfiles
  321.         (source #newsitefile)
  322.         (dest @default-dest)
  323.         (newname "WebVision.sites")
  324. ;        (optional force)
  325.     )
  326. )
  327.  
  328. ; Append
  329.  
  330. (if
  331.     (= #sitefilechoice 1)
  332.  
  333.     (textfile
  334.         (include #oldsitefile)
  335.         (include #newsitefile)
  336.         (dest #oldsitefile)
  337.     )
  338. )
  339.  
  340. ; Old sites into group
  341.  
  342. (if
  343.     (= #sitefilechoice 2)
  344.  
  345.     (textfile
  346.         (append "GroupClosed: Old sites\n")
  347.         (include #oldsitefile)
  348.         (append "GroupEnd\n")
  349.         (include #newsitefile)
  350.         (dest #oldsitefile)
  351.     )
  352. )
  353.  
  354. ; Exit
  355.  
  356. (exit #exitmsg)
  357.