#!/usr/bin/perl # ftp://ftp.tardis.ed.ac.uk/users/ajcd/psutils.tar.gz # https://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 https://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/ps/Linux-ps-HOWTOs.tar.gz\n"; system ("lynx --source https://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.
Mark Nielsen
Mark works at ZING
(www.genericbooks.com) and
GNUJobs.com. Previously,
Mark founded The Computer Underground.
Mark works on non-profit and volunteer projects which promote free literature
and software. To make a living, he recruits people for GNU related jobs and
also provides solutions for web/database problems using Linux, FreeBSD, Apache,
Zope, Perl, Python, and PostgreSQL.
Copyright © 2001, Mark Nielsen.
Copying license https://www.linuxgazette.net/copying.html
Published in Issue 66 of Linux Gazette, May 2001