Version 12 of SPITE

Updated 2006-10-18 20:54:11

SPITE - Simple Packager and Installer for Tcl Extensions

Directions to find it at Stu

README:

 SPITE is a utility to package Tcl scripts and other
 text files for easy distribution and installation.
 SPITE is designed mainly for unix systems.
 SPITE takes a list of files and puts them
 and the installer code into a shell script.
 This shell script may then be used to install the extension.
 The idea behind SPITE is to provide a simple way to distribute
 mostly non-binary Tcl extensions consisting of a handful of text files.
 Textual input files must terminate with a newline or SPITE will break.
 When installing files of type 'tclscript', the installer will pass
 the file through sed with one or both of the following regexps:
 "1,5s/exec .*tclsh[^ ]*/exec ${TCLSH}/g"
 "1,5s/exec .*wish[^ ]*/exec ${WISH}/g"
 This requires sed and mktemp on the target system.
 Checksumming may be disabled during install with --sum ""

 Useage:
   spite [-f configfile]

 Will write to stdout a .spite installer file based
 on the configuration in configfile.


 BUGS
   For directories, ownership is changed only for the last dir in a path.

Fully documented config file (spite.conf):

 # SPITE config file
 #
 # 2004 - Stuart Cassoff
 #
 # This config is very simple.
 # This file is [sourced] by spite.
 # Errors should show up quickly.
 #


 # This will appear at the top of the spite file
 # default is ""
 comment "SPITE - Simple Packager and Installer for Tcl Extensions"


 # Destination dir tail
 # Probably the name of the program
 # Almost always needed
 # default is ""
 appdir spite


 # Version info
 # default is ""
 version 0.2


 # Author info
 # default is ""
 author "Stuart Cassoff"


 # Homepage url
 # default is ""
 homepage "http://www.fivetones.net/software/"


 # Distribution file url
 # default is ""
 distfile "http://www.fivetones.net/software/spite-0.2.spite.gz"


 # Base dir for source files
 # default is "."
 #srcdir /home/stu/tcl/netutil


 # Install prefix
 # default is "/usr/local"
 #prefix /opt 


 # Bin dir
 # Installed as $prefix/$bindir
 # default is 'bin'


 # Lib dir
 # Installed as $prefix/$libdir
 # default is "lib"
 #libdir mylibdir


 # Script dir
 # If "" - this will become $libdir/$appdir
 # default is ""
 #scriptdir myscriptdir


 # Man dir
 # Installed as $prefix/$mandir
 # default is "man"
 #mandir mymandir


 # Doc dir
 # Installed as $prefix/$docdir
 # default is "share/doc"
 #docdir mydocdir


 # Example dir
 # Installed as $prefix/$docdir
 # default is "share/examples"
 #docdir myexampledir


 # Configuration dir
 # If "" - this will become $libdir/$appdir
 # default is ""
 #confdir myconfdir


 # Mask for datafiles
 # default is "0444"
 #datamask 0644


 # Mask for script files
 # default is "0555"
 #scriptmask 0755


 # Name of program to checksum files.
 # set to "" will turn off checksumming
 # default is "md5"
 #sum rmd160
 #sum ""

 # How to encode binary files
 # default is "uuencode -p"
 #encode "base64 -e"


 # How to decode binary files
 # default is "uudecode"
 #decode "base64 -d"


 # Add files to install
 # addfile sname dir mask ?type? ?iname?
 # "sname" is where file is located now (source name)
 # relative to "srcdir"
 # destdir for file is "prefix" + "dir"
 # If destdir is one of appdir, bindir, libdir,
 # scriptdir, mandir, docdir or exdir then
 # the named dir from the setup will be used.
 # "mask" is numerical mask or name
 # "mask" type "data" will use "datamask"
 # "mask" type "script" will use "scriptmask"
 #
 # "type" can be "tclscript", "binary", "text",
 # "readme", "license"  or ""
 #
 #
 # if "type" is "tclscript" it will be treated the same
 # as "text" except that tclsh/wish path resolution will
 # be performed during install
 #
 # if "type" is "readme" it will be treated the same
 # as "text" except that it will enable a command line 
 # option allowing the user to view the readme before installing
 #
 # if "type" is "license" it will be treated the same
 # as "text" except that it will enable a command line 
 # option allowing the user to view the readme before installing
 #
 # if "type" is "binary" then the file will be uuencoded/decoded
 # if "type" is "text" or "" then normal processing will occur
 #
 #       sname                   destdir      mask    type        iname
 #----------------------------------------------------------------------
 addfile ../common/LICENSE       docdir       data    license
 addfile README                  docdir       data    readme
 addfile spite.tcl               bindir       script  tclscript   spite
 addfile spite.conf              exdir        data
 #----------------------------------------------------------------------


 # EOF

Example usage:

 $ gunzip < spite-0.2.spite.gz | sh -s -- --help
 SPITE 0.2 Installer for  * SPITE - Simple Packager and Installer for Tcl Extensions *
 Useage: sh --install [option value ...]
 Install options:
 --install            Perform installation
 --appdir      dir    Usually the name of the app [spite]
 --prefix      dir    Install prefix [/usr/local]
 --bindir      dir    Executable files dir [$prefix/bin]
 --libdir      dir    Library files dir  [$prefix/lib]
 --scriptdir   dir    Script files dir [$prefix/lib/spite]
 --mandir      dir    Man files dir  [$prefix/man]
 --docdir      dir    Documentation files dir [$prefix/share/doc/$appdir]
 --exdir       dir    Example files dir [$prefix/share/examples/$appdir]
 --confdir     dir    Configuration files dir [$prefix/lib/spite]
 --tmp         dir    Dir used during installation for temporary files [/tmp]
 --user        user   Install files as user:group  User and group must
 --group       group  both be specified if "chown" is to be performed
 --datamask    mask   Mask for data files [0444]
 --scriptmask  mask   Mask for executable files [0555]
 --tclsh       file   Path to tclsh []
 --wish        file   Path to wish []
 --sed         file   Sed program [sed]
 --sum         file   Checksum program ("" will disable checksumming) [md5]
 --destdir     dir    Super-prefix installation dir, does not affect --tmp []
 --quiet              Do not display installation messages
 --fake               Show messages, do not perform actions
 --info               Display program info
 --readme             Display readme
 --license            Display license
 --help               This information


 $ gunzip < spite-0.2.spite.gz | sh -s -- --info                            
 COMMENT  : SPITE - Simple Packager and Installer for Tcl Extensions
 AUTHOR   : Stuart Cassoff
 VERSION  : 0.2
 HOMEPAGE : http://fivetones.net/software/
 DISTFILE : http://fivetones.net/software/spite-0.2.spite.gz


 $ mkdir /tmp/test
 $ gunzip < spite-0.2.spite.gz | sh -s -- --destdir /tmp/test --install
 Installing /tmp/test/usr/local/share/doc/spite/LICENSE : sum ok
 Installing /tmp/test/usr/local/share/doc/spite/README : sum ok
 Installing /tmp/test/usr/local/bin/spite : sum ok
 Installing /tmp/test/usr/local/share/examples/spite/spite.conf : sum ok

It's also possible to install over the web using wget or http:

 $ echo 'package require http; set r [http::geturl http://www.mysite.net/mydir/spite-0.2.spite.gz -binary 1]; fconfigure stdout -translation binary; puts -nonewline stdout [http::data $r]' | tclsh | gunzip | sh -s -- --install

 $ wget -q -O - http://www.mysite.net/mydir/spite-0.2.spite.gz | gunzip | sh -s -- --install

Category Distribution