forked from mirrors/protonmail-bridge-docker
Move deb packing under deb folder (#12)
This commit is contained in:
8
deb/.dockerignore
Normal file
8
deb/.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
*
|
||||
|
||||
!.dockerignore
|
||||
!VERSION
|
||||
!entrypoint.sh
|
||||
!install.sh
|
||||
!gpgparams
|
||||
!Dockerfile
|
||||
15
deb/Dockerfile
Normal file
15
deb/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM ubuntu:bionic
|
||||
LABEL maintainer="Xiaonan Shen <s@sxn.dev>"
|
||||
|
||||
EXPOSE 25/tcp
|
||||
EXPOSE 143/tcp
|
||||
|
||||
WORKDIR /protonmail
|
||||
|
||||
# Copy bash scripts
|
||||
COPY gpgparams install.sh entrypoint.sh VERSION /protonmail/
|
||||
|
||||
# Install dependencies and protonmail bridge
|
||||
RUN bash install.sh
|
||||
|
||||
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
|
||||
1
deb/VERSION
Normal file
1
deb/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
1.5.0-1
|
||||
49
deb/entrypoint.sh
Normal file
49
deb/entrypoint.sh
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
# Initialize
|
||||
if [[ $1 == init ]]; then
|
||||
|
||||
# # Parse parameters
|
||||
# TFP="" # Default empty two factor passcode
|
||||
# shift # skip `init`
|
||||
# while [[ $# -gt 0 ]]; do
|
||||
# key="$1"
|
||||
# case $key in
|
||||
# -u|--username)
|
||||
# USERNAME="$2"
|
||||
# ;;
|
||||
# -p|--password)
|
||||
# PASSWORD="$2"
|
||||
# ;;
|
||||
# -t|--twofactor)
|
||||
# TWOFACTOR="$2"
|
||||
# ;;
|
||||
# esac
|
||||
# shift
|
||||
# shift
|
||||
# done
|
||||
|
||||
# Initialize pass
|
||||
gpg --generate-key --batch /protonmail/gpgparams
|
||||
pass init pass-key
|
||||
|
||||
# Login
|
||||
protonmail-bridge --cli
|
||||
|
||||
else
|
||||
|
||||
# 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 &
|
||||
|
||||
# Start protonmail
|
||||
# Fake a terminal, so it does not quit because of EOF...
|
||||
rm -f faketty
|
||||
mkfifo faketty
|
||||
cat faketty | protonmail-bridge --cli
|
||||
|
||||
fi
|
||||
8
deb/gpgparams
Normal file
8
deb/gpgparams
Normal file
@@ -0,0 +1,8 @@
|
||||
%no-protection
|
||||
%echo Generating a basic OpenPGP key
|
||||
Key-Type: RSA
|
||||
Key-Length: 2048
|
||||
Name-Real: pass-key
|
||||
Expire-Date: 0
|
||||
%commit
|
||||
%echo done
|
||||
36
deb/install.sh
Normal file
36
deb/install.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
VERSION=`cat VERSION`
|
||||
DEB_FILE=protonmail-bridge_${VERSION}_amd64.deb
|
||||
|
||||
# Install dependents
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends socat pass
|
||||
|
||||
# Build time dependencies
|
||||
apt-get install -y wget binutils xz-utils
|
||||
|
||||
# Repack deb (remove unnecessary dependencies)
|
||||
mkdir deb
|
||||
cd deb
|
||||
wget https://protonmail.com/download/${DEB_FILE}
|
||||
ar x -v ${DEB_FILE}
|
||||
mkdir control
|
||||
tar xvfJ control.tar.xz -C control
|
||||
sed -i "s/^Depends: .*$/Depends: libsecret-1-0, libgl1-mesa-glx/" control/control
|
||||
cd control
|
||||
tar cvfJ ../control.tar.xz .
|
||||
cd ../
|
||||
ar rcs -v ${DEB_FILE} debian-binary control.tar.xz data.tar.xz
|
||||
cd ../
|
||||
|
||||
# Install protonmail bridge
|
||||
apt-get install -y --no-install-recommends ./deb/${DEB_FILE}
|
||||
|
||||
# Cleanup
|
||||
apt-get purge -y wget binutils xz-utils
|
||||
apt-get autoremove -y
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
rm -rf deb
|
||||
28
deb/update-check.sh
Normal file
28
deb/update-check.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
VERSION=`cat VERSION`
|
||||
|
||||
JSON_CONTENT=$(curl -q https://protonmail.com/download/current_version_linux.json)
|
||||
URL=$(echo ${JSON_CONTENT} | sed -n "s/^.*\"DebFile\":\"\([a-z0-9:/._-]*\)\".*$/\1/p")
|
||||
CURR_VERSION=$(echo $URL | sed -n "s/https:\/\/protonmail.com\/.*_\([0-9.-]*\)_.*.deb/\1/p")
|
||||
|
||||
if [[ -z $CURR_VERSION ]]; then
|
||||
echo "Failed to get new version. Existing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $VERSION != $CURR_VERSION ]]; then
|
||||
echo "New release found: ${CURR_VERSION}"
|
||||
|
||||
# bump up to new release
|
||||
echo ${CURR_VERSION} > VERSION
|
||||
|
||||
# commit
|
||||
git config --local user.email "actions@github.com"
|
||||
git config --local user.name "Github Action"
|
||||
git add VERSION
|
||||
git commit -m "Bump version to ${CURR_VERSION}" --author="Xiaonan Shen <s@sxn.dev>"
|
||||
git push
|
||||
fi
|
||||
Reference in New Issue
Block a user