#!/bin/sh
# Documentation in perl code below.
# -*- perl -*-
# vim:set syn=perl:

# Ensure ZEUSHOME is setup to point to our installation
if [ -z "$ZEUSHOME" ]
then
    # Have a good guess, we live in $ZEUSHOME/zxtm/bin
    OLD_PWD=`pwd`
    cd `dirname $0`/../..
    ZEUSHOME=`pwd`
    export ZEUSHOME
    cd $OLD_PWD
fi

if [ ! -d "$ZEUSHOME/zxtm" ]
then
   echo "`basename $0`: FATAL: Cannot find installation, check \$ZEUSHOME"
   exit 1
fi

# Restart ourselves in perl
exec $ZEUSHOME/perl/miniperl -wx $0 ${1+"$@"}

#!perl -w #"
#line 28

=head1 NAME

support-report - Produce a support file

=head1 SYNOPSIS

B<support-report> filename

=head1 DESCRIPTION

B<support-report> generates a support file that can be given to your
support contact to help diagnose problems.

=head1 COPYRIGHT

Copyright (C) 2000-2013 Zeus Technology Limited. All rights reserved.

=cut

# Try to get networking commands into our PATH
$ENV{PATH} = "/sbin:/usr/etc/sbin:/usr/etc:/usr/sbin:$ENV{PATH}";

my $file = shift;
die "Usage: $0 filename\n" unless( $file );
if( $file =~ /^(-h|--help)$/ ) {
   print "Usage: $0 filename\n";
   exit;
}

# Ensure the CGI script behaves correctly (i.e. doesn't think it is a CGI script)
delete $ENV{SCRIPT_NAME};

# All the work is done by backup.cgi
exec( "$ENV{ZEUSHOME}/zxtmadmin/docroot/backup.cgi", '--support', $file );
