37 lines
978 B
Bash
37 lines
978 B
Bash
#!/bin/bash
|
|
set -ex
|
|
|
|
# start entropy
|
|
haveged -w 1024 &
|
|
|
|
# start dbus
|
|
eval $(dbus-launch --sh-syntax)
|
|
|
|
# start secret service
|
|
export $(gnome-keyring-daemon --start --components=secrets)
|
|
|
|
chmod 700 /root/.gnupg || true
|
|
|
|
# Initialize
|
|
if [[ $1 == init ]]; then
|
|
gpg --generate-key --batch /protonmail/gpgparams
|
|
|
|
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
|
|
|
|
# Run any ProtonMail Bridge Command - Login
|
|
proton-bridge --cli $@
|
|
else
|
|
# Start ProtonMail Bridge
|
|
# Fake a terminal, so it does not quit because of EOF...
|
|
rm -f faketty
|
|
mkfifo faketty
|
|
cat faketty | proton-bridge --cli $@
|
|
fi
|