From 564ba31acf6fa4df0c3d3c528ee0011e5631fdbc Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Mon, 1 Jun 2020 17:29:59 -0400
Subject: generalized destdir
---
Makefile | 18 ++++++++++++++----
minimun | 51 ---------------------------------------------------
minimun.orig | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 55 deletions(-)
delete mode 100755 minimun
create mode 100755 minimun.orig
diff --git a/Makefile b/Makefile
index 0564cd6..4d25d65 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,19 @@
.POSIX:
-DESTDIR=/usr/lib/minimun
+DESTDIR=/home/minimun/minimun
-install: $(DESTDIR)
+minimun: minimun.orig
+ sed 's:%%DEST%%:$(DESTDIR):' minimun.orig > minimun
+
+clean:
+ rm minimun
+
+install: $(DESTDIR) minimun
cp -t $(DESTDIR) minimun format.tex logo.png
-
+
+uninstall:
+ rm $(DESTDIR)/{minimun,format.tex,logo.png}
+ rmdir -p $(DESTDIR)
+
$(DESTDIR):
- mkdir -pv $@
+ mkdir -p $@
diff --git a/minimun b/minimun
deleted file mode 100755
index 10d4c81..0000000
--- a/minimun
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use warnings;
-
-use IPC::Run qw(run);
-use Time::HiRes qw( time );
-
-chdir('/usr/lib/minimun');
-
-my ($buffer, @pairs, $pair, $name, $val, %FORM);
-
-if ($ENV{'REQUEST_METHOD'} eq "GET") {
- $buffer = $ENV{'QUERY_STRING'};
-}
-@pairs = split(/&/, $buffer);
-
-foreach $pair (@pairs) {
- ($name, $val) = split(/=/, $pair);
- $val =~ tr/+/ /;
- $val =~ s/%(..)/pack("C", hex($1))/eg;
- $FORM{$name} = $val;
-}
-
-my ($in, $out);
-$in = "\n";
-
-if (index($ENV{'PATH_INFO'},'award.pdf') != -1){
- $in .= "\\award{$FORM{'committee'}}{$FORM{'country'}}{$FORM{'award'}}{$FORM{'school'}}";
-}
-elsif (index($ENV{'PATH_INFO'},'room.pdf') != -1){
- $in .= "\\room{$FORM{'committee'}}";
-}
-else{
- print "Content-type: text/html\n";
- print "Status: 404 File Not Found Error\n";
- print "\n";
- print '404 Error. Go back.';
- die;
-}
-
-$in .= "\\bye\n";
-
-my $timestamp = time;
-run ['/usr/bin/pdftex', '-jobname', "$timestamp", 'format.tex'], '<', \$in, '>', \$out;
-print "Content-type: application/pdf\n\n";
-open(DOC, '<', "$timestamp.pdf");
-while (){
- print;
-}
-close(DOC);
-unlink "$timestamp.pdf", "$timestamp.log";
diff --git a/minimun.orig b/minimun.orig
new file mode 100755
index 0000000..bf07a25
--- /dev/null
+++ b/minimun.orig
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use IPC::Run qw(run);
+use Time::HiRes qw( time );
+
+chdir('%%DEST%%');
+
+my ($buffer, @pairs, $pair, $name, $val, %FORM);
+
+if ($ENV{'REQUEST_METHOD'} eq "GET") {
+ $buffer = $ENV{'QUERY_STRING'};
+}
+@pairs = split(/&/, $buffer);
+
+foreach $pair (@pairs) {
+ ($name, $val) = split(/=/, $pair);
+ $val =~ tr/+/ /;
+ $val =~ s/%(..)/pack("C", hex($1))/eg;
+ $FORM{$name} = $val;
+}
+
+my ($in, $out);
+$in = "\n";
+
+if (index($ENV{'PATH_INFO'},'award.pdf') != -1){
+ $in .= "\\award{$FORM{'committee'}}{$FORM{'country'}}{$FORM{'award'}}{$FORM{'school'}}";
+}
+elsif (index($ENV{'PATH_INFO'},'room.pdf') != -1){
+ $in .= "\\room{$FORM{'committee'}}";
+}
+else{
+ print "Content-type: text/html\n";
+ print "Status: 404 File Not Found Error\n";
+ print "\n";
+ print '404 Error. Go back.';
+ die;
+}
+
+$in .= "\\bye\n";
+
+my $timestamp = time;
+run ['/usr/bin/pdftex', '-jobname', "$timestamp", 'format.tex'], '<', \$in, '>', \$out;
+print "Content-type: application/pdf\n\n";
+open(DOC, '<', "$timestamp.pdf");
+while (){
+ print;
+}
+close(DOC);
+unlink "$timestamp.pdf", "$timestamp.log";
--
cgit