Skip to content

Commit

Permalink
Merge pull request #1 from remcoros/pollish
Browse files Browse the repository at this point in the history
address feedback
  • Loading branch information
remcoros authored Feb 9, 2024
2 parents db34986 + 49019c0 commit 8545111
Show file tree
Hide file tree
Showing 8 changed files with 971 additions and 147 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ RUN \
librsvg2-common \
notification-daemon \
python3-xdg \
# dark theme
gnome-themes-extra \
# other
wget \
socat \
Expand Down Expand Up @@ -54,7 +56,6 @@ RUN \
mv /tmp/yq /usr/local/bin/yq && chmod +x /usr/local/bin/yq && \
echo "**** xfce tweaks ****" && \
rm -f /etc/xdg/autostart/xscreensaver.desktop && \
sed -i 's|</applications>| <application title="Sparrow" type="normal">\n <maximized>yes</maximized>\n </application>\n</applications>|' /etc/xdg/openbox/rc.xml && \
# StartOS branding
echo "Starting Sparrow on Webtop for StartOS..." > /etc/s6-overlay/s6-rc.d/init-adduser/branding; sed -i '/run_branding() {/,/}/d' /docker-mods && \
# cleanup and remove some unneeded large binaries
Expand Down Expand Up @@ -112,7 +113,10 @@ ENV \
# base container starts docker by default, but we removed it, so set to false
START_DOCKER=false \
PULSE_RUNTIME_PATH=/defaults \
NVIDIA_DRIVER_CAPABILITIES=all
NVIDIA_DRIVER_CAPABILITIES=all \
# set dark theme
GTK_THEME=Adwaita:dark \
GTK2_RC_FILES=/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc

# add local files
COPY /root /
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ RUN \
librsvg2-common \
notification-daemon \
python3-xdg \
# dark theme
gnome-themes-extra \
# other
wget \
socat \
Expand Down Expand Up @@ -54,7 +56,6 @@ RUN \
mv /tmp/yq /usr/local/bin/yq && chmod +x /usr/local/bin/yq && \
echo "**** xfce tweaks ****" && \
rm -f /etc/xdg/autostart/xscreensaver.desktop && \
sed -i 's|</applications>| <application title="Sparrow" type="normal">\n <maximized>yes</maximized>\n </application>\n</applications>|' /etc/xdg/openbox/rc.xml && \
# StartOS branding
echo "Starting Sparrow on Webtop for StartOS..." > /etc/s6-overlay/s6-rc.d/init-adduser/branding; sed -i '/run_branding() {/,/}/d' /docker-mods && \
# cleanup and remove some unneeded large binaries
Expand Down Expand Up @@ -112,7 +113,10 @@ ENV \
# base container starts docker by default, but we removed it, so set to false
START_DOCKER=false \
PULSE_RUNTIME_PATH=/defaults \
NVIDIA_DRIVER_CAPABILITIES=all
NVIDIA_DRIVER_CAPABILITIES=all \
# set dark theme
GTK_THEME=Adwaita:dark \
GTK2_RC_FILES=/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc

# add local files
COPY /root /
Expand Down
101 changes: 59 additions & 42 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,54 +28,71 @@ data:
masked: true
EOF

# Copy default files
if [ ! -f /config/.config/openbox/rc.xml ]; then
mkdir -p /config/.config/openbox
cp /defaults/rc.xml /config/.config/openbox/rc.xml
chown -R $PUID:$PGID /config/.config/openbox
fi

if [ ! -f /config/.sparrow/config ]; then
echo "No Sparrow config file found, creating default"
mkdir -p /config/.sparrow
cp /defaults/.sparrow/config /config/.sparrow/config
chown -R 1000:1000 /config/.sparrow
chown -R $PUID:$PGID /config/.sparrow
fi

