Merge d483aa120b into 57c519436e
This commit is contained in:
commit
564ef175a2
7 changed files with 118 additions and 74 deletions
|
|
@ -12,9 +12,13 @@ RUN bash /install.sh
|
|||
FROM debian:sid-slim
|
||||
LABEL maintainer="Simon Felding <sife@adm.ku.dk>"
|
||||
|
||||
# These are only exported if running as root
|
||||
EXPOSE 25/tcp
|
||||
EXPOSE 143/tcp
|
||||
|
||||
EXPOSE 2025/tcp
|
||||
EXPOSE 2143/tcp
|
||||
|
||||
WORKDIR /protonmail
|
||||
|
||||
# Copy bash scripts
|
||||
|
|
|
|||
|
|
@ -30,20 +30,44 @@ if [[ $1 == init ]]; then
|
|||
pass init pass-key
|
||||
|
||||
# Login
|
||||
protonmail-bridge --cli
|
||||
protonmail-bridge --cli $@
|
||||
|
||||
else
|
||||
if [[ $HOME == "/" ]] then
|
||||
echo "When running rootless, you must set a home dir as the HOME env var. We recommend /data. Make sure it is writable by the user running the container (currently id is $(id -u) and HOME is $HOME)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# give friendly error if you don't have protonmail data
|
||||
if [[ `find $HOME | wc -l` == 1 ]]; then # 1 because find $HOME will always return $HOME
|
||||
echo "No files found - start the container with the init command, or copy/mount files into it at $HOME first. Sleeping 5 minutes before exiting so you have time to copy the files over."
|
||||
sleep 300
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# give friendly error if the user doesn't own the data
|
||||
if [[ $(id -u) != 0 ]]; then
|
||||
if [[ `find $HOME/.* -not -user $(id -u) | wc -l` != 0 ]]; then
|
||||
echo "You do not own the data in $HOME. Please chown it to $(id -u), run the container as the owner of the data or run the container as root."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# delete lock files if they exist - this can happen if the container is restarted forcefully
|
||||
find $HOME -name "*.lock" -delete
|
||||
|
||||
# socat will make the conn appear to come from 127.0.0.1
|
||||
# ProtonMail Bridge currently expects that.
|
||||
# It also allows us to bind to the real ports :)
|
||||
socat TCP-LISTEN:25,fork TCP:127.0.0.1:1025 &
|
||||
socat TCP-LISTEN:143,fork TCP:127.0.0.1:1143 &
|
||||
if [[ $(id -u) == 0 ]]; then
|
||||
socat TCP-LISTEN:25,fork TCP:127.0.0.1:1025 &
|
||||
socat TCP-LISTEN:143,fork TCP:127.0.0.1:1143 &
|
||||
fi
|
||||
|
||||
socat TCP-LISTEN:2025,fork TCP:127.0.0.1:1025 &
|
||||
socat TCP-LISTEN:2143,fork TCP:127.0.0.1:1143 &
|
||||
|
||||
# Start protonmail
|
||||
# Fake a terminal, so it does not quit because of EOF...
|
||||
rm -f faketty
|
||||
mkfifo faketty
|
||||
cat faketty | protonmail-bridge --cli
|
||||
/protonmail/proton-bridge --noninteractive $@
|
||||
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue