Modify a package

Maybe there is a bug you want to fix, or you developed a new cool feature, or someone sent you a patch. So you want to modify an existing package. This article gives some hints on how to do that.

Obtain package source
First you need to obtain the build environment source: cd /usr/src/ git clone http://git.vyatta.com/build-iso.git cd build-iso git branch $BRANCH --track origin/$BRANCH git checkout $BRANCH $BRANCH is a meta variable for the branch you want to modify, e.g. oxnard. Consult Version history if not sure, typically you want the branch corresponding to the current stable release.
 * 1) get the actual source from vyatta using git

However, this will not give you the source code of all packages. The source tree is broken into submodules so you do not have to obtain the full source (which is huge) and only download source of components you are working on.

To obtain source code of a particular package, find its directory in build-iso/pkgs. If not sure, you may try to find out what package owns a file you want to modify with dpkg -S /path/to/file like dpkg -S /opt/vyatta/sbin/vyatta-qos.pl which yields: vyatta-cfg-qos: /opt/vyatta/sbin/vyatta-qos.pl

If you have no idea what files are related to the feature you are interested in, find templates in /opt/vyatta/share/vyatta-cfg/templates and/or /opt/vyatta/share/vyatta-op/templates on your router, see what files they refer to and return to previous step about dpkg.

If nothing helps, ask on the forums or IRC. This is not so unlikely, as there are some files that are installed/generated by package post-install scripts and thus hard to track to their originating package.

Now when you know what package you need, cd to your build-iso dir and do: git submodule update --init pkg/$YOUR_PACKAGE where $YOUR_PACKAGE is package name.

Then checkout your branch: cd pkgs/$YOUR_PACKAGE git branch $BRANCH --track origin/$BRANCH git checkout $BRANCH

Now you are ready to start modifying the source code.

Building the package
When you are done with your modifications, you can build a .deb that can be installed on Vyatta. Change directory to your build-iso dir and do: make $YOUR_PACKAGE (e.g. make vyatta-cfg-system). The resulting .deb will be in pkgs/ directory.