X-Git-Url: https://git.rapsys.eu/acme/blobdiff_plain/707fca91ce64b098f3bc55721f630b6822d48bd8..baefa26a7b8ea0eb362851dceb3cf3cfdffc86e8:/acmeconf

diff --git a/acmeconf b/acmeconf
index c5b9134..c34ee25 100755
--- a/acmeconf
+++ b/acmeconf
@@ -34,7 +34,7 @@ my @debian = ();
 
 # Init root
 my %root = ();
-tie(%root, 'Tie::IxHash', thumbprint => '/etc/acmepl/thumbprint', certificates => []);
+tie(%root, 'Tie::IxHash', thumbprint => '/etc/acme/thumbprint', term => 'https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf', pending => '/tmp/acme.pending', certificates => []);
 
 # Init prod
 my $prod = 0;
@@ -42,6 +42,8 @@ my $prod = 0;
 # Strip and enable prod
 @ARGV = map { if ($_ eq '-p') { $prod = 1; (); } else { $_; } } @ARGV;
 
+use Data::Dumper;
+
 # Strip and enable debug
 for (my $i = 0; $i <= $#ARGV; $i++) {
 	# Match redhat types
@@ -68,12 +70,28 @@ for (my $i = 0; $i <= $#ARGV; $i++) {
 		} else {
 			push(@debian, ['www.example.com','example.com','...']);
 		}
+	# Match term
+	} elsif ($ARGV[$i] =~ /^(?:(\-t|\-\-term)(?:=(https:\/\/letsencrypt\.org\/documents\/[a-zA-Z0-9\._-]+\.pdf))?)$/) {
+		if (defined($2)) {
+			$root{term} = $2;
+			splice(@ARGV, $i, 1);
+			$i--;
+		# Extract next parameter
+		} elsif(defined($ARGV[$i+1]) && $ARGV[$i+1] =~ /^(https:\/\/letsencrypt\.org\/documents\/[a-zA-Z0-9\._-]+\.pdf)$/) {
+			$root{term} = $1;
+			splice(@ARGV, $i, 2);
+			$i--;
+		# Set default
+		} else {
+			print 'Term parameter without valid link'."\n";
+			exit EXIT_FAILURE;
+		}
 	}
 }
 
 # Show usage
-if (scalar(@ARGV) < 1) {
-	print "Usage: $0 [(-d|--debian)[=example.com[,...]] [(-r|--redhat)[=example.com[,...]]] [...] > /etc/acmepl/config\n";
+if (scalar(@redhat) < 1 && scalar(@debian) < 1) {
+	print "Usage: $0 [(-d|--debian)[=example.com[,...]] [(-r|--redhat)[=example.com[,...]]] [(-t|--term)[=https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf]] [...] > /etc/acme/config\n";
 	exit EXIT_FAILURE;
 }