#!/usr/bin/perl # ftp://ftp.tardis.ed.ac.uk/users/ajcd/psutils.tar.gz # http://www.dcs.ed.ac.uk/home/ajcd/psutils/ # cp Makefile.unix Makefile # ln -s /usr/bin/perl /usr/local/bin/perl # mkdir -p /usr/local/share/man/man1 # /usr/local/bin/psbook #system ("lynx --source ftp://ftp.tardis.ed.ac.uk/users/ajcd/psutils.tar.gz > /tmp/psutils.tar.gz)"; # system ("cd /tmp; tar -zxvf psutils.tar.gz; cd psutils; cp Makefile.unix Makefile"); # system ("ln -s /usr/bin/perl /usr/local/bin/perl; mkdir -p /usr/local/share/man/man1"); # system ("cd /tmp/psutils; make; make install; ln -s /usr/local/bin/psutils /usr/bin/psutils"); # Ignore the lines above, unless you don't have psutils. # I keep the lines above just so I remember how I installed psutils. my $TempFile1 = "/tmp/HOWTO_Convert_1.ps"; my $TempFile2 = "/tmp/HOWTO_Convert_1.pdf"; my $SourceDir = "/root/HOWTO"; my $Destination = "/root/HOWTO_Books"; my $ZippedPDF = "/root/HOWTO_books_pdf.tgz"; my $ZippedPS = "/root/HOWTO_books_ps.tgz"; if (!(-d $Destination)) {system "mkdir $Destination";} print "Downloading HOWTOs from http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/ps/Linux-ps-HOWTOs.tar.gz\n"; system ("lynx --source http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/ps/Linux-ps-HOWTOs.tar.gz > $SourceDir/Linux-ps-HOWTOs.tar.gz"); system ("cd $SourceDir; tar -zxvf Linux-ps-HOWTOs.tar.gz"); my @Files = <$SourceDir/*.ps.gz>; foreach my $File (@Files) { my $command="gunzip -c $File | /usr/bin/psbook -s4 | mpage -2 > $TempFile1"; print "Executing psbook and mpage on $File\n$command\n"; system ($command); $command = "ps2pdf $TempFile1 $TempFile2"; print "Executing ps2pdf\n$command\n"; system ($command); my (@Temp) = split(/\//,$File); my $NamePDF = pop @Temp; my $NamePS = $NamePDF; $NamePDF =~ s/\.ps\.gz$/\.pdf/; $NamePS =~ s/\.ps\.gz$/\.ps/; my $NewPS = "$Destination/$NamePS"; my $NewPDF = "$Destination/$NamePDF"; system ("mv $TempFile2 $NewPDF"); print "Created the book-formatted HOWTO, $NewPDF\n"; system ("mv $TempFile1 $NewPS"); print "Created the book-formatted HOWTO, $NewPS\n"; } print "Creating zip files $ZippedPDF and $ZippedPS\n"; system ("tar -zcvf $ZippedPDF $Destination/*.pdf"); system ("tar -zcvf $ZippedPS $Destination/*.ps");
Mark works as an independent consultant donating time to causes like GNUJobs.com, writing articles, writing free software, and working as a volunteer at eastmont.net.