diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-12-28 11:19:30 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-12-28 11:19:30 +0100 |
commit | e9d73b0a901d7dfe1fd219aecc960747e7c49483 (patch) | |
tree | 94f835cf56a1feb453a1f65534e28334c6e258f8 /debian/etc/X11/xinit | |
parent | debba1a49a46ba963553da222ade563d6d67932b (diff) | |
download | gnunet-e9d73b0a901d7dfe1fd219aecc960747e7c49483.tar.gz gnunet-e9d73b0a901d7dfe1fd219aecc960747e7c49483.zip |
import Debian build rules, split off libgnunet
Diffstat (limited to 'debian/etc/X11/xinit')
-rw-r--r-- | debian/etc/X11/xinit/xinitrc.d/80-gnunet-user-services | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/debian/etc/X11/xinit/xinitrc.d/80-gnunet-user-services b/debian/etc/X11/xinit/xinitrc.d/80-gnunet-user-services new file mode 100644 index 000000000..aff1dd78c --- /dev/null +++ b/debian/etc/X11/xinit/xinitrc.d/80-gnunet-user-services | |||
@@ -0,0 +1,48 @@ | |||
1 | #!/bin/bash | ||
2 | user=$(whoami) | ||
3 | gnunet_proxy=$(gnunet-config -c /etc/skel/.config/gnunet.conf -s gns-proxy | grep 'IMMEDIATE_START = YES') | ||
4 | |||
5 | # Enable GNS proxy for new users informed by /etc/skel. | ||
6 | if [ "$gnunet_proxy" ]; then | ||
7 | |||
8 | # Calculate user specific port | ||
9 | port=$((8000+$(id -u "$user"))) | ||
10 | |||
11 | gnunet-config -c "$HOME/.config/gnunet.conf" \ | ||
12 | --rewrite \ | ||
13 | --section=gns-proxy \ | ||
14 | --option=OPTIONS \ | ||
15 | --value="-p $port" | ||
16 | |||
17 | # Firefox | ||
18 | defaultprofile=$(ls "$HOME/.mozilla/firefox/*.default") | ||
19 | if [ ! "$defaultprofile" ];then | ||
20 | timeout 3s firefox --headless # dirty: create profile if not existent | ||
21 | fi | ||
22 | for ffprofile in "$HOME"/.mozilla/firefox/*.*/; do | ||
23 | js=$ffprofile/user.js | ||
24 | if [ -f "$js" ]; then | ||
25 | sed -i '/Preferences for using the GNU Name System/d' "$js" | ||
26 | sed -i '/network.proxy.socks/d' "$js" | ||
27 | sed -i '/network.proxy.socks_port/d' "$js" | ||
28 | sed -i '/network.proxy.socks_remote_dns/d' "$js" | ||
29 | sed -i '/network.proxy.type/d' "$js" | ||
30 | fi | ||
31 | echo "// Preferences for using the GNU Name System" >> "$js" | ||
32 | echo "user_pref(\"network.proxy.socks\", \"localhost\");" >> "$js" | ||
33 | echo "user_pref(\"network.proxy.socks_port\", $port);" >> "$js" | ||
34 | echo "user_pref(\"network.proxy.socks_remote_dns\", true);" >> "$js" | ||
35 | echo "user_pref(\"network.proxy.type\", 1);" >> "$js" | ||
36 | done | ||
37 | |||
38 | # Chromium | ||
39 | profile="$HOME/.profile" | ||
40 | if [ -f "$profile" ]; then | ||
41 | sed -i '/CHROMIUM_USER_FLAGS/d' "$profile" | ||
42 | fi | ||
43 | echo "export CHROMIUM_USER_FLAGS=--proxy-server=socks5://localhost:$port" \ | ||
44 | >> "$profile" | ||
45 | fi | ||
46 | |||
47 | # Create/Renew GNS certificate authority (CA) per user. | ||
48 | gnunet-gns-proxy-setup-ca | ||