Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
letsencrypt.sh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
letsencrypt.sh
Commits
1ab6a436
Commit
1ab6a436
authored
Dec 14, 2015
by
Lukas Schauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow export of config variables for use in other scripts
parent
5120dfb5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
letsencrypt.sh
letsencrypt.sh
+25
-4
No files found.
letsencrypt.sh
View file @
1ab6a436
...
...
@@ -52,7 +52,9 @@ init_system() {
echo
"WARNING: No config file found, using default config!"
sleep
2
elif
[[
-e
"
${
CONFIG
}
"
]]
;
then
if
[[
!
"
${
COMMAND
}
"
=
"env"
]]
;
then
echo
"Using config file
${
CONFIG
}
"
fi
BASEDIR
=
"
$(
dirname
"
${
CONFIG
}
"
)
"
# shellcheck disable=SC1090
.
"
${
CONFIG
}
"
...
...
@@ -71,6 +73,10 @@ init_system() {
fi
set_defaults
if
[[
"
${
COMMAND
}
"
=
"env"
]]
;
then
return
fi
# Lockfile handling (prevents concurrent access)
set
-o
noclobber
if
!
{
date
>
"
${
LOCKFILE
}
"
;
}
2>/dev/null
;
then
...
...
@@ -462,7 +468,7 @@ command_help() {
echo
(
echo
"Commands:"
grep
-e
'
# Usage:'
-e
'
# Description:'
-e
'^command_.*()\s*{'
"
${
0
}
"
|
while
read
-r
usage
;
read
-r
description
;
read
-r
command
;
do
grep
-e
'
^\s*# Usage:'
-e
'^\s*
# Description:'
-e
'^command_.*()\s*{'
"
${
0
}
"
|
while
read
-r
usage
;
read
-r
description
;
read
-r
command
;
do
if
[[
!
"
${
usage
}
"
=
~ Usage
]]
;
then
echo
"Error generating help text."
exit
1
...
...
@@ -490,6 +496,14 @@ command_help() {
)
| column
-t
-s
$'
\t
'
|
sed
's/^---$//g'
}
# Usage: --env (-e)
# Description: Output configuration variables for use in other scripts
command_env
()
{
echo
"# letsencrypt.sh configuration"
typeset
-p
CA LICENSE BASEDIR WELLKNOWN PRIVATE_KEY KEYSIZE OPENSSL_CNF ROOTCERT HOOK RENEW_DAYS PRIVATE_KEY_RENEW CONTACT_EMAIL
exit
0
}
args
=
""
# change long args to short args
# inspired by http://kirk.webfinish.com/?p=45
...
...
@@ -501,6 +515,7 @@ for arg; do
--revoke
)
args
=
"
${
args
}
-r "
;;
--privkey
)
args
=
"
${
args
}
-p "
;;
--config
)
args
=
"
${
args
}
-f "
;;
--env
)
args
=
"
${
args
}
-e "
;;
--
*
)
echo
"Unknown parameter detected:
${
arg
}
"
echo
...
...
@@ -534,7 +549,7 @@ check_parameters() {
fi
}
while
getopts
":hcr:s:f:p:"
option
;
do
while
getopts
":hc
e
r:s:f:p:"
option
;
do
case
"
${
option
}
"
in
h
)
command_help
...
...
@@ -543,6 +558,9 @@ while getopts ":hcr:s:f:p:" option; do
c
)
set_command cron
;;
e
)
set_command
env
;;
r
)
set_command revoke
check_parameters
"
${
OPTARG
:-}
"
...
...
@@ -584,6 +602,9 @@ case "${COMMAND}" in
cron
)
command_cron
;;
env
)
command_env
;;
sign
)
command_sign
${
sign_me
}
;;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment