home *** CD-ROM | disk | FTP | other *** search
/ back2roots/filegate / filegate.zip / filegate / gamesnet / g_amiga / ADFHDNST.ZIP / ADFHDNST.LHA / WHD_Zeewolf / Install < prev    next >
Text File  |  2001-05-29  |  7KB  |  317 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Zeewolf")
  5. (set #CFG_APPSLV  "ZHD")
  6. (set #CFG_APPGUI  "Zeewolf")
  7. (set #CFG_APPVER  "R0501.1")
  8. (set #CFG_APPCOPY "1996-2001")
  9.  
  10. ;================================================================================
  11.  
  12. ;------------------------------------------------------------------------------------
  13. ; Checks if given program is reachable via the path, if not abort install
  14. ;
  15. ; Entry:    #VP1 = name of program to search for
  16.  
  17. (procedure P_CheckRun (
  18.     (if (<> 0 (run (cat "Which " #VP1)))(
  19.         (abort
  20.             (cat
  21.                 "Could not find the program\n\n"
  22.                 "'" #VP1 "'\n\n"
  23.                 "which is required to perform the installation!\n\n"
  24.                 "Please install the '" #VP1 "' program ensuring that"
  25.                 " it is accessible on the path, then try the installation again."
  26.             )
  27.         )
  28.     ))
  29. ))
  30.  
  31.  
  32. ;------------------------------------------------------------------------------------
  33. ; Create installation directories if required
  34.  
  35. (procedure P_InstallDirs (
  36.     ;
  37.     ; Create data dir if required
  38.     ;
  39.     (if (<> 2 (exists #VDATDIR))(
  40.         (makedir #VDATDIR
  41.             (prompt "The directory '" #VDATDIR "' will now be created")
  42.             (help @makedir-help)
  43.             (confirm)
  44.         )
  45.     ))
  46. ))
  47.  
  48.  
  49. ;------------------------------------------------------------------------------------
  50. ; Determine and set information about version of game being installed
  51. ;
  52.  
  53. (procedure P_SetVersionInfo (
  54.     ; if the file exists, set version information
  55.     (if (<= #VVERINFA 0)(
  56.         (if (= 1 (exists #VDATFILE))(
  57.             ; determine version from CRC
  58.             (working "Determining game version")
  59.  
  60.             (set #VT1 (getsum #VDATFILE))
  61.  
  62.             (set #VVERINFA 0)
  63.             (if (= #VT1   769644083) (set #VVERINFA 1))
  64.             (if (= #VT1 -1908897496) (set #VVERINFA 2))
  65.             (if (= #VT1  2133980541) (set #VVERINFA 3))
  66.         ))
  67.     ))
  68. ))
  69.  
  70.  
  71. ;------------------------------------------------------------------------------------
  72. ; Make game data
  73.  
  74. (procedure P_InstallGame (
  75.     ;
  76.     ; Set path to game data file
  77.     ;
  78.     (set #VDATFILE (tackon #VDATDIR "Disk.1"))
  79.  
  80.     ;
  81.     ; Install data files if not found or unknown versions
  82.     ;
  83.     (P_SetVersionInfo)
  84.     (if (<= #VVERINFA 0)(
  85.         ;
  86.         ; Tell user what is happening
  87.         ;
  88.         (message
  89.             (cat
  90.                 "\n\n\nThe installer will now create the game data files\n"
  91.                 "Follow the prompts to insert the game disks when required\n\n"
  92.                 "Click 'Proceed' when ready."
  93.             )
  94.         )
  95.  
  96.         ;
  97.         ; Call the imager slave
  98.         ;
  99.         (working "Creating data files in '" #VDATDIR "'")
  100.  
  101.         (copyfiles
  102.             (prompt "Copying disk image creation slave")
  103.             (help @copyfiles-help)
  104.             (source "ISlave")
  105.             (dest #VDATDIR)
  106.             (nogauge)
  107.             (optional fail force)
  108.         )
  109.  
  110.         (set @execute-dir #VDATDIR)
  111.         (run (cat "RawDIC SLAVE=ISlave"))
  112.         (set @execute-dir #VOLDEXEDIR)
  113.  
  114.         (delete (tackon #VDATDIR "ISlave") (optional force))
  115.     ))
  116.  
  117.     ;
  118.     ; Check the main data file was created and
  119.     ; that we know this version of the game
  120.     ;
  121.     (P_SetVersionInfo)
  122.  
  123.     (if (= 0 #VVERINFA)
  124.         (abort
  125.             (cat    "\n*** UNKNOWN VERSION OF GAME! ***\n\n"
  126.                     "The installer does not recognise the version of the\n"
  127.                     "game that you are trying to install.\n\n"
  128.                     "Please contact the author for further information\n"
  129.             )
  130.         )
  131.     )
  132.  
  133.     (if (= -1 #VVERINFA)
  134.         (abort
  135.             (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  136.                     "The installer could not extract the game data files.\n\n"
  137.                     "Please contact the author for further information\n"
  138.             )
  139.         )
  140.     )
  141. ))
  142.  
  143. ;------------------------------------------------------------------------------------
  144. ; Install WHDLoad slave program
  145.  
  146. (procedure P_InstallSlave (
  147.  
  148.     (working "Installing slave program")
  149.  
  150.     ; first, clean up previous installations
  151.     (set #VT1 (tackon #VDESTDIR "Zeewolf_HD"))
  152.     (if (= 1 (exists #VT1)) (delete #VT1 (optional force)) )
  153.  
  154.     (set #VT1 (tackon #VDESTDIR "Zeewolf_HD.info"))
  155.     (set #VT2 (tackon #VDESTDIR "Zeewolf.info"))
  156.     (if (= 1 (exists #VT2))
  157.         (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  158.         (if (= 1 (exists #VT1)) (rename #VT1 #VT2) )
  159.     )
  160.  
  161.     (set #VT1 (tackon #VDESTDIR "ReadMe_1st"))
  162.     (if (= 1 (exists #VT1)) (delete #VT1 (optional force)) )
  163.  
  164.     (set #VT1 (tackon #VDESTDIR "ReadMe_1st.info"))
  165.     (if (= 1 (exists #VT1)) (delete #VT1 (optional force)) )
  166.  
  167.     ; copy slave program
  168.     (set #VT1 "Slave")
  169.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  170.     (if (>= #VVERINFB 0) (set #VT1 (cat #VT1 #VVERINFB)) )
  171.     (if (>= #VVERINFC 0) (set #VT1 (cat #VT1 #VVERINFC)) )
  172.  
  173.     (copyfiles
  174.         (prompt "Copying slave program")
  175.         (help @copyfiles-help)
  176.         (source #VT1)
  177.         (newname #CFG_APPSLV)
  178.         (dest #VDESTDIR)
  179.         (nogauge)
  180.         (optional fail force)
  181.     )
  182.  
  183.     ; copy GUI program if present
  184.     (if (= 1 (exists "GUI"))(
  185.         (copyfiles
  186.             (prompt "Copying GUI program")
  187.             (help @copyfiles-help)
  188.             (source  "GUI")
  189.             (newname #CFG_APPGUI)
  190.             (dest #VDESTDIR)
  191.             (nogauge)
  192.             (optional fail force)
  193.         )
  194.     ))
  195.  
  196.     ; see if the user wants or needs to install an icon
  197.  
  198.     (set #VT1 (cat #CFG_APPGUI ".info"))
  199.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  200.         ; no icon exists, quietly copy one in
  201.         (set #VT2 1)
  202.     )(
  203.         ; icon exists, ask user if they want to overwrite it
  204.         (set #VT2
  205.             (askbool
  206.                 (prompt (cat "Do you want to replace the \"" #CFG_APPGUI "\" icon (recommended) ?"))
  207.                 (default 1)
  208.                 (help @askchoice-help)
  209.             )
  210.         )
  211.     ))
  212.  
  213.     ; install the icon if required
  214.     (if (= 1 #VT2)(
  215.         ; get choice of icon format
  216.         (set #VT3
  217.             (askchoice
  218.                 (prompt "Which type of icon would you like to install?")
  219.                 (choices "Standard" "NewIcon" "OS3.5+ Coloricon")
  220.                 (help @askchoice-help)
  221.             )
  222.         )
  223.         (if (= 0 #VT3) (set #VT3 ".oi"))
  224.         (if (= 1 #VT3) (set #VT3 ".ni"))
  225.         (if (= 2 #VT3) (set #VT3 ".ci"))
  226.  
  227.         ; install the icon
  228.         (copyfiles
  229.             (prompt "Copying icon")
  230.             (help @copyfiles-help)
  231.             (source (cat "Icon" #VT3))
  232.             (newname #VT1)
  233.             (dest #VDESTDIR)
  234.             (nogauge)
  235.             (optional fail force)
  236.         )
  237.     ))
  238. ))
  239.  
  240. ;------------------------------------------------------------------------------------
  241. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  242.  
  243. ;
  244. ; Initialise
  245. ;
  246. (set @app-name #CFG_APPNAME)
  247. (set #VOLDEXEDIR @execute-dir)
  248. (set #VVERINFA -1)
  249. (set #VVERINFB -1)
  250. (set #VVERINFC -1)
  251. (set #VDESTDIR @default-dest)
  252.  
  253. ;
  254. ; Check settings
  255. ;
  256. (if    (<> @user-level 2)
  257.     (abort "You must select 'Expert' user level")
  258. )
  259.  
  260. (if    (< @installer-version 2818051)
  261.     (abort "This product requires at least version 43.3 of the Installer program")
  262. )
  263.  
  264. ;
  265. ; Check required programs are available
  266. ;
  267. (set #VP1 "RawDIC")
  268. (P_CheckRun)
  269. (set #VP1 "WHDLoad")
  270. (P_CheckRun)
  271.  
  272. ;
  273. ; Welcome message
  274. ;
  275. (message "\n\n\nWelcome to the " #CFG_APPNAME " HD Installer " #CFG_APPVER "\n\n"
  276.          "⌐ " #CFG_APPCOPY " Halibut Software\n\n"
  277.          "Please read the documentation thoroughly "
  278.          "before attempting to use this installer!\n\n"
  279.          "Click 'Proceed' to begin..."
  280. )
  281.  
  282. ;
  283. ; Get directory to install in
  284. ;
  285. (set #VDESTDIR
  286.     (askdir
  287.         (prompt "Where would you like the game installed?\n"
  288.                 "If you have an existing installation select that directory,\n"
  289.                 "otherwise create / select the directory to install the game into."
  290.         )
  291.         (help @askdir-help)
  292.         (default @default-dest)
  293.         (disk)
  294.         (newpath)
  295.     )
  296. )
  297. (set #VDESTDIR (expandpath #VDESTDIR))
  298. (set @default-dest #VDESTDIR)
  299. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  300.  
  301. ;
  302. ; Create the installation directories
  303. ;
  304. (P_InstallDirs)
  305.  
  306. ;
  307. ; Install the game data
  308. ;
  309. (P_InstallGame)
  310.  
  311. ;
  312. ; Install the slave
  313. ;
  314. (P_InstallSlave)
  315.  
  316. ;====================================================================
  317. ;$VER: Zeewolf Installer script R0501.1 ⌐ 1996-2001 Halibut Software