#PEAR_Config 0.9 a:12:{s:7:"php_dir";s:67:"//pear/php";s:8:"data_dir";s:68:"//pear/data";s:7:"www_dir";s:67:"//pear/www";s:7:"cfg_dir";s:67:"//pear/cfg";s:7:"ext_dir";s:67:"//pear/ext";s:7:"doc_dir";s:68:"//pear/docs";s:8:"test_dir";s:69:"//pear/tests";s:9:"cache_dir";s:69:"//pear/cache";s:12:"download_dir";s:72:"//pear/download";s:8:"temp_dir";s:68:"//pear/temp";s:7:"bin_dir";s:63:"//pear";s:7:"man_dir";s:67:"//pear/man";}
|
Server IP : 99.192.176.69 / Your IP : 216.73.217.59 Web Server : Apache System : Linux platinumpuzzy2.eosdns.net 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64 User : bbwcamhouse ( 1000) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0555) : /../sbin/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
#!/usr/bin/perl
use Foomatic::Defaults;
die "No \$libdir defined in Foomatic::Defaults!?"
unless $libdir;
use Getopt::Std;
getopts("d:hk:lf");
help() if $opt_h;
list() if $opt_l;
if (! -d $opt_k) {
warn "No such directory `$opt_k'\n";
help();
}
# Only overwrite existing files if the "-f" ("force") flag is set.
my $dontoverwrite;
if ($opt_f) {
$dontoverwrite = "";
} else {
$dontoverwrite = "k";
}
# OK, now sanity check and import
my $destdir = $opt_d;
my $dir = $opt_k;
if (!(-d "$dir/printer" or -d "$dir/driver" or -d "$dir/opt")) {
die "No printer, driver, and/or opt directory in $dir; invalid kit?\n";
}
die "That's the library directory!\n"
if ($dir =~ m"$destdir$libdir/db/source/?");
open FILES, "find $dir -type f -print |"
or die "Cannot run find!?";
while (<FILES>) {
chomp;
next if (m/^CVS$/);
die "Non-xml file $_!\n"
if (! m/\.xml$/);
}
close FILES or die "Cannot close pipe from find!";
# OK, we think it's valid now.
die "Foomatic library directory '$destdir$libdir/db' is not writable!\n"
if (! (-d "$destdir$libdir/db" and -w "$destdir$libdir/db"));
# Make "tar" giving english output
$ENV{'LC_ALL'} = "C";
$ENV{'LANG'} = "C";
# Copy the files
my $retval = system("( cd $dir ; tar cf - --exclude CVS . ) | tar xv${dontoverwrite}Cf $destdir$libdir/db/source - 2> $destdir$libdir/kitload2.log | tee $destdir$libdir/kitload.log");
#$retval = $retval / 256;
#if ($retval) {
# die "Error copying files to $destdir$libdir/db/source: $?";
#}
# Clean up log file from files which could not be copied.
open STDOUTLOG, "< $destdir$libdir/kitload.log" or
die "Cannot read $destdir$libdir/kitload.log!";
my @stdoutlog = <STDOUTLOG>;
close STDOUTLOG;
open STDERRLOG, "< $destdir$libdir/kitload2.log" or
die "Cannot read $destdir$libdir/kitload2.log!";
my $all_ok = 1;
while ($eline = <STDERRLOG>) {
for $oline (@stdoutlog) {
$choline = $oline;
chomp($choline);
next if ($choline !~ m!.xml$!);
if ($eline =~ m!$choline!) {
$oline = "";
$all_ok = 0;
}
}
}
my $newlog = join("", @stdoutlog);
close STDERRLOG;
if ($newlog !~ m!.xml$!m) {
show_errors();
warn "\nNo file written into the database, probably this kit is already installed\nor it is empty!\n";
unlink "$destdir$libdir/kitload.log" or
die "Cannot delete $destdir$libdir/kitload.log!";
} else {
if (!$all_ok) {
show_errors();
warn "\nSome files of the kit could not be written! The list of actually written\nfiles you find in $destdir$libdir/kitload.log.\n";
} else {
print "\nKit successfully installed! The list of written files you find in\n$destdir$libdir/kitload.log.\n";
}
open STDOUTLOG, "> $destdir$libdir/kitload.log" or
die "Cannot write $destdir$libdir/kitload.log!";
print STDOUTLOG $newlog;
close STDOUTLOG;
}
unlink "$destdir$libdir/kitload2.log" or
die "Cannot delete $destdir$libdir/kitload2.log!";
exit 0;
sub list {
print STDOUT "$libdir/db/source\n";
exit(0);
}
sub help {
print STDERR "Usage: foomatic-kitload -k kit-dir [-d destination prefix] [-l] [-f]\n";
exit(0);
}
sub show_errors {
warn "\nError messages of the copying process:\n\n";
print STDERR `cat $destdir$libdir/kitload2.log`;
}