Building the Code
From UntangleWiki
Contents |
Build Requirements
For a development build, we recommend starting from an Untangle ISO install and converting it into a developer box.
- Insert the CD and reboot to install Untangle, this will wipe out any operating system previously installed.
- When the system reboots, use the setup wizard to configure the box for your network.
- To enable ssh access to the box:
- Click the 'Launch Client' button to start the GUI.
- Log into the gui using the password you selected in the Setup Wizard.
- Click the 'Support' button in the 'Config' tab to get the 'Support Config' dialog.
- Check 'Allow Untangle Access...' in the 'Access Restrictions' tab.
- Click on the 'terminal' button to get access to a shell, you will be asked for a new root password the first time you access the shell.
- Add the following to your '/etc/apt/sources.list':
deb http://archive.debian.org/debian sarge main contrib non-free deb http://security.debian.org sarge/updates main contrib non-free deb http://www.backports.org/debian sarge-backports main contrib non-free # latest stable code deb http://user:metavize@updates.untangle.com/public/sarge stable main premium upstream # latest testing release #deb http://user:metavize@updates.untangle.com/public/sarge testing main premium upstream
- Remove Untangle core packages:
$ apt-get --purge remove untangle-vm untangle-client-windows-jre
(Go ahead and type 'Yes, do as I say!' when it asks)
- Reconfigure debconf, and select 'Dialog' as the interface:
dpkg-reconfigure debconf
- Install the 'untangle-development' package:
$ apt-get update $ apt-get install untangle-development-build
Getting the Source
There are two methods to get the source:
Tarball
The tarball is available from: http://www.untangle.com/index.php?option=com_content&task=view&id=250&Itemid=1028
Subversion checkout
$ svn checkout svn://svn.untangle.com/trunk/src
Building Core
The Untangle build system works in two modes:
- Package Build Creates a set of Debian packages that can be installed using apt-get/dpkg.
- Developer Build Installs the product under the dist directory so that it can be run directly from the development environment.
The Developer Build
We recommend the Developer Build for those wishing to write Nodes and extend the system since it allows for a faster cycle time. The core of the system is functional, but some integration and peripheral functionality may be disabled or non-functional.
Building is simple, change to the src directory and run:
$ SRC_HOME=`pwd` rake
Upon successful build, the system should be installed in the 'dist' directory.
[Note that JAVA_HOME is hardwired in buildtools/buildtools.rb:23 as /usr/lib/jvm/java-1.5.0-sun If your java is not there, comment out that line and define JAVA_HOME in your environment.
Note also that 'rake' is a Ruby application and may need additional Ruby modules to run, such as gettext. If you don't have gettext do 'gem install gettext' as root.]
Then, fire her up:
$ sudo ./dist/etc/init.d/untangle-vm start
You should be able to access the administrative gui at http://localhost/. The username will be: 'admin' and the password is 'passwd'.
The Package Build
The Package Build allows fuller integration and enables all features of the product. Some functionality may be disabled or non-functional.
Change to the src directory, and then issue:
$ apt-get build-dep untangle-vm $ SRC_HOME=`pwd` debuild --preserve-envvar=SRC_HOME -us -uc
The resulting Debian packages will be built one level up (src/..):
$ dpkg -i ../untangle-*deb
Source Hierarchy
The src hierarchy contains:
- buildtools Scripts and libraries used by the build system.
- rakefile The main rakefile.
- component-name A directory for each Node, Casing, and Component.
- prj.el Emacs JDEE Project file.
A build results in the following artifacts:
- dist The result of a developer build, mirrors the directory structure of an installed system.
- staging Compiled classes and other pre-install artifacts.
- taskstamps.txt Stamp file for build targets.
Component Hierarchy
The build system is designed to help build components with a standard layout. A typical src component can contain the following elements:
- package.rb The build file.
- api The api, for remote and local clients.
- localapi The api, for local clients only.
- impl The implementation.
- gui The gui implmenetation.
- hier The filesystem hierarchy, for which some files will be filtered through the filterset as defined in buildtools/rake-util.rb.
- servlets Contains directories for each servlet associated with this component.
