diff --git a/build/entrypoint.sh b/build/entrypoint.sh index 1931087..463c94b 100644 --- a/build/entrypoint.sh +++ b/build/entrypoint.sh @@ -2,6 +2,12 @@ set -ex +# Workaround for stale gpg-agent socket causing auth failures on restart +# Cleans up leftover sockets in the GPG home directory +if [ -d /root/.gnupg ]; then + rm -f /root/.gnupg/S.gpg-agent* +fi + # Initialize if [[ $1 == init ]]; then @@ -30,6 +36,15 @@ else # Fake a terminal, so it does not quit because of EOF... rm -f faketty mkfifo faketty - cat faketty | /protonmail/proton-bridge --cli $@ + + # Keep faketty open + sleep infinity > faketty & + + # Start bridge reading from faketty + /protonmail/proton-bridge --cli $@ < faketty & + + # Wait for the bridge to exit + wait $! + exit $? fi diff --git a/deb/entrypoint.sh b/deb/entrypoint.sh index 13637e5..94c9f77 100644 --- a/deb/entrypoint.sh +++ b/deb/entrypoint.sh @@ -2,6 +2,12 @@ set -ex +# Workaround for stale gpg-agent socket causing auth failures on restart +# Cleans up leftover sockets in the GPG home directory +if [ -d /root/.gnupg ]; then + rm -f /root/.gnupg/S.gpg-agent* +fi + # Initialize if [[ $1 == init ]]; then @@ -44,6 +50,15 @@ else # Fake a terminal, so it does not quit because of EOF... rm -f faketty mkfifo faketty - cat faketty | protonmail-bridge --cli + + # Keep faketty open + sleep infinity > faketty & + + # Start bridge reading from faketty + protonmail-bridge --cli < faketty & + + # Wait for the bridge to exit + wait $! + exit $? fi