From 2032f3ce3ed0ed7a6c1c6fb9df6222d85758bf70 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 1 Aug 2021 12:26:20 +0200 Subject: debian: compat level, removal of user units, tweaks --- debian/changelog | 8 +++ debian/control | 2 +- debian/gnunet.postinst | 178 ++++++++++++++++--------------------------------- 3 files changed, 65 insertions(+), 123 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index f27aba2af..b78688984 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +gnunet (0.14.1-12) unstable; urgency=low + + * Lower debhelper compatibility level to 12. + * Do not inject user units in postinst for now. + * Tweaks to packaging. + + -- Florian Dold Sat, 31 Jul 2021 20:04:42 +0200 + gnunet (0.14.1-11) unstable; urgency=low * Make configuration parsing more permissive. diff --git a/debian/control b/debian/control index 01b549286..57acc6e1e 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Build-Depends: autoconf (>=2.59), automake (>=1.11.1), autopoint, - debhelper-compat (= 13), + debhelper-compat (= 12), gettext, iptables, libbluetooth-dev, diff --git a/debian/gnunet.postinst b/debian/gnunet.postinst index b6317f5be..091feb223 100644 --- a/debian/gnunet.postinst +++ b/debian/gnunet.postinst @@ -108,114 +108,63 @@ case "${1}" in echo " done." fi - # Install GNUnet configuration for all users provided non exists - userlist=$(awk -F ':' '$3>=1000 && $3<2000 {print $1}' /etc/passwd) - users=($userlist) - homedirlist=$(awk -F ':' '$3>=1000 && $3<2000 {print $6}' /etc/passwd) - homedirs=($homedirlist) - - for (( i=0; i<${#users[@]}; i++ )); do - usermod -aG gnunet ${users[$i]} - if [ -n "$i" ] && [ -d "${homedirs[$i]}" ]; then - mkdir -p ${homedirs[$i]}/.config/systemd/user/ - - cat > "${homedirs[$i]}/.config/systemd/user/gnunet-user.service" << EOF -# Copyright (C) 2019 GNUnet e.V. +# # Change the proxy settings for Firefox and Chromium if desired +# if ${_PROXY} +# then +# mkdir -p /etc/X11/xinit/xinitrc.d/ +#cat > "/etc/X11/xinit/xinitrc.d/80-gnunet-user-services" << "EOF" +##!/bin/bash +#systemctl --user daemon-reload +#systemctl --user start gnunet-user +#systemctl --user enable gnunet-user +#user=$(whoami) +#gnunet_proxy=$(gnunet-config -c /etc/skel/.config/gnunet.conf -s gns-proxy | grep 'IMMEDIATE_START = YES') # -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - -[Unit] -Description=Service that runs a GNUnet for the user gnunet -After=network.target - -[Service] -Type=forking -ExecStart=/usr/bin/gnunet-arm -s -c ${homedirs[$i]}/.config/gnunet.conf -ExecStop=/usr/bin/gnunet-arm -e -c ${homedirs[$i]}/.config/gnunet.conf - -[Install] -WantedBy=multi-user.target -EOF - - chown "${users[$i]}":"${users[$i]}" "${homedirs[$i]}/.config/systemd/user/gnunet-user.service" - if [ ! -f "${homedirs[$i]}/.config/gnunet.conf" ]; then - mkdir -p ${homedirs[$i]}/.config/ - cp /etc/skel/.config/gnunet.conf "${homedirs[$i]}/.config/gnunet.conf" - chmod 644 "${homedirs[$i]}/.config/gnunet.conf" - fi - fi - port=$((8000+$(id -u "${users[$i]}"))) - gnunet-config -c "${homedirs[$i]}/.config/gnunet.conf" \ - --section=gns-proxy \ - --option=IMMEDIATE_START \ - --value=YES - gnunet-config -c "${homedirs[$i]}/.config/gnunet.conf" \ - --section=gns-proxy \ - --option=OPTIONS \ - --value="-p $port" - chown "${users[$i]}":"${users[$i]}" "${homedirs[$i]}/.config/gnunet.conf" - done - - # Change the proxy settings for Firefox and Chromium if desired - if ${_PROXY} - then - mkdir -p /etc/X11/xinit/xinitrc.d/ -cat > "/etc/X11/xinit/xinitrc.d/80-gnunet-user-services" << "EOF" -#!/bin/bash -systemctl --user daemon-reload -systemctl --user start gnunet-user -systemctl --user enable gnunet-user -user=$(whoami) -gnunet_proxy=$(gnunet-config -c /etc/skel/.config/gnunet.conf -s gns-proxy | grep 'IMMEDIATE_START = YES') - -# Enable GNS proxy for new users informed by /etc/skel. -if [ "$gnunet_proxy" ]; then - - # Calculate user specific port - port=$((8000+$(id -u $user))) - - gnunet-config -c $HOME/.config/gnunet.conf \ - --section=gns-proxy \ - --option=OPTIONS \ - --value="-p $port" - - # Firefox - defaultprofile=$(ls $HOME/.mozilla/firefox/*.default) - if [ ! "$defaultprofile" ];then - timeout 3s firefox --headless # dirty: create profile if not existent - fi - for ffprofile in $HOME/.mozilla/firefox/*.*/; do - js=$ffprofile/user.js - if [ -f "$js" ]; then - sed -i '/Preferences for using the GNU Name System/d' "$js" - sed -i '/network.proxy.socks/d' "$js" - sed -i '/network.proxy.socks_port/d' "$js" - sed -i '/network.proxy.socks_remote_dns/d' "$js" - sed -i '/network.proxy.type/d' "$js" - fi - echo "// Preferences for using the GNU Name System" >> "$js" - echo "user_pref(\"network.proxy.socks\", \"localhost\");" >> "$js" - echo "user_pref(\"network.proxy.socks_port\", $port);" >> "$js" - echo "user_pref(\"network.proxy.socks_remote_dns\", true);" >> "$js" - echo "user_pref(\"network.proxy.type\", 1);" >> "$js" - done - - # Chromium - profile="$HOME/.profile" - if [ -f "$profile" ]; then - sed -i '/CHROMIUM_USER_FLAGS/d' "$profile" - fi - echo "export CHROMIUM_USER_FLAGS=--proxy-server=socks5://localhost:$port" \ - >> "$profile" -fi - -# Create/Renew GNS certificate authority (CA) per user. -gnunet-gns-proxy-setup-ca -EOF - fi +## Enable GNS proxy for new users informed by /etc/skel. +#if [ "$gnunet_proxy" ]; then +# +# # Calculate user specific port +# port=$((8000+$(id -u $user))) +# +# gnunet-config -c $HOME/.config/gnunet.conf \ +# --section=gns-proxy \ +# --option=OPTIONS \ +# --value="-p $port" +# +# # Firefox +# defaultprofile=$(ls $HOME/.mozilla/firefox/*.default) +# if [ ! "$defaultprofile" ];then +# timeout 3s firefox --headless # dirty: create profile if not existent +# fi +# for ffprofile in $HOME/.mozilla/firefox/*.*/; do +# js=$ffprofile/user.js +# if [ -f "$js" ]; then +# sed -i '/Preferences for using the GNU Name System/d' "$js" +# sed -i '/network.proxy.socks/d' "$js" +# sed -i '/network.proxy.socks_port/d' "$js" +# sed -i '/network.proxy.socks_remote_dns/d' "$js" +# sed -i '/network.proxy.type/d' "$js" +# fi +# echo "// Preferences for using the GNU Name System" >> "$js" +# echo "user_pref(\"network.proxy.socks\", \"localhost\");" >> "$js" +# echo "user_pref(\"network.proxy.socks_port\", $port);" >> "$js" +# echo "user_pref(\"network.proxy.socks_remote_dns\", true);" >> "$js" +# echo "user_pref(\"network.proxy.type\", 1);" >> "$js" +# done +# +# # Chromium +# profile="$HOME/.profile" +# if [ -f "$profile" ]; then +# sed -i '/CHROMIUM_USER_FLAGS/d' "$profile" +# fi +# echo "export CHROMIUM_USER_FLAGS=--proxy-server=socks5://localhost:$port" \ +# >> "$profile" +#fi +# +## Create/Renew GNS certificate authority (CA) per user. +#gnunet-gns-proxy-setup-ca +#EOF +# fi # Update files and directories permissions. # Assuming default values, this *should* not be changed. @@ -265,21 +214,6 @@ cat > "${CONFIG_NEW}" < "/etc/systemd/system/gnunet.service" <