aboutsummaryrefslogtreecommitdiff
path: root/contrib/alpine/gnunet/gnunet.xsession
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/alpine/gnunet/gnunet.xsession')
-rw-r--r--contrib/alpine/gnunet/gnunet.xsession72
1 files changed, 36 insertions, 36 deletions
diff --git a/contrib/alpine/gnunet/gnunet.xsession b/contrib/alpine/gnunet/gnunet.xsession
index 2d2bb392a..f19d6baf7 100644
--- a/contrib/alpine/gnunet/gnunet.xsession
+++ b/contrib/alpine/gnunet/gnunet.xsession
@@ -1,46 +1,46 @@
1#!/bin/sh 1#!/bin/sh
2user=`whoami` 2user=$(whoami)
3gnunet_proxy=`gnunet-config -c /etc/skel/.config/gnunet.conf -s gns-proxy|grep 'IMMEDIATE_START = YES'` 3gnunet_proxy=$(gnunet-config -c /etc/skel/.config/gnunet.conf -s gns-proxy|grep 'IMMEDIATE_START = YES')
4 4
5# Enable GNS proxy for new users informed by /etc/skel. 5# Enable GNS proxy for new users informed by /etc/skel.
6if [ "$gnunet_proxy" ]; then 6if [ "$gnunet_proxy" ]; then
7 7
8 # Calculate user specific port 8 # Calculate user specific port
9 port=$((8000+$(id -u $user))) 9 port=$((8000+$(id -u $user)))
10 10
11 gnunet-config -c /home/$user/.config/gnunet.conf \ 11 gnunet-config -c /home/$user/.config/gnunet.conf \
12 --rewrite \ 12 --rewrite \
13 --section=gns-proxy \ 13 --section=gns-proxy \
14 --option=OPTIONS \ 14 --option=OPTIONS \
15 --value="-p $port" 15 --value="-p $port"
16 16
17 # Firefox 17 # Firefox
18 if [ ! -d ~/.mozilla/firefox/*.default ];then 18 if [ ! -d ~/.mozilla/firefox/*.default ];then
19 timeout 3s firefox --headless # dirty: create profile if not existent 19 timeout 3s firefox --headless # dirty: create profile if not existent
20 fi 20 fi
21 for ffprofile in ~/.mozilla/firefox/*.*/; do 21 for ffprofile in ~/.mozilla/firefox/*.*/; do
22 js=$ffprofile/user.js 22 js=$ffprofile/user.js
23 if [ -f $js ]; then 23 if [ -f $js ]; then
24 sed -i '/Preferences for using the GNU Name System/d' $js 24 sed -i '/Preferences for using the GNU Name System/d' $js
25 sed -i '/network.proxy.socks/d' $js 25 sed -i '/network.proxy.socks/d' $js
26 sed -i '/network.proxy.socks_port/d' $js 26 sed -i '/network.proxy.socks_port/d' $js
27 sed -i '/network.proxy.socks_remote_dns/d' $js 27 sed -i '/network.proxy.socks_remote_dns/d' $js
28 sed -i '/network.proxy.type/d' $js 28 sed -i '/network.proxy.type/d' $js
29 fi 29 fi
30 echo "// Preferences for using the GNU Name System" >> $js 30 echo "// Preferences for using the GNU Name System" >> $js
31 echo "user_pref(\"network.proxy.socks\", \"localhost\");" >> $js 31 echo "user_pref(\"network.proxy.socks\", \"localhost\");" >> $js
32 echo "user_pref(\"network.proxy.socks_port\", $port);" >> $js 32 echo "user_pref(\"network.proxy.socks_port\", $port);" >> $js
33 echo "user_pref(\"network.proxy.socks_remote_dns\", true);" >> $js 33 echo "user_pref(\"network.proxy.socks_remote_dns\", true);" >> $js
34 echo "user_pref(\"network.proxy.type\", 1);" >> $js 34 echo "user_pref(\"network.proxy.type\", 1);" >> $js
35 done 35 done
36 36
37 # Chromium 37 # Chromium
38 profile=/home/$user/.profile 38 profile=/home/$user/.profile
39 if [ -f $profile ]; then 39 if [ -f $profile ]; then
40 sed -i '/CHROMIUM_USER_FLAGS/d' $profile 40 sed -i '/CHROMIUM_USER_FLAGS/d' $profile
41 fi 41 fi
42 echo "export CHROMIUM_USER_FLAGS=--proxy-server=socks5://localhost:$port" \ 42 echo "export CHROMIUM_USER_FLAGS=--proxy-server=socks5://localhost:$port" \
43 >> $profile 43 >> $profile
44fi 44fi
45 45
46# Create/Renew GNS certificate authority (CA) per user. 46# Create/Renew GNS certificate authority (CA) per user.
@@ -50,5 +50,5 @@ gnunet-gns-proxy-setup-ca
50# restarted afterwards, start user services after login. 50# restarted afterwards, start user services after login.
51if test -z "`ps|grep -v grep|grep $user|grep gnunet-service-arm`" > /dev/null 2>&1 51if test -z "`ps|grep -v grep|grep $user|grep gnunet-service-arm`" > /dev/null 2>&1
52then 52then
53 gnunet-arm -c /home/$user/.config/gnunet.conf -s 53 gnunet-arm -c /home/$user/.config/gnunet.conf -s
54fi 54fi