#!/opt/casp/tools/bin/linux2/perl5/bin/perl -I/opt/casp/tools/bin/linux2/perl5/lib -I/opt/casp use INSTALL::common; use INSTALL::global; use INSTALL::parameter; use INSTALL::os; use strict; my $pParameters = \%INSTALL::parameter::variables; #============================================================================== #------------------------ Make sure that the user is a root #============================================================================== if ($> != 0) { print STDOUT "You will need to be root to execute this script.\n"; exit 1; } #============================================================================== #------------------------ Default global values #============================================================================== $pParameters->{asphome} = "/opt/casp"; $pParameters->{com_layer} = "chilicom"; INSTALL::common::set_standard_globals; my $pGlobals = \%INSTALL::global::variables; my $pOS = \%INSTALL::os::Details; #============================================================================== #------------------------ Validate all the required parameters. #============================================================================== my %PARAM_REQUIREMENTS = ( REQUIRED => [ 'engine(_dir|_name)?(_[0-9])?' ], ); unless(INSTALL::parameter::verify(%PARAM_REQUIREMENTS)) { exit (1); } #============================================================================== #------------------------ Delete webserver(s). #============================================================================== use INSTALL::webserver; my @deletion_list; unless(interactive) { use INSTALL::caspeng; my @matches = grep { /engine(_dir|_name)?(_[0-9])?/ } keys %{$pParameters}; my @Engine_Params; foreach my $match (@matches) { my ($path); if ($match =~ /_name/) { $path = "$pParameters->{asphome}/$pParameters->{$match}"; } else { $path = $pParameters->{$match}; } my $realpath = realpath($path); unless(defined $realpath) { error("engine=$path refers to an invalid path."); exit(1); } else { push @Engine_Params, $realpath; } } my %Engine_Exists = map { $_ => undef } INSTALL::caspeng::list_engines; foreach my $engine (@Engine_Params) { unless(exists $Engine_Exists{$engine}) { error("Unknown engine specified in deletion list: ", " $engine"); exit(1); } else { push @deletion_list,$engine; } } } exit(not INSTALL::webserver::uninstall(@deletion_list));