## OpenCA - CA Command
## (c) 2001 by Michael Bell and OpenCA Group
##
##   File Name: delete_script
##       Brief: delete_script
## Description: delete a script
##  Parameters: -

sub cmdDelete_script {

## read module
my $script = $query->param ('script');
my $file = getRequired ('RBAC_DIR')."/".
           getRequired ('SCRIPT_CONFIG_DIR')."/".
           encodeName ($script).".conf";
my $sig  = getRequired ('RBAC_DIR')."/".
           getRequired ('SCRIPT_CONFIG_DIR')."/".
           encodeName ($script).".sig";

## failure?
if ( not unlink $file ) {
  configError (i18nGettext ("Deleting Script __SCRIPT__ failed (__FILE__)!",
                            "__SCRIPT__", $script,
                            "__FILE__", $file));
}

if ( -e $sig ) {
  if ( not unlink $sig ) {
    configError (i18nGettext ("Deleting Script __SCRIPT__ failed (__FILE__)!",
                              "__SCRIPT__", $script,
                              "__FILE__", $sig));
  }
}

libDoCommand ("show_scripts");

}

1;
