+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Written by Robin Sheat <robin@catalyst.net.nz> and
+# Srdjan Jankovic <srdjan@catalyst.net.nz>
+# Based on an sh version by Lars Wirzenius.
+
+use strict;
+use warnings;
+
+use Getopt::Long;
+use POSIX qw/strftime/;
+
+my $buildresult;
+my $distribution='squeeze-dev';
+my $git_checks='all';
+my $version='3.5-1~git';
+my $auto_version=1;
+my $need_help;
+my $debug;
+
+GetOptions(
+ 'buildresult|r=s' => \$buildresult,
+ 'distribution|D=s' => \$distribution,
+ 'git-checks|g=s' => \$git_checks,
+ 'version|v=s' => \$version,
+ 'autoversion!' => \$auto_version,
+ 'help|h' => \$need_help,
+ 'debug|d' => \$debug,
+);
+
+help_and_exit() if $need_help;
+
+
+sub sys_command_output {
+ my ($command) = @_;