#! @PERL@ # -*-perl-*- # # $Id: sw.in,v 1.3 2004/04/08 01:52:19 mdw Exp $ # # CGI interface for software installations # # (c) 1999 EBI # #----- Licensing notice ----------------------------------------------------- # # This file is part of sw-tools. # # sw-tools is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # sw-tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with sw-tools; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #----- Required packages ---------------------------------------------------- use lib qw(@pkgdatadir@); use POSIX; use IO; use SWConfig; use SW; use SWCGI qw(:DEFAULT :debug); #----- Get packages implementing various actions ---------------------------- BEGIN { %ACT = (); } use SWList; use SWDoc; use SWMan; use SWInfo; #----- Some built-in debugging actions -------------------------------------- sub debug($\%) { my ($what, $h) = @_; SWCGI::header($what); SWCGI::dumphash(%$h); SWCGI::footer(); } $ACT{"show-config"} = sub { debug("configuration", %C); }; $ACT{"show-environment"} = sub { debug("environment", %ENV); }; $ACT{"show-query"} = sub { debug("query", %Q); }; #----- Snarf arguments ------------------------------------------------------ $C{"edited-config-file"} eq "yes" or barf("Config file $C{datadir}/sw.conf hasn't been edited."); SWCGI::read(); $act = $Q{"act"} || "list"; if ($ACT{$act}) { &{$ACT{$act}}; } else { barf("unknown action `$act'"); } #----- That's all, folks ---------------------------------------------------- exit;