diff options
Diffstat (limited to 'contrib/packages/alpine/gnunet/gnunet.post-install')
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet.post-install | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/packages/alpine/gnunet/gnunet.post-install b/contrib/packages/alpine/gnunet/gnunet.post-install new file mode 100644 index 000000000..f7c19b26f --- /dev/null +++ b/contrib/packages/alpine/gnunet/gnunet.post-install | |||
@@ -0,0 +1,40 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Enumerate users. | ||
4 | users=`awk -F ':' '$3>=1000 && $3<2000 {print $1}' /etc/passwd` | ||
5 | |||
6 | # Install gnunet.conf for existing users. | ||
7 | for user in $users; do | ||
8 | install -m644 -o $user -g $user -D /etc/skel/.config/gnunet.conf \ | ||
9 | /home/$user/.config/gnunet.conf | ||
10 | done | ||
11 | |||
12 | # Enable GNS proxy for users, if desired. | ||
13 | echo "Use GNU Name System in Firefox/Chromium by default? [y,N]" | ||
14 | read -r yn | ||
15 | case $yn in | ||
16 | y|Y ) | ||
17 | # Enable GNS proxy for existant users. | ||
18 | for user in $users; do | ||
19 | port=$((8000+$(id -u $user))) | ||
20 | gnunet-config -c /home/$user/.config/gnunet.conf \ | ||
21 | --rewrite \ | ||
22 | --section=gns-proxy \ | ||
23 | --option=IMMEDIATE_START \ | ||
24 | --value=YES | ||
25 | gnunet-config -c /home/$user/.config/gnunet.conf \ | ||
26 | --rewrite \ | ||
27 | --section=gns-proxy \ | ||
28 | --option=OPTIONS \ | ||
29 | --value="-p $port" | ||
30 | done | ||
31 | |||
32 | # Enable GNS proxy for future users. | ||
33 | echo "[gns-proxy]" >> /etc/skel/.config/gnunet.conf | ||
34 | echo "IMMEDIATE_START = YES" >> /etc/skel/.config/gnunet.conf | ||
35 | ;; | ||
36 | * ) | ||
37 | ;; | ||
38 | esac | ||
39 | |||
40 | exit 0 | ||