Compare commits
12 Commits
0ed0c76954
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
7761772dda
|
|||
|
28327d8604
|
|||
|
ed91f1ba49
|
|||
|
1f6e63ddad
|
|||
|
6253ed1f5f
|
|||
|
9a88767eaf
|
|||
|
7ed94e64f3
|
|||
|
e270e0f616
|
|||
|
604840eef9
|
|||
|
ef208dbc83
|
|||
|
88864eb0be
|
|||
|
a12f6381a1
|
16
README.md
16
README.md
@@ -16,7 +16,10 @@ Here are some example snippets to help you get started creating a container.
|
|||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
pybitmessage:
|
pybitmessage:
|
||||||
image: bitdeals/pybitmessage
|
build:
|
||||||
|
context: https://git.bitdeals.org/private/bitmessage.git
|
||||||
|
dockerfile: ./docker/Dockerfile
|
||||||
|
image: registry.bitdeals.org/bitmessage
|
||||||
environment:
|
environment:
|
||||||
- BITMESSAGE_API_USER=bitmessage_api_user
|
- BITMESSAGE_API_USER=bitmessage_api_user
|
||||||
- BITMESSAGE_API_PASSWORD=bitmessage_api_password
|
- BITMESSAGE_API_PASSWORD=bitmessage_api_password
|
||||||
@@ -39,7 +42,7 @@ docker run -d \
|
|||||||
-e BITMESSAGE_TTL=172800 \
|
-e BITMESSAGE_TTL=172800 \
|
||||||
-e BITMESSAGE_STOPRESENDINGAFTERXDAYS=60
|
-e BITMESSAGE_STOPRESENDINGAFTERXDAYS=60
|
||||||
-p 8442:8442 \
|
-p 8442:8442 \
|
||||||
bitdeals/pybitmessage
|
registry.bitdeals.org/bitmessage
|
||||||
```
|
```
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
@@ -48,11 +51,12 @@ Container images are configured using parameters passed at runtime.
|
|||||||
|
|
||||||
|Parameter|Function|
|
|Parameter|Function|
|
||||||
|:--------|:-------|
|
|:--------|:-------|
|
||||||
|-p 8442|XML-RPC API port TCP|
|
|-p 8442|API port|
|
||||||
|-e BITMESSAGE_API_USER=|XML-RPC API user. Default: `bitmessage_api_user`|
|
|-e BITMESSAGE_API_USER|XML-RPC API user. Default: `bitmessage_api_user`|
|
||||||
|-e BITMESSAGE_API_PASSWORD=|XML-RPC API password. Default: `bitmessage_api_password`|
|
|-e BITMESSAGE_API_PASSWORD|XML-RPC API password. Default: `bitmessage_api_password`|
|
||||||
|-e BITMESSAGE_SEED_PHRASE|Create Deterministic Addresses password. Default: `bitmessage_seed_phrase`|
|
|-e BITMESSAGE_SEED_PHRASE|Create Deterministic Addresses password. Default: created randomly. |
|
||||||
|-e BITMESSAGE_SEED_ADDRESSES|Number of Deterministic Addresses to generate. Default: `1`|
|
|-e BITMESSAGE_SEED_ADDRESSES|Number of Deterministic Addresses to generate. Default: `1`|
|
||||||
|-e BITMESSAGE_TTL|The expiration of newly send messages, in seconds. Default: `172800`|
|
|-e BITMESSAGE_TTL|The expiration of newly send messages, in seconds. Default: `172800`|
|
||||||
|-e BITMESSAGE_STOPRESENDINGAFTERXDAYS|Stop resending unreceived message after X days. Default: `60`|
|
|-e BITMESSAGE_STOPRESENDINGAFTERXDAYS|Stop resending unreceived message after X days. Default: `60`|
|
||||||
|
|-e BITMESSAGE_APIVARIANT|provides xml or json-RPC API. Default: `legacy`|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
version: '3.9'
|
|
||||||
services:
|
services:
|
||||||
bitmessage:
|
bitmessage:
|
||||||
image: bitdeals/pybitmessage:0.6.3.2-ubuntu
|
build:
|
||||||
build: ./docker
|
context: ./docker
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: registry.bitdeals.org/bitmessage
|
||||||
environment:
|
environment:
|
||||||
- BITMESSAGE_API_USER=bitmessage_api_user
|
- BITMESSAGE_API_USER=bitmessage_api_user
|
||||||
- BITMESSAGE_API_PASSWORD=bitmessage_api_password
|
- BITMESSAGE_API_PASSWORD=bitmessage_api_password
|
||||||
- BITMESSAGE_SEED_PHRASE=bitmessage_seed_phrase
|
- BITMESSAGE_SEED_PHRASE=
|
||||||
- BITMESSAGE_SEED_ADDRESSES=1
|
- BITMESSAGE_SEED_ADDRESSES=1
|
||||||
- BITMESSAGE_TTL=172800
|
- BITMESSAGE_TTL=172800
|
||||||
- BITMESSAGE_STOPRESENDINGAFTERXDAYS=60
|
- BITMESSAGE_STOPRESENDINGAFTERXDAYS=60
|
||||||
ports:
|
ports:
|
||||||
- 8442:8442
|
- 8442:8442
|
||||||
|
volumes:
|
||||||
|
- bitmessage:/home/bitmessage
|
||||||
|
volumes:
|
||||||
|
bitmessage:
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# A container for PyBitmessage daemon
|
# A container for PyBitmessage daemon
|
||||||
FROM ubuntu:bionic-20220401
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
|
||||||
|
|
||||||
@@ -11,25 +11,18 @@ RUN apt-get install -yq --no-install-suggests --no-install-recommends \
|
|||||||
python-all-dev python-msgpack python-pip python-setuptools \
|
python-all-dev python-msgpack python-pip python-setuptools \
|
||||||
git
|
git
|
||||||
|
|
||||||
WORKDIR /root
|
## Do not use cache when building next layers of the image.
|
||||||
RUN git clone https://github.com/Bitmessage/PyBitmessage
|
ARG NOCACHE=0
|
||||||
|
|
||||||
WORKDIR /root/PyBitmessage
|
WORKDIR /root/PyBitmessage
|
||||||
|
RUN git clone https://github.com/Bitmessage/PyBitmessage .
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
RUN pip2 install jsonrpclib .
|
RUN pip2 install jsonrpclib .
|
||||||
|
|
||||||
FROM ubuntu:bionic-20220401
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
EXPOSE 8442
|
EXPOSE 8442/tcp
|
||||||
|
|
||||||
ENV BITMESSAGE_API_USER=bitmessage_api_user
|
|
||||||
ENV BITMESSAGE_API_PASSWORD=bitmessage_api_password
|
|
||||||
ENV BITMESSAGE_SEED_PHRASE=bitmessage_seed_phrase
|
|
||||||
ENV BITMESSAGE_SEED_ADDRESSES=1
|
|
||||||
ENV BITMESSAGE_API_PORT=8442
|
|
||||||
ENV BITMESSAGE_TTL=172800
|
|
||||||
ENV BITMESSAGE_STOPRESENDINGAFTERXDAYS=30
|
|
||||||
|
|
||||||
ENV USER_UID=2000
|
ENV USER_UID=2000
|
||||||
ENV USER_GID=2000
|
ENV USER_GID=2000
|
||||||
@@ -37,6 +30,9 @@ ENV HOME=/home/bitmessage
|
|||||||
ENV BITMESSAGE_HOME=${HOME}
|
ENV BITMESSAGE_HOME=${HOME}
|
||||||
|
|
||||||
COPY --from=0 /usr/local/ /usr/local/
|
COPY --from=0 /usr/local/ /usr/local/
|
||||||
|
COPY ./docker/healthy_check.py /usr/local/bin/
|
||||||
|
COPY ./docker/seed_addr_gen.py /usr/local/bin/
|
||||||
|
COPY ./docker/run.sh /usr/local/bin/
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@@ -45,29 +41,16 @@ RUN apt-get update \
|
|||||||
|
|
||||||
# Create a user
|
# Create a user
|
||||||
RUN addgroup --gid $USER_GID bitmessage ;\
|
RUN addgroup --gid $USER_GID bitmessage ;\
|
||||||
useradd --uid $USER_UID --gid $USER_GID -m -d $HOME bitmessage
|
useradd --uid $USER_UID --gid $USER_GID --skel /dev/null --create-home --home-dir $HOME bitmessage
|
||||||
|
|
||||||
WORKDIR ${HOME}
|
WORKDIR ${HOME}
|
||||||
|
|
||||||
# Generate default config
|
# Generate default config
|
||||||
RUN su bitmessage -c "pybitmessage -t"
|
RUN su bitmessage -c "pybitmessage -t"
|
||||||
|
|
||||||
# Setup environment
|
CMD ["sh", "/usr/local/bin/run.sh"]
|
||||||
CMD chown bitmessage:bitmessage keys.dat; chmod 600 keys.dat; \
|
|
||||||
cat keys.dat | \
|
|
||||||
sed -e "s|\(apiinterface = \).*|\10\.0\.0\.0|g" \
|
|
||||||
#-e "s|\(apivariant = \).*|\1json|g" \
|
|
||||||
-e "s|\(apiusername = \).*|\1$BITMESSAGE_API_USER|g" \
|
|
||||||
-e "s|\(apipassword = \).*|\1$BITMESSAGE_API_PASSWORD|g" \
|
|
||||||
-e "s|\(apiport = \).*|\1$BITMESSAGE_API_PORT|g" \
|
|
||||||
-e "s|\(apienabled = \).*|\1True|g" \
|
|
||||||
-e "s|\(ttl = \).*|\1$BITMESSAGE_TTL|g" \
|
|
||||||
-e "s|\(stopresendingafterxdays = \).*|\1$BITMESSAGE_STOPRESENDINGAFTERXDAYS|g" \
|
|
||||||
-e "s|\(udp = \).*|\1False|g" | \
|
|
||||||
gosu bitmessage sponge keys.dat && \
|
|
||||||
exec gosu bitmessage nice -n 19 pybitmessage -d
|
|
||||||
|
|
||||||
# Generate Deterministic address
|
## Check PyBitmessage active network connections
|
||||||
HEALTHCHECK --retries=3 --interval=15s \
|
HEALTHCHECK --retries=0 --interval=15s \
|
||||||
CMD python -c "import xmlrpclib; api_link='http://$BITMESSAGE_API_USER:$BITMESSAGE_API_PASSWORD@127.0.0.1:8442/'; api = xmlrpclib.ServerProxy(api_link); print api.createDeterministicAddresses('$BITMESSAGE_SEED_PHRASE'.encode('base64'),$BITMESSAGE_SEED_ADDRESSES)" || exit 1
|
CMD ["python", "/usr/local/bin/healthy_check.py"]
|
||||||
|
|
||||||
|
|||||||
23
docker/healthy_check.py
Normal file
23
docker/healthy_check.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import xmlrpclib
|
||||||
|
import json
|
||||||
|
|
||||||
|
api_user=os.getenv('BITMESSAGE_API_USER', 'bitmessage_api_user') ;
|
||||||
|
api_password=os.getenv('BITMESSAGE_API_PASSWORD', 'bitmessage_api_password') ;
|
||||||
|
api_port=os.getenv('BITMESSAGE_API_PORT', '8442') ;
|
||||||
|
|
||||||
|
api_link="http://{}:{}@127.0.0.1:{}/".format(api_user, api_password, api_port)
|
||||||
|
|
||||||
|
api = xmlrpclib.ServerProxy(api_link)
|
||||||
|
|
||||||
|
network_connections=json.loads(api.clientStatus())['networkConnections']
|
||||||
|
print "networkConnections:", network_connections
|
||||||
|
|
||||||
|
if network_connections > 0:
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
49
docker/run.sh
Normal file
49
docker/run.sh
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export BITMESSAGE_API_USER=${BITMESSAGE_API_USER:-bitmessage_api_user}
|
||||||
|
export BITMESSAGE_API_PASSWORD=${BITMESSAGE_API_PASSWORD:-bitmessage_api_password}
|
||||||
|
export BITMESSAGE_SEED_ADDRESSES=${BITMESSAGE_SEED_ADDRESSES:-1}
|
||||||
|
export BITMESSAGE_API_PORT=${BITMESSAGE_API_PORT:-8442}
|
||||||
|
export BITMESSAGE_TTL=${BITMESSAGE_TTL:-172800}
|
||||||
|
export BITMESSAGE_STOPRESENDINGAFTERXDAYS=${BITMESSAGE_STOPRESENDINGAFTERXDAYS:-30}
|
||||||
|
export BITMESSAGE_APIVARIANT=${BITMESSAGE_APIVARIANT:-legacy}
|
||||||
|
|
||||||
|
SEED_FILE="address_seed.txt"
|
||||||
|
test -e "$SEED_FILE" || gosu bitmessage touch "$SEED_FILE"
|
||||||
|
|
||||||
|
# Save seed to file, or use saved seed
|
||||||
|
if [ -n "$BITMESSAGE_SEED_PHRASE" ]
|
||||||
|
then
|
||||||
|
export BITMESSAGE_SEED_PHRASE
|
||||||
|
grep -q "$BITMESSAGE_SEED_PHRASE" "$SEED_FILE" \
|
||||||
|
|| echo "$BITMESSAGE_SEED_PHRASE" >> "$SEED_FILE"
|
||||||
|
else
|
||||||
|
OLD_SEED="$(tail -n1 $SEED_FILE)"
|
||||||
|
NEW_SEED="$(cat /dev/random | tr -dc "a-z" | head -c32)"
|
||||||
|
export BITMESSAGE_SEED_PHRASE="${OLD_SEED:-$NEW_SEED}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# this command must be run as root (for bind mounts to container)
|
||||||
|
chown bitmessage:bitmessage keys.dat
|
||||||
|
chmod 600 keys.dat
|
||||||
|
|
||||||
|
# set config values
|
||||||
|
gosu bitmessage sed -i -e "s|\(apiinterface = \).*|\10\.0\.0\.0|g" \
|
||||||
|
-e "s|\(apivariant = \).*|\1$BITMESSAGE_APIVARIANT|g" \
|
||||||
|
-e "s|\(apiusername = \).*|\1$BITMESSAGE_API_USER|g" \
|
||||||
|
-e "s|\(apipassword = \).*|\1$BITMESSAGE_API_PASSWORD|g" \
|
||||||
|
-e "s|\(apiport = \).*|\1$BITMESSAGE_API_PORT|g" \
|
||||||
|
-e "s|\(apienabled = \).*|\1True|g" \
|
||||||
|
-e "s|\(ttl = \).*|\1$BITMESSAGE_TTL|g" \
|
||||||
|
-e "s|\(stopresendingafterxdays = \).*|\1$BITMESSAGE_STOPRESENDINGAFTERXDAYS|g" \
|
||||||
|
-e "s|\(udp = \).*|\1False|g" keys.dat
|
||||||
|
|
||||||
|
# generate address from seed
|
||||||
|
for i in {1..4}
|
||||||
|
do
|
||||||
|
sleep 15
|
||||||
|
gosu bitmessage /usr/bin/python /usr/local/bin/seed_addr_gen.py
|
||||||
|
done &
|
||||||
|
|
||||||
|
exec gosu bitmessage pybitmessage -d
|
||||||
|
|
||||||
17
docker/seed_addr_gen.py
Normal file
17
docker/seed_addr_gen.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import xmlrpclib
|
||||||
|
|
||||||
|
api_user=os.getenv('BITMESSAGE_API_USER', 'bitmessage_api_user') ;
|
||||||
|
api_password=os.getenv('BITMESSAGE_API_PASSWORD', 'bitmessage_api_password') ;
|
||||||
|
api_port=os.getenv('BITMESSAGE_API_PORT', '8442') ;
|
||||||
|
addr_num=os.getenv('BITMESSAGE_SEED_ADDRESSES', '1') ;
|
||||||
|
addr_seed=os.getenv('BITMESSAGE_SEED_PHRASE') ;
|
||||||
|
|
||||||
|
api_link="http://{}:{}@127.0.0.1:{}/".format(api_user, api_password, api_port)
|
||||||
|
|
||||||
|
api = xmlrpclib.ServerProxy(api_link)
|
||||||
|
|
||||||
|
print api.createDeterministicAddresses(addr_seed.encode('base64'),int(addr_num))
|
||||||
|
|
||||||
@@ -1,15 +1,22 @@
|
|||||||
# Last Modified: Sat Dec 31 13:53:53 2022
|
# Last Modified: Fri Oct 13 05:01:46 2023
|
||||||
#include <tunables/global>
|
include <tunables/global>
|
||||||
|
|
||||||
/**/PyBitmessage*.AppImage {
|
/**/PyBitmessage*.AppImage {
|
||||||
#include <abstractions/apparmor_api/find_mountpoint>
|
include <abstractions/apparmor_api/find_mountpoint>
|
||||||
#include <abstractions/base>
|
include <abstractions/base>
|
||||||
#include <abstractions/fonts>
|
include <abstractions/fonts>
|
||||||
#include <abstractions/user-tmp>
|
include <abstractions/openssl>
|
||||||
|
include <abstractions/user-tmp>
|
||||||
|
|
||||||
capability dac_read_search,
|
capability dac_read_search,
|
||||||
capability sys_admin,
|
capability sys_admin,
|
||||||
|
|
||||||
|
network inet dgram,
|
||||||
|
network inet stream,
|
||||||
|
network inet6 dgram,
|
||||||
|
network inet6 stream,
|
||||||
|
network netlink raw,
|
||||||
|
|
||||||
mount fstype=fuse.PyBitmessage*.AppImage options=(ro, nosuid, nodev),
|
mount fstype=fuse.PyBitmessage*.AppImage options=(ro, nosuid, nodev),
|
||||||
umount,
|
umount,
|
||||||
|
|
||||||
@@ -24,6 +31,23 @@
|
|||||||
/etc/xdg/Trolltech.conf rk,
|
/etc/xdg/Trolltech.conf rk,
|
||||||
/proc/filesystems r,
|
/proc/filesystems r,
|
||||||
/sys/devices/system/cpu/online r,
|
/sys/devices/system/cpu/online r,
|
||||||
|
|
||||||
|
/tmp/*/*/.mount_PyBitm*/ r,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/** r,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/AppRun mrix,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/lib/x86_64-linux-gnu/lib*.so* mr,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/usr/bin/pybitmessage mrix,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/usr/bin/qt.conf mrk,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/usr/lib/python2.7/**.so mr,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/usr/bin/python2.7 rix,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/usr/lib/x86_64-linux-gnu/**/lib*.so* mr,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/usr/lib/x86_64-linux-gnu/lib*.so* mr,
|
||||||
|
/tmp/*/*/.mount_PyBitm*/lib/x86_64/lib*.so mr,
|
||||||
|
/proc/*/cmdline r,
|
||||||
|
/usr/share/themes/** r,
|
||||||
|
owner /run/*/*/sni-qt_python2*/ rw,
|
||||||
|
owner /run/*/*/sni-qt_python2*/icons/ rw,
|
||||||
|
|
||||||
/tmp/.mount_PyBitm*/ r,
|
/tmp/.mount_PyBitm*/ r,
|
||||||
/tmp/.mount_PyBitm*/** r,
|
/tmp/.mount_PyBitm*/** r,
|
||||||
/tmp/.mount_PyBitm*/AppRun mrix,
|
/tmp/.mount_PyBitm*/AppRun mrix,
|
||||||
@@ -42,14 +66,17 @@
|
|||||||
/usr/share/icons/ r,
|
/usr/share/icons/ r,
|
||||||
/usr/share/icons/Adwaita/* r,
|
/usr/share/icons/Adwaita/* r,
|
||||||
/usr/share/icons/Adwaita/** r,
|
/usr/share/icons/Adwaita/** r,
|
||||||
/usr/share/icons/hicolor/* r,
|
/usr/share/icons/gnome/* r,
|
||||||
|
/usr/share/icons/hicolor/* rk,
|
||||||
/usr/share/mime/* r,
|
/usr/share/mime/* r,
|
||||||
/usr/share/pixmaps/ r,
|
/usr/share/pixmaps/ r,
|
||||||
/usr/share/themes/Adwaita/** r,
|
/usr/share/themes/Adwaita/** r,
|
||||||
|
owner /**/PyBitmessage*.AppImage mr,
|
||||||
owner /etc/passwd r,
|
owner /etc/passwd r,
|
||||||
|
owner @{HOME}/tmp* w,
|
||||||
owner /run/systemd/userdb/ r,
|
owner /run/systemd/userdb/ r,
|
||||||
owner /run/user/*/sni-qt_python2_*/ rw,
|
owner /run/*/*/sni-qt_python2_*/ rw,
|
||||||
owner /run/user/*/sni-qt_python2_*/icons/ rw,
|
owner /run/*/*/sni-qt_python2_*/icons/ rw,
|
||||||
owner /usr/local/share/fonts/** r,
|
owner /usr/local/share/fonts/** r,
|
||||||
owner @{HOME}/.cache/fontconfig/*-le64.cache-7 r,
|
owner @{HOME}/.cache/fontconfig/*-le64.cache-7 r,
|
||||||
owner @{HOME}/.config/PyBitmessage/ r,
|
owner @{HOME}/.config/PyBitmessage/ r,
|
||||||
@@ -62,6 +89,6 @@
|
|||||||
owner @{HOME}/.config/PyBitmessage/pybitmessageqt.conf rwk,
|
owner @{HOME}/.config/PyBitmessage/pybitmessageqt.conf rwk,
|
||||||
owner @{HOME}/.config/PyBitmessage/singleton.lock rwk,
|
owner @{HOME}/.config/PyBitmessage/singleton.lock rwk,
|
||||||
owner @{HOME}/.config/Trolltech.conf rwk,
|
owner @{HOME}/.config/Trolltech.conf rwk,
|
||||||
owner /**/PyBitmessage*.AppImage mr,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ User=bitmessage
|
|||||||
Group=bitmessage
|
Group=bitmessage
|
||||||
PrivateTmp=yes
|
PrivateTmp=yes
|
||||||
|
|
||||||
|
#ProtectHome=tmpfs
|
||||||
|
#BindPaths=/home/bitmessage/.config/PyBitmessage/
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
|||||||
35
usr/local/bin/bitmessage-updater.sh
Executable file
35
usr/local/bin/bitmessage-updater.sh
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
#Be careful when downloading form https://artifacts.bitmessage.at. It's just a dump of binaries, it doesn't separate the official with development binaries.
|
||||||
|
#
|
||||||
|
#To find out which is the latest official one, go to github and click on the icon indicating the latest official build result.
|
||||||
|
#
|
||||||
|
#Peter Surda
|
||||||
|
#Bitmessage developer
|
||||||
|
#
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
IMAGE_LIST="https://artifacts.bitmessage.at/appimage"
|
||||||
|
LAST_IMAGE="$(wget -q $IMAGE_LIST -O- | grep -oP '[[:digit:]]{5}' | tail -n1)"
|
||||||
|
|
||||||
|
IMAGE_FILENAME="$(wget -q $IMAGE_LIST/$LAST_IMAGE -O- | grep -oE '"PyBitmessage-.*-x86_64.AppImage"')"
|
||||||
|
IMAGE_FILENAME=${IMAGE_FILENAME:1:-1}
|
||||||
|
|
||||||
|
URL="$IMAGE_LIST/$LAST_IMAGE/$IMAGE_FILENAME"
|
||||||
|
|
||||||
|
DEST_FILE="$HOME/$IMAGE_FILENAME"
|
||||||
|
HARD_LINK="$HOME/PyBitmessage.AppImage"
|
||||||
|
|
||||||
|
if ! [ -f $DEST_FILE ]; then
|
||||||
|
wget -c $URL -O $DEST_FILE
|
||||||
|
chmod u+x $DEST_FILE
|
||||||
|
cp -v -fl $DEST_FILE $HARD_LINK
|
||||||
|
fi
|
||||||
|
|
||||||
|
#remove old appimage files
|
||||||
|
ls -1 -tc $HOME/PyBitmessage-.*-x86_64.AppImage 2>/dev/null \
|
||||||
|
| tail -n +3 \
|
||||||
|
| xargs -I{} rm -f $HOME/{}
|
||||||
|
|
||||||
Reference in New Issue
Block a user