; This is the ScanQuix/Paragon install script
; $VER: 1.2 (18.05.95) © by Andreas Günther

(transcript "ScanQuix installation:")


(set install_sq
  (askbool
    (prompt "\n\n\n\nWhat Operation do you want to perform ?")
    (help "By choosing \"Install ScanQuix\", you can install ScanQuix and the scanner driver(s) on your computer.\nWith the choice \"Remove Installation\", an existing installation of ScanQuix and the scanner drivers can be entirely removed from your System.")
    (choices "Install ScanQuix" "Remove Installation")
    (default 1)
  )
)

(if install_sq
 (
  (set sq_path
    (askdir
      (prompt "Where do you want the \"ScanQuix\" directory to be created ?")
      (help @askdir-help)
      (default @default-dest)
    )
  )


  ; install ScanQuix

  (copyfiles
    (prompt "\n\n\nCopying ScanQuix")
    (help @copyfiles-help)
    (source "ScanQuix:ScanQuix")
    (dest (tackon sq_path "ScanQuix"))
    (all)
    (infos)
    (confirm)
  )


  ; install demo pictures 



  ; install driver

  (copyfiles
    (prompt "Copying driver for Mustek Paragon") 
    (help @copyfiles-help)
    (source "ScanQuix:ScannerDrivers/Paragon")
    (dest "DEVS:ScannerDrivers")
    (infos)
    (confirm)
  )

  (if (exists "LOCALE:" (noreq))
    (
     ; locale is installed, so copy the catalog stuff
      (copyfiles
  	    (prompt "\n\n\nCopying catalog files.")
        (help @copyfiles-help)
        (source "ScanQuix:ScannerDrivers/catalogs/deutsch/Paragon.catalog")
        (dest "LOCALE:Catalogs/deutsch/ScannerDrivers")
        (confirm)
      )
    )
  )

  (set old_user (user 1))   ; always ask

  (set devname
    (askstring
      (prompt "\nPlease enter the name of the SCSI-device for your scanner:")
      (help "You can find the correct name of the \"device\" in the documentation of your SCSI interface card.\nPossible names could be \"scsi.device\", \"squirrelscsi.device\", etc...")
      (default "scsi.device")
    )
  )

  (set unitnr
    (asknumber
      (prompt "\nPlease enter the SCSI unit number of your scanner:")
      (help "You have to type in the correct unit number for your SCSI-device so that the device can address your Scanner correctly.\nUsually, this is the SCSI-ID of the Scanner. For more information about the unit number, consult the documentation of your SCSI-Interface.")
      (default 5)
    )
  )

  (user old_user)

  (tooltype
    (prompt "Installing device name and unit number")
    (help "Modifying the tooltypes of the Paragon scanner driver to the given values.")
    (dest "DEVS:ScannerDrivers/Paragon")
    (settooltype "DEVICE" devname)
    (settooltype "UNIT" (cat unitnr))
    (confirm)
  )

 )
 (  ; else uninstall
  (if (askbool
        (prompt "\n\n\n\nDo you really want to remove all scanner drivers ?\n\nAll settings will be lost !")
        (help "You can reinstall your scanner drivers  at any time, but you will loose the current settings !\n\nYou can remove ScanQuix by dragging its icon into the trahscan.")
        (default 0)
      )

    (
     ; uninstall procedure

      (run "delete DEVS:ScannerDrivers all"
        (prompt "\n\n\nDeleting scanner drivers.")
        (help "You can reinstall the scanner drivers at any time")
        (confirm)
      )

      (delete "DEVS:ScannerDrivers.info"
        (prompt "\n\n\nDeleting scanner drivers.")
        (help "You can reinstall your scanner drivers at any time")
        (confirm)
      )

      (run "delete LOCALE:Catalogs/deutsch/ScannerDrivers all"
        (prompt "\n\n\nDeleting catalog files.")
        (help "You can reinstall your scanner drivers at any time")
        (confirm)
      )

      (delete "ENVARC:Paragon.prefs"
        (prompt "\n\n\nDeleting settings.")
        (help "You can reinstall your scanner drivers at any time")
        (confirm)
      )

      (delete "ENV:Paragon.prefs"
        (prompt "\n\n\nDeleting settings.")
        (help "You can reinstall your scanner drivers at any time")
        (confirm)
      )
    )
  )
 )
)
