; $VER:PPMtoSCR version 2.0 Installation Script 1.0 (22.07.98)

(welcome)

(set #destdir
  (askdir
    (prompt "Please choose where you want to install PPMtoSCR\n"
    "A drawer named \"ppmtoscr\" will be created there.")
    (help @askdir-help)
    (default @default-dest)
  )
)

(set @default-dest (tackon #destdir "ppmtoscr"))

; (makedir @default-dest)

(set #gfxvernum (getversion "graphics.library" (resident)))
(set #gfxver (/ #gfxvernum 65536))
(if (> #gfxver 38)
  (
  ;We have OS3.0 [graphics.library, anyway] or above
  (set #os3 "ppmtoscr_OS3")
  )
  (
  (set #os3 "")
  )

)
  (copyfiles
    (prompt "Select which version(s) of PPMtoSCR you want installed.\n\n"
    "Please remember that the OS3 version of PPMtoSCR is a preview and "
    "is unlikely to give as good results as the standard version.")
    (help @copyfiles-help)
    (source "")
    (choices "ppmtoscr" #os3)
    (dest @default-dest)
    (confirm)
    (infos)
    (optional "fail" "force" "askuser")
  )

(if (> #gfxver 38)
  (set #os3 "XtoILBM")
)

  (copyfiles
    (prompt "PPMtoSCR utilises some external programs.  If you already "
    "have them somewhere in your path, you do not need to install them "
    "again")
    (help @copyfiles-help)
    (source "")
    (choices "ilbmtoppm" "pnmscale" #os3)
    (dest @default-dest)
    (confirm)
    (optional "fail" "force" "askuser")
  )

(if (> #gfxver 38)
  (set #os3 "XtoILBM.readme")
)

  (copyfiles
    (prompt "Do you want to install the documentation for PPMtoSCR?")
    (help @copyfiles-help)
    (source "")
    (dest @default-dest)
    (confirm)
    (choices "PPMtoSCR.guide" #os3)
    (infos)
    (optional "fail" "force" "askuser")
  )

  (copyfiles
    (prompt "Do you want to install the example pictures?")
    (help @copyfiles-help)
    (source "Examples")
    (dest (tackon @default-dest "Examples"))
    (confirm)
    (infos)
    (all)
    (optional "fail" "force" "askuser")
  )

(startup "ppmtoscr"
  (prompt "PPMtoSCR can interface with the NetPBM programs for image "
  "conversion from other formats.  To use PPMtoSCR in scripts, it really "
  "needs to be in your command path.  In addition, this will make it easier "
  "to execute it from the CLI.\n\n"
  "To do this, the following command will be added to your user-startup;\n"
  "PATH \"" @default-dest "\" ADD")
  (help @startup-help)
  (confirm)
  (command "PATH \"" @default-dest "\" ADD")
)

