+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
+
+# Written by Robin Sheat <robin@catalyst.net.nz> and
+# Srdjan Jankovic <srdjan@catalyst.net.nz>
+# Based on an sh version by Lars Wirzenius.
+
+use Modern::Perl;
+
+use Getopt::Long qw(:config no_ignore_case);
+use POSIX qw/strftime/;
+
+my $basetgz;
+my $buildresult;
+my $distribution='squeeze-dev';
+my $git_checks='all';
+my $version='16.06~git';
+my $auto_version=1;
+my $need_help;
+my $debug;
+
+GetOptions(
+ 'basetgz|b=s' => \$basetgz,
+ '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) = @_;