script to add a new xpdf version
authorkramm <kramm>
Sun, 19 Nov 2006 21:32:14 +0000 (21:32 +0000)
committerkramm <kramm>
Sun, 19 Nov 2006 21:32:14 +0000 (21:32 +0000)
lib/pdf/inject-xpdf.pl [new file with mode: 0755]

diff --git a/lib/pdf/inject-xpdf.pl b/lib/pdf/inject-xpdf.pl
new file mode 100755 (executable)
index 0000000..6571080
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+$filename = $ARGV[0];
+
+$filename or die "no filename";
+
+$directory = $filename;
+$directory =~ s/.tar.gz$//g;
+
+mkdir("$directory");
+mkdir("$directory/tmp/");
+
+chdir("$directory/tmp/") or die;
+system("tar -zxvf ../../$filename") and die;
+system("find -type f -exec mv {} .. \\;") and die;
+chdir("..");
+system("find -type d -exec rmdir {} \\; 2> /dev/null");
+system("patch < ../xpdf-changes.patch") and die;
+chdir("..");
+system("rm -f xpdf");
+system("ln -s $directory xpdf");
+
+open(fi, ">switch");
+
+print fi <<EOF
+#!/bin/sh
+
+if test "x\$1" = "xstable";then
+    echo "Switching to stable version"
+    rm -f xpdf
+    ln -s xpdf-3.01 xpdf
+elif test "x\$1" = "xlatest";then
+    echo "Switching to latest version"
+    rm -f xpdf
+    ln -s $directory xpdf
+fi
+EOF
+;
+close(fi);
+system("chmod a+x switch");
+