case "$(yq e '.server.type' /root/data/start9/config.yaml)" in
"bitcoind")
echo "Configuring Sparrow for Bitcoin Core"
export BITCOIND_USER=$(yq e '.server.user' /root/data/start9/config.yaml)
export BITCOIND_PASS=$(yq e '.server.password' /root/data/start9/config.yaml)
yq e -i '
.serverType = "BITCOIN_CORE" |
.coreServer = "http://127.0.0.1:8332" |
.coreAuthType = "USERPASS" |
.coreAuth = strenv(BITCOIND_USER) + ":" + strenv(BITCOIND_PASS)' -o=json /config/.sparrow/config
;;
"electrs")
echo "Configuring Sparrow for Electrs"
yq e -i '
.serverType = "ELECTRUM_SERVER" |
.coreServer = "tcp://127.0.0.1:50001"' -o=json /config/.sparrow/config
;;
"public")
echo "Configuring Sparrow for Public electrum server"
yq e -i '.serverType = "PUBLIC_ELECTRUM_SERVER"' -o=json /config/.sparrow/config
;;
*)
echo "Custom server selected, not configuring Sparrow"
;;
esac
# Manage Sparrow settings?
if [ $(yq e '.sparrow.managesettings' /root/data/start9/config.yaml) = "true" ]; then
# private bitcoin/electrum server
case "$(yq e '.sparrow.server.type' /root/data/start9/config.yaml)" in
"bitcoind")
echo "Configuring Sparrow for Bitcoin Core"
export BITCOIND_USER=$(yq e '.sparrow.server.user' /root/data/start9/config.yaml)
export BITCOIND_PASS=$(yq e '.sparrow.server.password' /root/data/start9/config.yaml)
yq e -i '
.serverType = "BITCOIN_CORE" |
.coreServer = "http://127.0.0.1:8332" |
.coreAuthType = "USERPASS" |
.coreAuth = strenv(BITCOIND_USER) + ":" + strenv(BITCOIND_PASS)' -o=json /config/.sparrow/config
;;
"electrs")
echo "Configuring Sparrow for Electrs"
yq e -i '
.serverType = "ELECTRUM_SERVER" |
.coreServer = "tcp://127.0.0.1:50001"' -o=json /config/.sparrow/config
;;
"public")
echo "Configuring Sparrow for Public electrum server"
yq e -i '.serverType = "PUBLIC_ELECTRUM_SERVER"' -o=json /config/.sparrow/config
;;
*)
echo "Unknown server selected, not configuring Sparrow"
;;
esac

# proxy
case "$(yq e '.sparrow.proxy.type' /root/data/start9/config.yaml)" in
"tor")
echo "Configuring Sparrow for Tor"
export EMBASSY_IP=$(ip -4 route list match 0/0 | awk '{print $3}')
yq e -i '
.useProxy = true |
.proxyServer = strenv(EMBASSY_IP) + ":9050"' -o=json /config/.sparrow/config
;;
"none")
echo "Configuring Sparrow for 'no proxy'"
yq e -i '.useProxy = false' -o=json /config/.sparrow/config
;;
*)
echo "Unknown proxy selected, not configuring Sparrow"
;;
esac
fi

case "$(yq e '.proxy.type' /root/data/start9/config.yaml)" in
"tor")
echo "Configuring Sparrow for Tor"
export EMBASSY_IP=$(ip -4 route list match 0/0 | awk '{print $3}')
yq e -i '
.useProxy = true |
.proxyServer = strenv(EMBASSY_IP) + ":9050"' -o=json /config/.sparrow/config
;;
"none")
echo "Configuring Sparrow for 'no proxy'"
yq e -i '.useProxy = false' -o=json /config/.sparrow/config
;;
*)
echo "Custom proxy selected, not configuring Sparrow"
;;
esac
# setup a proxy on localhost, Sparrow will not use Tor for local addresses
# this means we can connect straight to bitcoind/electrs and use Tor for everything else (whirlpool)
/usr/bin/socat tcp-l:8332,fork,reuseaddr,su=nobody,bind=127.0.0.1 tcp:bitcoind.embassy:8332 &
/usr/bin/socat tcp-l:50001,fork,reuseaddr,su=nobody,bind=127.0.0.1 tcp:electrs.embassy:50001 &

exec /init
4 changes: 2 additions & 2 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: webtop-sparrow
title: "Sparrow"
version: 1.8.2.5
version: 1.8.2.1
release-notes: |
Sparrow 1.8.2 on Webtop for StartOS
license: GPLv3
Expand All @@ -27,7 +27,7 @@ main:
mounts:
main: /root/data
userdir: /config
gpu-acceleration: false
gpu-acceleration: true
hardware-requirements:
arch:
- x86_64
Expand Down
7 changes: 0 additions & 7 deletions root/defaults/autostart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

# default file copies first run
if [ ! -f $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml ]; then
mkdir -p $HOME/.config/xfce4/xfconf/xfce-perchannel-xml
Expand All @@ -9,9 +7,4 @@ fi
# open files and directories with thunar (file manager)
xdg-mime default thunar.desktop inode/directory

# setup a proxy on localhost, Sparrow will not use Tor for local addresses
# this means we can connect straight to bitcoind/electrs and use Tor for everything else (whirlpool)
/usr/bin/socat tcp-l:8332,fork,reuseaddr,bind=127.0.0.1 tcp:bitcoind.embassy:8332 &
/usr/bin/socat tcp-l:50001,fork,reuseaddr,bind=127.0.0.1 tcp:electrs.embassy:50001 &

/opt/sparrow/bin/Sparrow &
Loading

0 comments on commit 8545111

Please sign in to comment.