mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-11-14 02:11:45 +00:00
fix format
This commit is contained in:
parent
561803c0a7
commit
0bbaa51945
@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
#DEPLOY_DOCKER_CONTAINER_LABEL="xxxxxxx"
|
#DEPLOY_DOCKER_CONTAINER_LABEL="xxxxxxx"
|
||||||
#DOCKER_HOST=/var/run/docker.sock | tcp://localhost:8888
|
|
||||||
|
|
||||||
|
|
||||||
#DEPLOY_DOCKER_CONTAINER_KEY_FILE="/path/to/key.pem"
|
#DEPLOY_DOCKER_CONTAINER_KEY_FILE="/path/to/key.pem"
|
||||||
#DEPLOY_DOCKER_CONTAINER_CERT_FILE="/path/to/cert.pem"
|
#DEPLOY_DOCKER_CONTAINER_CERT_FILE="/path/to/cert.pem"
|
||||||
@ -10,7 +8,7 @@
|
|||||||
#DEPLOY_DOCKER_CONTAINER_FULLCHAIN_FILE="/path/to/fullchain.pem"
|
#DEPLOY_DOCKER_CONTAINER_FULLCHAIN_FILE="/path/to/fullchain.pem"
|
||||||
#DEPLOY_DOCKER_CONTAINER_RELOAD_CMD="service nginx force-reload"
|
#DEPLOY_DOCKER_CONTAINER_RELOAD_CMD="service nginx force-reload"
|
||||||
|
|
||||||
_DEPLOY_DOCKER_WIKI="http://xxxxxx"
|
_DEPLOY_DOCKER_WIKI="https://github.com/Neilpang/acme.sh/wiki/deploy-to-docker-containers"
|
||||||
|
|
||||||
_DOCKER_HOST_DEFAULT="/var/run/docker.sock"
|
_DOCKER_HOST_DEFAULT="/var/run/docker.sock"
|
||||||
|
|
||||||
@ -20,7 +18,7 @@ docker_deploy() {
|
|||||||
_ccert="$3"
|
_ccert="$3"
|
||||||
_cca="$4"
|
_cca="$4"
|
||||||
_cfullchain="$5"
|
_cfullchain="$5"
|
||||||
|
_debug _cdomain "$_cdomain"
|
||||||
if [ -z "$DEPLOY_DOCKER_CONTAINER_LABEL" ]; then
|
if [ -z "$DEPLOY_DOCKER_CONTAINER_LABEL" ]; then
|
||||||
_err "The DEPLOY_DOCKER_CONTAINER_LABEL variable is not defined, we use this label to find the container."
|
_err "The DEPLOY_DOCKER_CONTAINER_LABEL variable is not defined, we use this label to find the container."
|
||||||
_err "See: $_DEPLOY_DOCKER_WIKI"
|
_err "See: $_DEPLOY_DOCKER_WIKI"
|
||||||
@ -147,25 +145,25 @@ _get_id() {
|
|||||||
|
|
||||||
#id cmd
|
#id cmd
|
||||||
_docker_exec() {
|
_docker_exec() {
|
||||||
_eargs="$@"
|
_eargs="$*"
|
||||||
_debug2 "_docker_exec $_eargs"
|
_debug2 "_docker_exec $_eargs"
|
||||||
_dcid="$1"
|
_dcid="$1"
|
||||||
shift
|
shift
|
||||||
if [ "$_USE_DOCKER_COMMAND" ]; then
|
if [ "$_USE_DOCKER_COMMAND" ]; then
|
||||||
docker exec -i "$_dcid" $@
|
docker exec -i "$_dcid" "$@"
|
||||||
elif [ "$_USE_REST" ]; then
|
elif [ "$_USE_REST" ]; then
|
||||||
_err "Not implemented yet."
|
_err "Not implemented yet."
|
||||||
return 1
|
return 1
|
||||||
elif [ "$_USE_UNIX_SOCKET" ]; then
|
elif [ "$_USE_UNIX_SOCKET" ]; then
|
||||||
_cmd="$@"
|
_cmd="$*"
|
||||||
_cmd="$(printf "$_cmd" | sed 's/ /","/g')"
|
_cmd="$(printf "%s" "$_cmd" | sed 's/ /","/g')"
|
||||||
_debug2 _cmd "$_cmd"
|
_debug2 _cmd "$_cmd"
|
||||||
#create exec instance:
|
#create exec instance:
|
||||||
cjson="$(_curl_unix_sock "$_DOCKER_SOCK" POST "/containers/$_dcid/exec" "{\"Cmd\": [\"$_cmd\"]}")";
|
cjson="$(_curl_unix_sock "$_DOCKER_SOCK" POST "/containers/$_dcid/exec" "{\"Cmd\": [\"$_cmd\"]}")"
|
||||||
_debug2 cjson "$cjson"
|
_debug2 cjson "$cjson"
|
||||||
execid="$(echo "$cjson" | cut -d '"' -f 4)"
|
execid="$(echo "$cjson" | cut -d '"' -f 4)"
|
||||||
_debug execid "$execid"
|
_debug execid "$execid"
|
||||||
ejson="$(_curl_unix_sock "$_DOCKER_SOCK" POST "/exec/$execid/start" "{\"Detach\": false,\"Tty\": false}")";
|
ejson="$(_curl_unix_sock "$_DOCKER_SOCK" POST "/exec/$execid/start" "{\"Detach\": false,\"Tty\": false}")"
|
||||||
_debug2 ejson "$ejson"
|
_debug2 ejson "$ejson"
|
||||||
else
|
else
|
||||||
_err "Not implemented yet."
|
_err "Not implemented yet."
|
||||||
@ -182,7 +180,11 @@ _docker_cp() {
|
|||||||
_dir="$(dirname "$_to")"
|
_dir="$(dirname "$_to")"
|
||||||
_docker_exec "$_dcid" mkdir -p "$_dir"
|
_docker_exec "$_dcid" mkdir -p "$_dir"
|
||||||
if [ "$_USE_DOCKER_COMMAND" ]; then
|
if [ "$_USE_DOCKER_COMMAND" ]; then
|
||||||
cat "$_from" | _docker_exec "$_dcid" tee "$_to" >/dev/null
|
if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ]; then
|
||||||
|
_docker_exec "$_dcid" tee "$_to" <"$_from"
|
||||||
|
else
|
||||||
|
_docker_exec "$_dcid" tee "$_to" <"$_from" >/dev/null
|
||||||
|
fi
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
_info "Success"
|
_info "Success"
|
||||||
return 0
|
return 0
|
||||||
@ -232,9 +234,9 @@ _curl_unix_sock() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ]; then
|
if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ]; then
|
||||||
curl -vvv --silent --unix-socket "$_socket" -X $_method --data-binary "$_data" --header "$_ctype" "$_cux_url"
|
curl -vvv --silent --unix-socket "$_socket" -X "$_method" --data-binary "$_data" --header "$_ctype" "$_cux_url"
|
||||||
else
|
else
|
||||||
curl --silent --unix-socket "$_socket" -X $_method --data-binary "$_data" --header "$_ctype" "$_cux_url"
|
curl --silent --unix-socket "$_socket" -X "$_method" --data-binary "$_data" --header "$_ctype" "$_cux_url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -261,4 +263,3 @@ _check_curl_version() {
|
|||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user