; Simple script to install AlbIn_MUI
; Install_AlbIn_MUI © 1995 Niklas Dahlman, Sirius Design
;
; $VER: Install_AlbIn_MUI 1.04 (95.05.03)



(message "\n\n\n\nYou are about to install\n\nAlbIn_MUI\n\nThe ultimate music database.\n")

(set installto
   (askchoice
      (prompt "Select the type of disk you\nwant to install to\n")
      (default 0)
      (choices "Hard Disk" "Floppy Disk")
      (help @askchoice-help)
   )
)


(if (not (exists "AlbIn_MUI.lha"))
   (
   (message "Failure: Did not find AlbIn_MUI.lha" )
   (exit (quiet))
   )
)

(set installdest
   (askdir
      (prompt "Into which drawer should\nthe AlbIn_MUI package\n be installed?\nNo drawer will be created!")
      (help @askdir-help)
      (if (= installto 0 )
         (default "Work:")
      )
      (if (= installto 1 )
         (default "DF0:")
      )
   )
)

(set endof
   (strlen installdest)
)

(set endof (- endof 1))

(set lastchar
   (substr installdest endof)
)

(if (<> lastchar ":")
    (set idest (cat installdest "/"))
    (set idest installdest)
)

(set installdest idest)


;*** main stuff, both HD and floppy
;***

(set installfile "AlbIn_MUI.lha")

(set lhacommands (cat '"'installfile'"' ' ' '"'installdest'"'))
(set @default-dest installdest)
(working "\n\nExtracting archive: AlbIn_MUI.LhA")
(run "LhA -x x "lhacommands)

;*** HD bonus databaser
;***

(if (= installto 0 )
   (
   (if (not (exists "AlbIn_MUI_DB.lha"))
      (
      (message "Failure: Did not find AlbIn_MUI_DB.lha\n\nExtra databases not installed" )
      (exit "Incomplete intallation completed" )
      )
   )

   (set installfile "AlbIn_MUI_DB.lha")

   (set lhacommands (cat '"'installfile'"' ' ' '"'installdest'Databases/''"'))
   (set @default-dest installdest)
   (working "\n\nExtracting archive: AlbIn_MUI_DB.LhA")
   (run "LhA -x x "lhacommands)
   )

)

;*** om vi installerar till disk
;*** så installera bonus databaserna på en ny disk

(if (= installto 1 )
   (
   (set wanna
      (askbool
         (prompt "\nInstall bonus databases?\n\nIf Yes insert a new formatted disk")
         (help @askchoice-help)
         (default 0)
      )
   )

   (if (= wanna 0)
      (exit "Incomplete intallation completed" )
   )
   
   (if (not (exists "AlbIn_MUI_DB.lha"))
      (
      (message "Failure: Did not find AlbIn_MUI_DB.lha\n\nExtra databases not installed" )
      (exit (quiet))
      )
   )

   (set installdest
      (askdir
         (prompt "Into which drawer should\nthe extra AlbIn_MUI databases\n be installed?")
         (help @askdir-help)
         (default (cat installdest "Databases"))
      )
   )

   (set endof
      (strlen installdest)
   )

   (set endof (- endof 1))

   (set lastchar
      (substr installdest endof)
   )

   (if (<> lastchar ":")
      (set idest (cat installdest "/"))
      (set idest installdest)
   )

   (set installdest idest)

   (set installfile "AlbIn_MUI_DB.lha")

   (set lhacommands (cat '"'installfile'"' ' ' '"'installdest'"'))
   (set @default-dest installdest)
   (run "LhA -x x "lhacommands)
   )
)


(exit "Operation completed")
