LDP/LDP/builder/ldp_cp_html

83 lines
2.0 KiB
Perl
Executable File

#!/usr/bin/perl
#
# ldp_cp_html <file_without_extension>
#
# copy all various output forms needed for the LDP to respective locations
#
if($ARGV[0] eq '') {
die "\nusage: $0 <file_without_extension>\n";
}
my($cmd, $dtd, $f, $base) = '';
$base = '/public/ftp/pub/linux/docs/HOWTO';
$base_html = '/public/html/LDP/HOWTO';
$f = $ARGV[0];
if( $f =~ /\.[\w]+ml$/ ) {
$f =~ s/\.[\w]+$//;
}
my($fname) = "$f.html";
# copy PLAIN TEXT version
#
if( -e "$f.txt" ) {
$cmd = "cp -f $f.txt $base/$f; chmod 664 $base/$f; chgrp ldp $base/$f";
print "$0: $f $base\n";
system($cmd);
}
# copy HTML version
#
if( -e "$f-html.tar.gz" ) {
$cmd = "cp -f $f-html.tar.gz $base/other-formats/html; " .
"chmod 664 $base/other-formats/html/$f-html.tar.gz; " .
"chgrp ldp $base/other-formats/html/$f-html.tar.gz";
print "$0: $f-html.tar.gz $base/other-formats/html\n";
system($cmd);
}
if( -e "$f.html" ) {
$cmd = "cp -f $f\*.html $base_html; " .
"chmod 664 $base_html/$f\*.html; " .
"chgrp ldp $base_html/$f\*.html";
print "$0: $base_html\n";
system($cmd);
}
# copy single HTML version
#
if( -e "$f.html" ) {
$cmd = "cp -f $f.html $base/other-formats/html_single/$f.html; " .
"chmod 664 $base/other-formats/html_single/$f.html; " .
"chgrp ldp $base/other-formats/html_single/$f.html";
print "$0: $f.html $base/other-formats/html_single\n";
system($cmd);
}
# copy PDF version
#
if( -e "$f.pdf" ) {
$cmd = "cp -f $f.pdf $base/other-formats/pdf; " .
"chmod 664 $base/other-formats/pdf/$f.pdf; " .
"chgrp ldp $base/other-formats/pdf/$f.pdf";
print "$0: $f.pdf $base/other-formats/pdf\n";
system($cmd);
}
# copy PS version
#
if( -e "$f.ps.gz" ) {
$cmd = "cp -f $f.ps.gz $base/other-formats/ps; " .
"chmod 664 $base/other-formats/ps/$f.ps.gz; " .
"chgrp ldp $base/other-formats/ps/$f.ps.gz";
print "$0: $f.ps.gz $base/other-formats/ps\n";
system($cmd);
}
exit(0);