.key RELEASENAME/A,BASENAME/A,VERSIONFILE/A,SOURCE/A,ROOT/A,IDS/A,CLEAN/S
.bra {
.ket }
;
; $VER: build-aminet 37.6 (04 Apr 1996)
;
; (C) Copyright 1996 Marius Gröger
;     All Rights Reserved.
;
; AmigaShell script to create an Aminet/Meeting Pearls release.
; The options in detail:
;
;    RELEASENAME
;        Unfortunately, the filing system used for Aminet CDs is only
;        capable of maintaining file names up to 21 characters length.
;        This parameter takes care of this: ideally meaning the same as
;        BASENAME, it should by an acronym for it.
;
;    VERSIONFILE
;        File to retrieve version/revision from.
;
;    BASENAME
;        Basename of the distribution.
;
;    SOURCE
;        Source file which contains the readme body text. The Aminet header
;        infos will be prepended.
;
;    ROOT
;        Distribution root directory. Here goes the readme to, and this is
;        what will be archived.
;
;    IDS
;        Textfile containing Aminet/MP classification and header information
;
;    CLEAN
;        If set, previous readmes are deleted.
;
;
; --------------------- customize this -----------------------
Set LHA "C:Lha"
Set TAR "C:tar"
Set PACKDIR "DH0:Ablage"
Set LOGDIR "VAR:log"
; ----------------- end of customization ---------------------

If EQ "CLEAN" {CLEAN}
   Echo "=== removing obsolete readme's ==="
   Delete QUIET "{ROOT}/{RELEASENAME}(%|[0-9])[0-9].[0-9](%|[0-9])(%|[0-9]).readme"
Endif

If NOT EXISTS $PACKDIR/{RELEASENAME}
  Makedir $PACKDIR/{RELEASENAME}
EndIf
Delete QUIET $PACKDIR/{RELEASENAME}/#?

Set relname "`version file {VERSIONFILE}`"
Set version `rx "say word('$relname',2)"`
Set relname {RELEASENAME}$version
Type {IDS}    >>{ROOT}/$relname.readme
Echo "Version: " $version >>{ROOT}/$relname.readme
Type {SOURCE} >>{ROOT}/$relname.readme
Copy {ROOT}/$relname.readme $PACKDIR/{RELEASENAME}/

Echo "=== creating lha archive ==="
S:PCD //
$LHA a -x -r $PACKDIR/{RELEASENAME}/$relname.lha {BASENAME}/~(#?.(gst|lnk|o|(opt0[0-9]0))) {BASENAME}.info
S:PCD
Echo "=== creating log file ==="
Echo "-------------------------------------------------------------" >>$LOGDIR/{BASENAME}
Echo "Distribution: {BASENAME}"                                      >>$LOGDIR/{BASENAME}
Echo "Date: `date`"                                                  >>$LOGDIR/{BASENAME}
Echo "Archive name: $relname.lha"                                    >>$LOGDIR/{BASENAME}
Echo "-------------------------------------------------------------" >>$LOGDIR/{BASENAME}
$LHA t $PACKDIR/{RELEASENAME}/$relname.lha                           >>$LOGDIR/{BASENAME}
Echo "-------------------------------------------------------------" >>$LOGDIR/{BASENAME}
Echo "ok."                                                           >>$LOGDIR/{BASENAME}
Echo "-------------------------------------------------------------" >>$LOGDIR/{BASENAME}
Echo ""                                                              >>$LOGDIR/{BASENAME}

Echo "=== creating tar archive ==="
$TAR cvCf $PACKDIR $PACKDIR/{RELEASENAME}.tar {RELEASENAME}

UnSet relname
UnSet TAR
UnSet LHA

Echo "=== ready ==="

