This document covers how the code to autopackage is structured and organised internally. If you're looking for how to get involved, this is for you.
There are two central scripts that are necessary for autopackage to function. The first is apkg-funclib which contains a host of shared code. The first section is devoted to general utility routines, such as functions to parse INI files, functions to control terminal colour codes and so on.
The next section deals with communication between the backend and the front end. The output methods write protocol commands to the named pipe.
Next up are the functions necessary for managing the package database and dealing with dependancies. The skeleton files are processed here.
The next section are misc routines used for, amongst other things, building the software ready for extraction, resolving shortnames into root names (ie turning "gimp" into "@gimp.org/gimp/1.3") and processing user interactions. The rest of the library is code for manipulating packages once installed.
The apkg-defs file contains preset constants necessary for autopackage to function. In particular, it contains all the internationalised strings: when dealing with user output, the strings should be placed into this file for easier gettext processing (see bash internationalisation). It also contains some presets so you can customise its behaviour.
The makeinstaller program reads in the *.template files which contain scripts destined to be placed in the package itself. These are read and customised, before being placed into the working directory ready for compression. The stub.template file is placed at the beginning of the file, so if you run it (by typing sh whatever.package) the source is decompressed.