From a834fb8bbed4f04d4d64368ba13de37bf409fdbc Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 26 Nov 2017 19:31:02 -0800 Subject: [PATCH] Use standard boilerplate for command-line scripts --- webmin/letsencrypt-cleanup.pl | 8 ++++++-- webmin/letsencrypt-dns.pl | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/webmin/letsencrypt-cleanup.pl b/webmin/letsencrypt-cleanup.pl index 69c07beb3..ced790140 100755 --- a/webmin/letsencrypt-cleanup.pl +++ b/webmin/letsencrypt-cleanup.pl @@ -2,11 +2,15 @@ # Called by the let's encrypt client to remove a DNS record for validation $no_acl_check++; -$ENV{'WEBMIN_CONFIG'} = "/etc/webmin"; -$ENV{'WEBMIN_VAR'} = "/var/webmin"; +$ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin"; +$ENV{'WEBMIN_VAR'} ||= "/var/webmin"; if ($0 =~ /^(.*\/)[^\/]+$/) { chdir($1); } +else { + chop($pwd = `pwd`); + } +$0 = "$pwd/letsencrypt-cleanup.pl"; require './webmin-lib.pl'; &foreign_require("bind8"); diff --git a/webmin/letsencrypt-dns.pl b/webmin/letsencrypt-dns.pl index 8d35dba36..1f054aa54 100755 --- a/webmin/letsencrypt-dns.pl +++ b/webmin/letsencrypt-dns.pl @@ -2,11 +2,15 @@ # Called by the let's encrypt client to add a DNS record for validation $no_acl_check++; -$ENV{'WEBMIN_CONFIG'} = "/etc/webmin"; -$ENV{'WEBMIN_VAR'} = "/var/webmin"; +$ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin"; +$ENV{'WEBMIN_VAR'} ||= "/var/webmin"; if ($0 =~ /^(.*\/)[^\/]+$/) { chdir($1); } +else { + chop($pwd = `pwd`); + } +$0 = "$pwd/letsencrypt-dns.pl"; require './webmin-lib.pl'; &foreign_require("bind8");