; 000627 T.Neidhardt, ft112@fen-net.de, EasySystem
; AmigaShell script
; Script for update.

;-------------------------------- variables
failat 30
stack 40000

set app EASys!
set EASYSVER 4.8.1

;-------------------------------- preparations

c:relabel RAM: RAM-Disk
assign "RAM Disk:" RAM: ADD
unalias lha
unalias list

version >NIL: workbench.library 44
IF warn
 setenv osver 3.x
ELSE
 setenv osver 3.5
ENDIF

; Arq may cause heavy problems while installing on OS3.5:
c/CLIExchange "Arq 1.83" KILL
c/CLIExchange "Arq" KILL

assign iGuide: ""
assign Install_C: c

;--------------------------------
LAB UPDATE

echo "*n*n Performing update..*n"
Install_C:CLIExchange MultiNotify DISABLE
Install_C:CLIExchange ToolManager KILL
wait 2

delete >NIL: ENVARC:Flags QUIET
delete >NIL: ENV:Flags QUIET
makedir >NIL: ENVARC:Flags QUIET
makedir >NIL: ENV:Flags QUIET

delete >NIL: ENVARC:Flags/Boot_Menu QUIET
delete >NIL: ENV:Flags/Boot_Menu QUIET
delete >NIL: SYS:StartSys/Profile/Flags/Boot_Menu QUIET

protect >NIL: ENVARC:ToolManager.prefs +wd
protect >NIL: ENV:ToolManager.prefs +wd
protect >NIL: EASys!:Config/ToolManager.prefs +wd

delete >NIL: EASys!:dock QUIET
copy iGuide:EASys! SYS:EASys! CLONE ALL QUIET
assign Dock: EASys!:Dock
delete >NIL: SYS:Prefs/Dock#? FORCE ALL QUIET

if exists SYS:StartSys
 copy iGuide:StartSys SYS:StartSys CLONE ALL QUIET
endif

copy iGuide:SYS/#? SYS: CLONE ALL QUIET

;--------------------------------
echo "*n Finishing EASys! setup*n"
delete >NIL: EASys!:Prefs/#?/GUI-SnapReqSizes.3 QUIET

if not exists SYS:EASys!/bin/ToolManager
 if exists profile:wbstartup/ToolManager
  delete SYS:StartSys/Profiles/#?/wbstartup/ToolManager#? FORCE QUIET
 endif

 if exists profile:wbstartup/MultiNotify
  delete SYS:StartSys/Profiles/#?/wbstartup/MultiNotify#? FORCE QUIET
 endif


 if exists SYS:Commodities/ToolManager
  copy SYS:Commodities/ToolManager#? SYS:EASys!/bin CLONE QUIET
  delete SYS:Commodities/ToolManager#? FORCE QUIET
 endif

 if exists SYS:Tools/Commodities/ToolManager
  copy SYS:Tools/Commodities/ToolManager#? SYS:EASys!/bin CLONE QUIET
  delete SYS:Tools Commodities/ToolManager#? FORCE QUIET
 endif

 if exists SYS:WBstartup/ToolManager
  copy SYS:WBstartup/ToolManager#? SYS:EASys!/bin CLONE QUIET
  delete SYS:WBstartup/ToolManager#? FORCE QUIET
 endif

 if exists "SYS:WBstartup (enabled)/ToolManager"
  copy "SYS:WBstartup (enabled)/ToolManager#?" SYS:EASys!/bin CLONE QUIET
  delete "SYS:WBstartup (enabled)/ToolManager#?" FORCE QUIET
 endif
endif

if not exists SYS:EASys!/bin/MultiNotify
 if exists SYS:Commodities/MultiNotify
  copy SYS:Commodities/MultiNotify#? SYS:EASys!/bin CLONE QUIET
  delete SYS:Commodities/MultiNotify#? FORCE QUIET
 endif

 if exists SYS:Tools/Commodities/MultiNotify
  copy SYS:Tools/Commodities/MultiNotify#? SYS:EASys!/bin CLONE QUIET
  delete SYS:Tools Commodities/MultiNotify#? FORCE QUIET
 endif

 if exists SYS:WBstartup/MultiNotify
  copy SYS:WBstartup/MultiNotify#? SYS:EASys!/bin CLONE QUIET
  delete SYS:WBstartup/MultiNotify#? FORCE QUIET
 endif

 if exists "SYS:WBstartup (enabled)/MultiNotify"
  copy "SYS:WBstartup (enabled)/MultiNotify#?" SYS:EASys!/bin CLONE QUIET
  delete "SYS:WBstartup (enabled)/MultiNotify#?" FORCE QUIET
 endif
