To begin with, it's impossible to write a howto for add-on packages that covers all bases. In this acticle I will describe the making of a 03x package by going through the steps of an actual package I've made recently. Some packages are relatively easy to make, others are more of a “challenge”.
I do most of my work from the command line, but you're welcome to use f.i. the Midnight Commander add-on package if you want.

I make all my packages in a seperate directory on the hard disk, so I can later always locate the correct package and make modifications if needed. The name of the directory will be the same as the final package, following the package name rules as described in the new http://3rd-party.freescosoft.com/ 3rd party site setup by Howler.
The general rule for a 3rd party add-on package name is:

<packagename>-<version#>-<author>

or:

<packagename>_<version#>_<author>

Where version# is the version of the software your packaging, not the version of your package. The author name can be your real name, but in the FREESCO community this is usally the handle/nickname you're using on the FREESCO forums.

I'm packaging a port of the HTP software in this example, based on the 0.4.4 version, so now I know what my directory/package name should become:

Now run Lightnings package script for the first time, giving it the name of the package you're about to make:

[Linux] package htp_0.4.4_dingetje
Extra text is helpfull inside of the ./pkg/rc/rc_htp
as well as inside of the ./htp_0.4.4_dingetje install script for helping
with understanding what each variable is used for and any
other options that are availible.
Do you want the extra text (y/n) ?y
The files and directories have been generated you can now edit them.
Packager version 2.3 made by Lightning 12/7/2003
Have fun
Lightning

The package script now has created the complete directory structure, as well as a startup script and installation script. Because this is a tutorial I've enabled the extra text, but when you get more experienced, you can answer 'n' to keep the scripts smaller.

Everything in this directory will get installed on the target system in the /pkg/bin directory and as such will be in the search PATH of the target system. It must be used to add (user) commands to the target system. My utils_1.0 package f.i. installs almost completely in this directory.

etc

Most servers require some form of config file that must end up in /etc directory.

home

This directory can be used to install stuff for user's home directories

lib

Most add-on packages require additional library files. These loadable library files (.so extension) must be placed in this directory. An exception is the libc.so.5 file, because this library is always in use on the target system. A special technique is required for upgrading the libc.so.5 file on the target system. I will discuss that later.

man

FREESCO lacks a true man page system, so do NOT place man formatted files in this directory, but rather readable ASCII text files with the package documentation. As a minimum add a few lines of text explaining what the package is for and maybe an internet URL where the original software can be found.

rc

This directory contains the startup/shutdown/firewall script of your package. Not all packages require such a script. A skeleton startup script is already made, but needs editing.

sbin

This directory is intended for secure binaries, typically only needed for the root account or so called daemon binaries.

usr

This directory is intended for add-on software in the /usr path.

addons

In this directory you can place addons for the web control panel.

I've uploaded the complete package from my development work station (a zipslack 3.9 linux) to a directory of my FREESCO FTP server:

The htpdate is a user command to request the time via HTP protocol, so it's placed in the pkg/bin directory.

The htpd is the HTP time deamon that will sync the FREESCO clock via HTP protocol, so this is placed in the pkg/sbin directory.
Now I determine what libraries are required for this binary, by using the ldd (list library dependency) command:

As you can see the libconfig.so lib is missing, so lets add that from the compiled package:

[Linux] cd ../lib
[Linux] cp /mnt/ftp/htp-0.4.4/libconfig.so .

Since this is a loadable library file (.so extension) this lib file is placed in the pkg/lib directory.

[Linux] cd ../etc
[Linux] cp /mnt/ftp/htp-0.4.4/htpd.conf .

The HTP daemon uses a config file htpd.conf which is expected in the /etc directory. By placing this sample file in the pkg/etc directory, the file will end up on the target system in the /etc directory (in ramdisk) via a symlink. Other than in 027 packages where the package author needs to take care of creating these symlinks, the package system of FREESCO 03x does this all automagically.

[Linux] cd ../man
[Linux] edit htp.txt

This is the 'man' file of this package, so I use the editor and copy/paste some information about the package into a file called htp.txt.

[Linux] cat rc_htp
#!/bin/sh
#
# Template for htp version 0.4.4
#. /etc/system.cfg # Uncomment this only if it is needed.
. /etc/colors # Most packages don't need to read the system
# configuration.
fn2() { ps | sed -n '/ htpd/P';
}
# check if program is actually running.
# Usually a <TAB> is required because otherwise this command will
# find it's self and always think your program is running.
# This will usually work where htp is the name of the program.
# But not always. Other parameters may be needed as well.
fn1() { # some internal function if needed.
# Usually this can be removed.
}
stp() {
[ "`fn2`" ] || return # if not running return
echo -n "Stopping htpd... "
killall htpd
= # This just prints done regardless. Which killall has no exit code.
}
str() {
[ "`fn2`" ] && return # if already running return
echo -n "Starting htpd... "
htpd
= $? # test the exit code of the program
# Note: Not all programs will respond correctly to the $?
# if this happens just use =
}
edthlp() { cat <<~
Now you can edit the configuration file(s) for$CY htpd$CW
After you are finished editing the configuration scripts.
Exit and save with$CG <ALT>+<X>$CW or$CG <F10>$CW and then$CG <y>
<ENTER>$CW to continue.
~
}
case "$1" in
firewall) # If you need any firewall settings, just changhe the
# PortNumber to the actual port and include the udp as well
# if needed.
# ipfwadm -I -a deny -P tcp -W $INET -D 0/0 PortNumber -o
# ipfwadm -I -a deny -P udp -W $INET -D 0/0 PortNumber -o
;;
boot) # do boot time hardware init. Not recommended for most programs
;;
setup) # This is called from setup or directly from a command line.
# It should automaticly edit all of the configuration files
# for you program.
#
edthlp
read t
edit /etc/htpd.conf
sync; sync
;;
start) str;;
stop) stp;;
restart)stp;str;;
newip) # called when system gets new IP/DNS address.
;;
status) if [ "`fn2`" ]
then echo "Running htpd"; fn2
else echo No running htpd
fi;;
esac

Lets zoom in a bit on some of these modifications:

fn2() { ps | sed -n '/ htpd/P';
}

This function is called to verify the htpd process is up and running. Because the generated code accidently checked for htp (because of the package name I've picked) instead of htpd, this needed correction.

killall htpd

This line is added in the stp() function to kill all htpd processes.

This next line is added in the str() function to start the htpd process. Because here also fn2() is called to check that the process isn't already running, I don't have to worry about the daemon getting started twice.

htpd

In the setup section I've removed the comments and changed the location of the actual config file, like so:

Almost done! Move up two directories, so I'm back in the directory where the new package installation script resides:

[Linux] cd ../..
[Linux] ls
pkg htp_0.4.4_dingetje
<code>
Now I run Lightning's //**package**// script again with the name of my package as 1st argument:
<code>
[Linux] package htp_0.4.4_dingetje
Unpacked size = 50
Packed size = 18
Version number [0.3.0 0.3.x]
Do you want to automaticly generate the uninstall section (y/n) ?y
************* The uninstall has been generated *******************
This uninstall is just a best guess and HAS to be reviewed.
******************************************************************
You need to review and probably edit install script - htp_0.4.4_dingetje
and put in the uninstall, postinstall, and preinstall sections.
Packager version 2.3 made by Lightning 12/7/2003