1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#!/pro/bin/perl
use strict;
use warnings;
foreach my $vf (glob ("/etc/*[-_][rRvV][eE][lLrR]*"), "/etc/issue",
"/etc.defaults/VERSION", "/etc/VERSION", "/etc/release") {
if (-d $vf) {
(my $d = $vf) =~ s{.*/}{};
print "mkdir $d\n";
foreach my $f (grep { -f } glob "$vf/*") {
open my $fh, "<", $f or next;
$f =~ s{.*/}{};
print "cat > $d/$f <<EOFV\n", <$fh>, "EOFV\n";
}
next;
}
open my $fh, "<", $vf or next;
(my $lf = $vf) =~ s{.*/}{};
print "cat > $lf <<EOFV\n", <$fh>, "EOFV\n";
}
|