LDP/LDP/builder/ldp_cp_faq

88 lines
1.8 KiB
Perl
Executable File

#!/usr/bin/perl
#
# ldp_cp_faq <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, $f, $base) = '';
$base = '/public/ftp/pub/linux/docs/faqs/';
$base_html = '/public/html/LDP/FAQ/';
$f = $ARGV[0];
if( $f =~ /\.sgml$/ ) {
$f =~ s/\.[\w]+$//;
}
$base .= $f;
$base_html .= $f;
print "$0: $base (and) $base_html\n";
# copy PLAIN TEXT version
#
if( -e "$f.txt" ) {
$cmd = "cp -f $f.txt $base/$f; chmod 664 $base/$f; chgrp ldp $base/$f";
system($cmd);
$cmd = "cp -f $f.txt $base_html/faqs/$f; chmod 664 $base_html/faqs/$f; chgrp ldp $base_html/faqs/$f";
system($cmd);
}
# copy HTML version
#
if( -e "$f-html.tar.gz" ) {
$cmd = "cp -f $f-html.tar.gz $base/$f.html.tar.gz; " .
"chmod 664 $base/$f.html.tar.gz; " .
"chgrp ldp $base/$f.html.tar.gz";
system($cmd);
}
if( -d "$base_html" ) {
system("rm -f $base_html/\*.html");
}
$cmd = "cp -rf $f/\*.html $base_html; " .
"chmod 775 $base_html; " .
"chmod 664 $base_html/\*.html; " .
"chgrp -R ldp $base_html";
system($cmd);
# copy PDF version
#
if( -e "$f.pdf" ) {
$cmd = "cp -f $f.pdf $base/; " .
"chmod 664 $base/$f.pdf; " .
"chgrp ldp $base/$f.pdf";
system($cmd);
}
# copy PS version
#
if( -e "$f.ps.gz" ) {
$cmd = "cp -f $f.ps.gz $base/; " .
"chmod 664 $base/$f.ps.gz; " .
"chgrp ldp $base/$f.ps.gz";
system($cmd);
}
# copy SGML version
#
if( -e "$f.sgml.gz" ) {
$cmd = "cp -f $f.sgml.gz $base/; " .
"chmod 664 $base/$f.sgml.gz; " .
"chgrp ldp $base/$f.sgml.gz";
system($cmd);
}
# for announce msg
#
print "\n";
system("head -5 $f.txt");
print "\n * updated\n http://tldp.org/FAQ/${f}\n\n";
exit(0);