Build and Release Virtualmin Packages

When a new Virtualmin module is ready to be released, the following steps can be used to create, sign, and add them to the repositories.

There are three package types, and RPM and deb packages must be built on systems specific to those package types. We build RPMs on a CentOS 5 VM and debs on a Debian 5 VM. I usually build the wbm.gz package on the CentOS VM, though it can be built pretty much anywhere with a Webmin installation and the module you want to package.

In the examples below, I'll use the virtual-server module. Update paths to reflect whatever module is being deployed.

**RPM**

Login to srv2

$ ssh -l root 10.20.144.138

Login to the VM with our usual VM root password (ask Joe if you don't know it).

# su - build

All of the build scripts and repo management scripts and repos are setup for the build user. The build user also has a deploy key at github, so they can pull from our private repos.

$ cd virtualmin
$ git pull
$ cd /usr/libexec/webmin
$ rm virtual-server
$ ln -s /home/build/virtualmin/modules/branches/virtual-server/3.80 virtual-server
$ makemodulerpm.pl --sign --epoch 2 --licence "Copyright 2005-2010 Virtualmin, Inc." --rpm-depends --allow-overwrite --rpm-dir /home/build/redhat/ --target-dir /home/build/redhat virtual-server
*Note that the passphrase for the signing key is empty. Just hit "enter" when it prompts.*
$ mv /home/build/redhat/RPMS/noarch/virtual-server-3.80.noarch.rpm /mnt/result/universal

The path for the GPL version of the virtual-server RPM is:

/mnt/result/gpl/universal

**wbm**

$ create-module.pl /mnt/result/wbm/virtual-server-3.80.wbm.gz virtual-server

**deb**

$ ssh -l root 10.20.144.141
# su - build
$ cd virtualmin
$ git pull
$ cd /usr/share/webmin
$ rm virtual-server
$ ln -s /home/build/virtualmin/modules/branches/virtual-server/3.80 virtual-server
$ makemoduledeb.pl --deb-depends --licence "Copyright 2005-2010 Virtualmin, Inc." --allow-overwrite --dsc-file /tmp/webmin-virtual-server_3.80.dsc virtual-server
$ debsign /tmp/webmin-virtual-server_3.80.dsc
$ cptoall.sh /tmp/webmin-virtual-server_3.80.dsc
$ cptoall.sh /tmp/webmin-virtual-server_3.80_all.deb

The path for the deb is complicated (one for every debian/ubuntu version, though we're moving to a new universal repo as we use in RPM systems). There are scripts for managing things, mostly found on srv2 in the build user's bin, discussed in the repo management section.

**Repository management**

A few things have to happen when deploying any new modules.

1. Link the new packages into the GPL repositories, or in the case of the virtual-server module, download it and copy it across to all repos that need it (for Debian/Ubuntu). This is done on srv2, with the *link-gpl.sh* script. Just run it with no options once your package updates are in place in all of the Professional repositories (note that this cptoall.sh on the Debian build system puts everything in place for the link-gpl.sh script to work for Debian/Ubuntu, so if you followed all the steps above, you'll have all of the professional repos in a state that is suitable for the link-gpl.sh script).

2. Copy the GPL module into place with the *cptodebgpl.sh* script, found on srv2. *cptodebgpl.sh /path/to/webmin-virtual-server_3.80_all.deb*. (This script could also be installed and run with minor modifications on the debian build VM, but I think of this step as a repo maintenance step rather than build step.)

3. Update the Debian meta-data. This has to happen *after* the link-gpl.sh script, and has to run on the debian build system, as the build user. The script to do this is *updateapt.sh*.

4. Sync the repository. From srv2, as build user, run *rsync-virtualmin.sh*

5. Update the yum meta-data and wbm meta-data. This currently runs *on virtualmin.com*, which is somewhat weird, but it allows me to easily build, sync, and test the new Virtualmin version on two live systems (srv2, virtualmin.com) before making it accessible to the world. This is done with *update-repo.sh*, as the virtualmin user. (This can also be done via ssh from srv2 if you don't have the virtualmin user details handy, since build has the virtualmin key for full ssh access.)

**Post the changelog or notice of update**

Post the changelog on http://www.virtualmin.com/forums/news

I use the following command in vim to markdown unordered list in the CHANGELOG file:

:1,$s/^/ * /g

And then just copy/paste the relevant bit into the forum post.