.key "NOVERSION/S,NONOTE/S,ARCHIVES/S"
.bra {
.ket }

set Version  "40"
set DiskName "3.1"

; This script will:
;
;   - Bump the WB version number
;   - Update SoftServe:Public
;   - Optionally create archives on the VAX with the latest stuff
;   - Post a log file diff to amiga.release
;
; This script assumes:
;
;  heartofgold:/mount/heartofgold/softeng2/shared is mounted as SHARED:
;

IF NOT {noversion}
  ; Bump the disk version
  Execute V:src/workbench/build/scripts/BumpVersion
EndIF

; Clean up SoftServe:Public
Echo "Deleting obsolete files from SoftServe"
FailAt 21
Delete SoftServe:Public/WorkbenchDisks-Old ALL QUIET FORCE
MakeDir SoftServe:Public/WorkbenchDisks-Old
Rename SoftServe:Public/WorkbenchDisks/Regular SoftServe:Public/WorkbenchDisks-Old QUIET
Rename SoftServe:Public/WorkbenchDisks/HighDensity SoftServe:Public/WorkbenchDisks-Old QUIET
Rename SoftServe:Public/WorkbenchDisks/A4000T SoftServe:Public/WorkbenchDisks-Old QUIET
MakeDir SoftServe:Public/WorkbenchDisks/Regular
MakeDir SoftServe:Public/WorkbenchDisks/HighDensity
MakeDir SoftServe:Public/WorkbenchDisks/A4000T
Copy SoftServe:Public/WorkbenchDisks-Old/Regular/#?.info SoftServe:Public/WorkbenchDisks/Regular QUIET
Copy SoftServe:Public/WorkbenchDisks-Old/HighDensity/#?.info SoftServe:Public/WorkbenchDisks/HighDensity QUIET
Copy SoftServe:Public/WorkbenchDisks-Old/A4000T/#?.info SoftServe:Public/WorkbenchDisks/A4000T QUIET
Delete SoftServe:Public/WorkbenchDisks-Old ALL QUIET FORCE
FailAt 10

; Update SoftServe:
Echo "Building regular Workbench"
V:src/workbench/build/bin/MakeWB V:src/workbench/build/buildlists/wb.bl TO SoftServe:Public/WorkbenchDisks/Regular QUIET LOGFILE "V:src/workbench/build/logfiles/Log_$Version.`type v:src/workbench/libs/version/version_rev.rev`-Regular"

Echo "Building high-density Workbench"
V:src/workbench/build/bin/MakeWB V:src/workbench/build/buildlists/wb.bl TO SoftServe:Public/WorkbenchDisks/HighDensity QUIET SYMBOLS HIGH_DENSITY LOGFILE "V:src/workbench/build/logfiles/Log_$Version.`type v:src/workbench/libs/version/version_rev.rev`-HighDensity"

Echo "Building A4000T Workbench"
V:src/workbench/build/bin/MakeWB V:src/workbench/build/buildlists/wb.bl TO SoftServe:Public/WorkbenchDisks/A4000T QUIET SYMBOLS A4000T HIGH_DENSITY LOGFILE "V:src/workbench/build/logfiles/Log_$Version.`type v:src/workbench/libs/version/version_rev.rev`-A4000T"

IF {archives}
  ; Create archives for the VAX, removing copyrighted files
  Echo "Creating archives for the VAX"
  MakeDir WORK:ReleaseWB-{$$}
  V:src/workbench/build/bin/MakeWB V:src/workbench/build/buildlists/wb.bl TO Work:ReleaseWB-{$$} QUIET MAKEARCS SYMBOLS COPYRIGHT
  Copy WORK:ReleaseWB-{$$}/Workbench$DiskName.LHA SHARED:amiga/V39/disk/archives/wb_$Version_`type v:src/workbench/libs/version/version_rev.rev`.lha
  Copy WORK:ReleaseWB-{$$}/Extras$DiskName.LHA SHARED:amiga/V39/disk/archives/ext_$Version_`type v:src/workbench/libs/version/version_rev.rev`.lha
  Copy WORK:ReleaseWB-{$$}/Storage$DiskName.LHA SHARED:amiga/V39/disk/archives/stor_$Version_`type v:src/workbench/libs/version/version_rev.rev`.lha
  Copy WORK:ReleaseWB-{$$}/Install$DiskName.LHA SHARED:amiga/V39/disk/archives/inst_$Version_`type v:src/workbench/libs/version/version_rev.rev`.lha
  Copy WORK:ReleaseWB-{$$}/Locale.LHA SHARED:amiga/V39/disk/archives/loc_$Version_`type v:src/workbench/libs/version/version_rev.rev`.lha
  Copy WORK:ReleaseWB-{$$}/Fonts.LHA SHARED:amiga/V39/disk/archives/font_$Version_`type v:src/workbench/libs/version/version_rev.rev`.lha

  Delete WORK:ReleaseWB-{$$} ALL QUIET
EndIF

IF NOT {nonote}
  ; Post a release note to amiga.release
  Echo "Generating release note"
  RX V:src/workbench/build/scripts/LogChanges.rexx $Version `type v:src/workbench/libs/version/version_rev.rev`
EndIF

unset Version
unset DiskName
