;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; MegaTop Installation-Script v1.0
;;; Copyright (c) 1995 Looby/Insane
;;; All rights reserved
;;;
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(procedure
 ask-files
 (set cpyfiles
  (askoptions
   (prompt "Select install options")
   (help "* MegaTop        : The executable\n"
         "* MegaTop Guide  : The documentation\n"
         "* Design Files   : Various design files with a\n"
         "                   example output\n"
         "* Example Scrips : Example of a LOGOFF script and a\n"
         "                   MegaTop script")
   (choices "MegaTop" "MegaTop Guide" "Design files" "Example Scripts" )
  )
 )

 (if (in cpyfiles 0 )
  (copy-main)
 )

 (if (in cpyfiles 1 )
  (copy-doc)
 )

 (if (in cpyfiles 2 )
  (copy-dsg)
 )

 (if (in cpyfiles 3 )
  (copy-examples)
 )
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 chk-assign

 (if ( NOT (exists "DOORS:" (noreq)))
  (abort "DOORS: assign is missing!")
 )                           

 (if ( NOT (exists "T:" (noreq)))
  (abort "T: assign is missing!")
 )                           

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 copy-dsg

 (if ( NOT (exists "DOORS:MegaTop/Dsg" (noreq)))
  (makedir "DOORS:MegaTop/Dsg")
 )

 (copyfiles
  (source "dsg")
  (all)
  (dest   "DOORS:MegaTop/Dsg")
 )

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 copy-examples

 (if ( NOT (exists "DOORS:MegaTop/Examples" (noreq)))
  (makedir "DOORS:MegaTop/Examples")
 )

 (copyfiles
  (source "examples")
  (all)
  (dest   "DOORS:MegaTop/Examples")
 )

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 copy-main

 (copyfiles
  (source "MegaTop" )
  (dest   "DOORS:MegaTop")
 )

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 copy-doc

 (copyfiles
  (source "MegaTop.guide")
  (dest   "DOORS:MegaTop")
 )

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 fix-path

 (if ( NOT (exists "DOORS:MegaTop" (noreq)))
  (makedir "DOORS:MegaTop")
  (delete "DOORS:MegaTop")
 )

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Installation sequence

(welcome "    Welcome to the " @app-name " 2.0 version installation.\n")
 (chk-assign)
 (fix-path)
 (ask-files)
 (set @default-dest "DOORS:MegaTop")
(message "\nInstallation complete!\n"
         "MegaTop can be found in your DOORS:MegaTop drawer\n\n"
         "See the documentation for more information\n"
         "about usage/setup" )
(exit (quiet))
