A few more fixes to getxcatdocs

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10965 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
bp-sawyers 2011-11-03 15:42:35 +00:00
parent 2e8c7d340d
commit b5fcb0f274

View File

@ -46,10 +46,11 @@ if ($^O =~ /^aix/i) { die "Error: this command is not yet supported on AIX.\n";
my $destdir = scalar(@ARGV) ? $ARGV[0] : '.';
chdir($destdir);
my $docdir = $ENV{'PWD'};
#my $docdir = $ENV{'PWD'};
# Download the HTML
mkdir('html');
chdir('html');
unlink <*>; # delete all the files in the dir, in case they previously ran this
print "Downloading the xCAT wiki documentation...\n";
my $wgetcmd = q(wget -rk -nv --progress=bar -l 1 --page-requisites -np -nH --cut-dirs=3 -e robots=off --post-data='printable=yes' --reject '*title=Special:*,*title=Talk:*,*title=-&*,*title=HowTos,*title=Main_Page,*title=Release_Notes,*title=Wish_List_for_xCAT_2,*&action=edit*,*&action=history*,*&printable=yes*,*&oldid=*,index.html,opensearch_desc.php,xcat' 'https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Documentation');
runwget($wgetcmd);
@ -60,6 +61,7 @@ my @dir = grep /^index.php\?title=/, readdir(DIR); # /
close(DIR);
mkdir('../pdf');
chdir('../pdf');
unlink <*>; # delete all the files in the dir, in case they previously ran this
if (system('which xhtml2pdf >/dev/null 2>&1')) { die "xhtml2pdf is not installed. See http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs .\n"; }
foreach my $file (@dir) {
@ -74,17 +76,19 @@ foreach my $file (@dir) {
}
# tar/compress
chdir($docdir);
chdir('..');
my $date=`date +%Y%m%d%H%M`;
chop $date;
my $docname="xcat-docs-snap$date.tar.gz";
system("tar -zcfz $docname html pdf 2>&1");
system("tar -zcf $docname html pdf 2>&1");
# Optionally upload the tarball to sourceforge
if ($UPLOAD) {
my $UPLOADUSER = 'bp-sawyers';
my $count = 1;
while ($count<=5 && system("rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:htdocs/doc/ 2>&1')) { $count++; }
my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:htdocs/doc/ 2>&1';
print "$cmd\n";
while ($count<=5 && system($cmd)) { $count++; }
}
exit 0;