Skip to content

Commit

Permalink
Merge pull request #26 from theohbrothers/enhancement/enhance-docker-…
Browse files Browse the repository at this point in the history
…entrypoint.sh-with-easyrsa-subcommand-detection-with-fallback-on-binary

Enhancement: Enhance `/docker-entrypoint.sh` with `easyrsa` subcommand detection with fallback on binary
  • Loading branch information
leojonathanoh authored Jun 30, 2023
2 parents 67fed42 + 234c1d8 commit 9a6d93a
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 104 deletions.
22 changes: 16 additions & 6 deletions generate/templates/docker-entrypoint.sh.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
@'
#!/bin/sh
set -eu
set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi
# Exec
echo "easyrsa command line: $@"
exec "$@"
'@
23 changes: 16 additions & 7 deletions variants/v3.0.1-alpine-3.3/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.1-alpine-3.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.1-alpine-3.5/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.1-alpine-3.6/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.3-alpine-3.7/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.4-alpine-3.8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.5-alpine-3.9/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.6-alpine-3.10/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.6-alpine-3.11/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.7-alpine-3.12/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.0.8-alpine-3.13/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
23 changes: 16 additions & 7 deletions variants/v3.1.1-alpine-3.17/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh
set -eu

set -aeo pipefail
if [ $# -gt 0 ]; then
# Get all subcommands. 'help' is also a subcommand
SUBCOMMANDS=$( ./easyrsa | awk "/^'help'/,/^DIRECTORY/" | grep -vE "^'help'|^DIRECTORY|^\s*$" | awk '{print $1}'; echo help )
if echo "$SUBCOMMANDS" | grep "^$1$"; then
# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"

# Generate the command line. easy-rsa man: https://github.com/OpenVPN/easy-rsa/blob/v3.0.0/README.quickstart.md
echo "Generating command line"
set "$EASYRSA/easyrsa" "$@"
# Exec
echo "easyrsa command line: $@"
exec "$@"
fi
else
exec "$EASYRSA/easyrsa" "$@"
fi

# Exec
echo "easyrsa command line: $@"
exec "$@"
exec "$@"
Loading

0 comments on commit 9a6d93a

Please sign in to comment.