Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Acme Downloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Geant DevOps
Acme Downloader
Commits
4df2515d
Unverified
Commit
4df2515d
authored
2 years ago
by
Max Adamo
Browse files
Options
Downloads
Patches
Plain Diff
add force-update option
parent
991f1b34
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#74672
passed
2 years ago
Stage: upload_linux_shell
Stage: upload_linux_amd64_binary
Stage: upload_windows_amd64_binary
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
acme-downloader.sh
+27
-3
27 additions, 3 deletions
acme-downloader.sh
with
27 additions
and
3 deletions
acme-downloader.sh
+
27
−
3
View file @
4df2515d
...
@@ -50,6 +50,7 @@ check_version() {
...
@@ -50,6 +50,7 @@ check_version() {
echo
"
$(
basename
$0
)
$REMOTE_VERSION
is available"
echo
"
$(
basename
$0
)
$REMOTE_VERSION
is available"
echo
"to install the new version you can run:
$(
basename
$0
)
--update"
echo
"to install the new version you can run:
$(
basename
$0
)
--update"
echo
""
echo
""
return
1
else
else
if
[[
-n
$CHECK
]]
;
then
if
[[
-n
$CHECK
]]
;
then
echo
"you are running the latest version"
echo
"you are running the latest version"
...
@@ -95,12 +96,13 @@ usage() {
...
@@ -95,12 +96,13 @@ usage() {
echo
" --ca-destination [OPTIONAL Default:
${
CERT_BASE
}
/COMODO_<type>.crt]"
echo
" --ca-destination [OPTIONAL Default:
${
CERT_BASE
}
/COMODO_<type>.crt]"
echo
" --wildcard [OPTIONAL if the certificate is wildcard]"
echo
" --wildcard [OPTIONAL if the certificate is wildcard]"
echo
" --check-version [OPTIONAL check difference with upstream exit]"
echo
" --check-version [OPTIONAL check difference with upstream exit]"
echo
" --update [OPTIONAL self-updates the script and exit]"
echo
" --update [OPTIONAL self-updates the script if a new version is available and exit]"
echo
" --force-update [OPTIONAL always self-updates the script and exit]"
echo
""
echo
""
clean_up 2
clean_up 2
}
}
OPTS
=
$(
getopt
-o
"h"
--longoptions
"help,redis-token:,vault-token:,cert-name:,team-name:,days:,type:,cert-destination:,fullchain-destination:,key-destination:,ca-destination:,check-version,update,version,wildcard"
--
"
$@
"
)
OPTS
=
$(
getopt
-o
"h"
--longoptions
"help,redis-token:,vault-token:,cert-name:,team-name:,days:,type:,cert-destination:,fullchain-destination:,key-destination:,ca-destination:,check-version,update,
force-update,
version,wildcard"
--
"
$@
"
)
eval set
--
"
$OPTS
"
eval set
--
"
$OPTS
"
while
true
;
do
while
true
;
do
...
@@ -154,6 +156,9 @@ while true; do
...
@@ -154,6 +156,9 @@ while true; do
--update
)
--update
)
UPDATE
=
'UPDATE'
UPDATE
=
'UPDATE'
;;
;;
--force-update
)
FORCE_UPDATE
=
'FORCE_UPDATE'
;;
--check-version
)
--check-version
)
CHECK
=
'CHECK'
CHECK
=
'CHECK'
;;
;;
...
@@ -176,8 +181,9 @@ fi
...
@@ -176,8 +181,9 @@ fi
# check if we are using the latest version
# check if we are using the latest version
check_version
check_version
VERSION_STATUS
=
$?
if
[[
-n
$UPDATE
]]
;
then
if
[[
-n
$
FORCE_
UPDATE
]]
;
then
curl
$SCRIPT_URL
-o
$0
curl
$SCRIPT_URL
-o
$0
UPDATE_STATUS
=
$?
UPDATE_STATUS
=
$?
if
[
$UPDATE_STATUS
==
0
]
;
then
if
[
$UPDATE_STATUS
==
0
]
;
then
...
@@ -189,6 +195,24 @@ if [[ -n $UPDATE ]]; then
...
@@ -189,6 +195,24 @@ if [[ -n $UPDATE ]]; then
clean_up
$UPDATE_STATUS
clean_up
$UPDATE_STATUS
fi
fi
if
[[
-n
$UPDATE
]]
;
then
UPDATE_STATUS
=
"skip"
if
[
$VERSION_STATUS
-eq
1
]
;
then
curl
$SCRIPT_URL
-o
$0
UPDATE_STATUS
=
$?
fi
if
[
$UPDATE_STATUS
==
"skip"
]
;
then
echo
-e
"
\n
$0
is already up to date
\n
"
elif
[
$UPDATE_STATUS
-eq
0
]
;
then
echo
-e
"
\n
$0
updated successfully
\n
"
else
echo
-e
"
\n
failed to update
$0
"
echo
-e
"Please download the script manually from this URL:
${
SCRIPT_URL
}
\n
"
fi
clean_up
$UPDATE_STATUS
fi
if
[[
-z
$REDIS_TOKEN
]]
||
[[
-z
$VAULT_TOKEN
]]
||
[[
-z
$CERT_NAME
]]
||
[[
-z
$TEAM_NAME
]]
||
[[
-z
$TYPE
]]
;
then
if
[[
-z
$REDIS_TOKEN
]]
||
[[
-z
$VAULT_TOKEN
]]
||
[[
-z
$CERT_NAME
]]
||
[[
-z
$TEAM_NAME
]]
||
[[
-z
$TYPE
]]
;
then
echo
-e
"
\n
--redis-token, --vault-token, --cert-name, --team-name and --type are mandatory
\n
"
echo
-e
"
\n
--redis-token, --vault-token, --cert-name, --team-name and --type are mandatory
\n
"
usage
usage
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment