Browse Source

This fixes undef values when scripts was called more than once when used with

-qf and --scripts and -d|-l and -T.
master
freesource 23 years ago
parent
commit
7f18ff576b
  1. 48
      SWIM/Info.pm

48
SWIM/Info.pm

@ -47,79 +47,83 @@ sub scripts {
print "swim: no scripts for not-installed, consider --diff\n"; exit; print "swim: no scripts for not-installed, consider --diff\n"; exit;
} }
# no sense going on if $argument doesn't have a value, at this point
# scripts has already been called once. --freesource
return if !$argument;
dbi(\%commands); dbi(\%commands);
if ($argument =~ /_/) { if ($argument =~ /_/) {
$orig_argument = $argument; $orig_argument = $argument;
my $check = $db{"$argument"}; my $check = $db{"$argument"};
$argument =~ m,(^.*)_(.*$),; $argument =~ m,(^.*)_(.*$),;
if (defined $check) { if (defined $check) {
$argument = $1; $argument = $1;
} }
else {}; else {};
} }
untie %db; untie %db;
# here we will print out whatever we find including the file name. # here we will print out whatever we find including the file name.
if ($commands->{"scripts"} && !($commands->{"preinst"} || if ($commands->{"scripts"} && !($commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} || $commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"})) { $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"})) {
if (defined "$parent$base/info/$argument.preinst") { if (-e "$parent$base/info/$argument.preinst") {
$preinst = "$parent$base/info/$argument.preinst"; $preinst = "$parent$base/info/$argument.preinst";
} }
if (defined "$parent$base/info/$argument.postinst") { if (-e "$parent$base/info/$argument.postinst") {
$postinst = "$parent$base/info/$argument.postinst"; $postinst = "$parent$base/info/$argument.postinst";
} }
if (defined "$parent$base/info/$argument.prerm") { if (-e "$parent$base/info/$argument.prerm") {
$prerm = "$parent$base/info/$argument.prerm"; $prerm = "$parent$base/info/$argument.prerm";
} }
if (defined "$parent$base/info/$argument.postrm") { if (-e "$parent$base/info/$argument.postrm") {
$postrm = "$parent$base/info/$argument.postrm"; $postrm = "$parent$base/info/$argument.postrm";
} }
if (defined "$parent$base/info/$argument.config") { if (-e "$parent$base/info/$argument.config") {
$config = "$parent$base/info/$argument.config"; $config = "$parent$base/info/$argument.config";
} }
if (defined "$parent$base/info/$argument.templates") { if (-e "$parent$base/info/$argument.templates") {
$templates = "$parent$base/info/$argument.templates"; $templates = "$parent$base/info/$argument.templates";
} }
if (-e $preinst) { if ($preinst and -e $preinst) {
print "#####$argument.preinst#####\n\n"; print "#####$argument.preinst#####\n\n";
open (LIST,"$preinst"); open (LIST,"$preinst");
while (<LIST>) { while (<LIST>) {
print $_; print $_;
} }
} }
if (-e $postinst) { if ($postinst and -e $postinst) {
print "#####$argument.postinst#####\n\n"; print "#####$argument.postinst#####\n\n";
open (LIST,"$postinst"); open (LIST,"$postinst");
while (<LIST>) { while (<LIST>) {
print $_; print $_;
} }
} }
if (-e $prerm) { if ($prerm and -e $prerm) {
open (LIST,"$prerm"); open (LIST,"$prerm");
print "#####$argument.prerm#####\n\n"; print "#####$argument.prerm#####\n\n";
while (<LIST>) { while (<LIST>) {
print $_; print $_;
} }
} }
if (-e $postrm) { if ($postrm and -e $postrm) {
open (LIST,"$postrm"); open (LIST,"$postrm");
print "#####$argument.postrm#####\n\n"; print "#####$argument.postrm#####\n\n";
while (<LIST>) { while (<LIST>) {
print $_; print $_;
} }
} }
if (-e $config) { if ($config and -e $config) {
open (LIST,"$config"); open (LIST,"$config");
print "#####$argument.config#####\n\n"; print "#####$argument.config#####\n\n";
while (<LIST>) { while (<LIST>) {
print $_; print $_;
} }
} }
if (-e $templates) { if ($templates and -e $templates) {
open (LIST,"$templates"); open (LIST,"$templates");
print "#####$argument.templates#####\n\n"; print "#####$argument.templates#####\n\n";
while (<LIST>) { while (<LIST>) {

Loading…
Cancel
Save