endif

copy EASys!:Config/ToolManager.prefs ENV: CLONE QUIET
EASys!_bin:WBrun EASys!:Config/ToolManager.prefs

;--------------------------------
copy iGuide:Init/EASys! T: CLONE QUIET
if exists ENV:EASys!
  type iguide:Init/EASys!.ENV >>T:EASys!
else
  type iguide:Init/EASys!.HD >>T:EASys!
endif
type iguide:Init/EASys!.aliases >>T:EASys!

if exists SYS:StartSys
 echo "*n Finishing ModAS setup..*n"
 copy T:EASys! SYS:StartSys/c_Prepare CLONE QUIET
else
 echo "*n User-Startup..*n"
 rx EASys!_rexx:remoteed.rexx T:EASys! ";BEGIN EASys" ";END EASys" S:User-startup
endif

;-------------------------------- corrections
if exists SYS:StartSys
 Install_C:ReplaceStrings SYS:StartSys/e_WB/4_StartShell "s:Shell-Startup.std" "AAASHELLSTARTUP"
 Install_C:ReplaceStrings SYS:StartSys/e_WB/4_StartShell "AAASHELLST" "$SHELLST"
 Install_C:ReplaceStrings SYS:StartSys/c_Prepare/DDconv "if exists ENV:Flags/StartVerbose" "if AAA{Flags/StartVerbose} eq 1" I
 Install_C:ReplaceStrings SYS:StartSys/c_Prepare/DDconv "AAA{" "${" I
endif

set dir SYS:
if exists ${dir}SayTime
 skip repsaytime
endif

assign >NIL: Work: exists
if not warn
 set dir Work:
 if exists ${dir}SayTime
  skip repsaytime
 endif
 set dir Work:Tools/
 if exists ${dir}SayTime
  skip repsaytime
 endif
 set dir Work:Utilities/
 if exists ${dir}SayTime
  skip repsaytime
 endif
 set dir Work:Sound/
 if exists ${dir}SayTime
  skip repsaytime
 endif
 set dir Work:Audio/
 if exists ${dir}SayTime
  skip repsaytime
 endif
endif

set dir SYS:Tools/
if exists ${dir}SayTime
 skip repsaytime
endif
set dir SYS:Tools/Sound/
if exists ${dir}SayTime
 skip repsaytime
endif
set dir SYS:Sound/
if exists ${dir}SayTime
 skip repsaytime
endif
set dir SYS:Utilities/
if exists ${dir}SayTime
 skip repsaytime
else
 skip FINISH
endif

LAB repsaytime
Install_C:ReplaceStrings ${dir}SayTime/SageUhrzeit.rexx "Media:Sound/SayTime/Klang" "${dir}SayTime/Klang"
Install_C:ReplaceStrings ${dir}SayTime/SageUhrzeit.rexx "Audio:bin/dsound" "AAA{RefTable/Sound-Voice}"
Install_C:ReplaceStrings ${dir}SayTime/SageUhrzeit.rexx "AAA{" "${"

;--------------------------------
LAB FINISH

protect SYS:EASys!/Help/EASys!.version +rwd
echo >SYS:EASys!/Help/EASys!.version "$EASYSVER"
protect SYS:EASys!/Help/EASys!.version -wd

echo "*n*n Do you want an EASys! Workbench backdrop picture?*n"
echo " [1] 1024x768 EASys! Dolphin"
echo " [2]  800x600 EASys! Dolphin"
echo " [3]  640x480 EASys! Dolphin"
echo " [0] None."
echo "*n ---> Please enter your choice: " NOLINE
set >NIL: input ?

if $input eq 1
 rx EASys!:Prefs/EasyPattern.rexx -wbpat SYS:Prefs/Presets/Patterns/EASys!/easys_1024x768.jpg
endif
if $input eq 2
 rx EASys!:Prefs/EasyPattern.rexx -wbpat SYS:Prefs/Presets/Patterns/EASys!/easys_800x600.jpg
endif
if $input eq 3
 rx EASys!:Prefs/EasyPattern.rexx -wbpat SYS:Prefs/Presets/Patterns/EASys!/easys_640x480.jpg
endif

echo "*n .. update done. Please restart system."
wait 10
cd SYS:
endcli

;--------------------------------
lab ERROR
echo "*ec*n*e[1m Error installing $app:*e[0m*n*n The following files must be in this directory:*n*n $app.lha*n Install_Guide*n $app_iGuide.lha*n Lha*n*n*n Your version is*e[1m not up to date*e[0m or it is*e[1m incomplete*e[0m.*n*n Closing this window 1
wait 15
cd SYS:

