Files
protonmail-bridge/build/entrypoint.sh
T
GitHub Actions 8123e4b288
Build and Push Docker Container / build-and-push (push) Successful in 5m11s
add dbus and allow to find key for pass
2026-03-11 08:54:34 +01:00

42 lines
1.0 KiB
Bash

#!/bin/bash
set -ex
# Start DBus session for libsecret
eval $(dbus-launch --sh-syntax)
# Initialize
if [[ $1 == init ]]; then
# Initialize pass
gpg --generate-key --batch /protonmail/gpgparams
# Change Permission when Folder Exists
if [ -d "/root/.gnupg" ]; then
chmod 700 /root/.gnupg
fi
KEY=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/ {print $5; exit}')
pass init "$KEY"
# Kill the other instance as only one can be running at a time.
# This allows users to run entrypoint init inside a running conainter
# which is useful in a k8s environment.
# || true to make sure this would not fail in case there is no running instance.
pkill protonmail-bridge || true
# Login
proton-bridge --cli $@
else
# Change Permission when Folder Exists
if [ -d "/root/.gnupg" ]; then
chmod 700 /root/.gnupg
fi
# Start protonmail
# Fake a terminal, so it does not quit because of EOF...
rm -f faketty
mkfifo faketty
cat faketty | proton-bridge --cli $@
fi