~alpine/aports

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[alpine-aports] [PATCH] testing/dnscrypt-proxy: fix /sbin/setup-dnscrypt

Details
Message ID
<1453432376-12433-1-git-send-email-developer@it-offshore.co.uk>
Sender timestamp
1453432376
DKIM signature
missing
Download raw message
Patch: +35 -39
small fix for tail in coreutils + clean some whitespace.
---
 testing/dnscrypt-proxy/APKBUILD             |  8 ++--
 testing/dnscrypt-proxy/dnscrypt-proxy.setup | 66 ++++++++++++++---------------
 2 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/testing/dnscrypt-proxy/APKBUILD b/testing/dnscrypt-proxy/APKBUILD
index 923a49b..aae5955 100644
--- a/testing/dnscrypt-proxy/APKBUILD
+++ b/testing/dnscrypt-proxy/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Francesco Colista <francesco.colista@gmail.com>
pkgname=dnscrypt-proxy
pkgver=1.6.0
pkgrel=2
pkgrel=3
pkgdesc="A tool for securing communications between a client and a DNS resolver"
url="http://dnscrypt.org/"
arch="all"
@@ -58,12 +58,12 @@ setup() {
md5sums="fa1dad8e487ab587be06e1cbccb9cfcc  dnscrypt-proxy-1.6.0.tar.bz2
6ca1f01a62ca9e937851986560709a61  dnscrypt-proxy.initd
77b800da6d8cdf6316afacbff740b09a  dnscrypt-proxy.confd
2f6edba8ee4093ee02f6660744e96558  dnscrypt-proxy.setup"
5f29e17b4345d8ac9bdba26a69e3ba9a  dnscrypt-proxy.setup"
sha256sums="e0cce91dc6ab4ed76478579a899b2abb888b1d7ed133cb55294c2f9ce24edc7d  dnscrypt-proxy-1.6.0.tar.bz2
aa2b83b1944ba5f47ee5b7f2cf3cf63fbef4735753a2daf83fea3bf0ea51a7a3  dnscrypt-proxy.initd
36bd49d3fdada3ed8fc6abae7a8dd40a1f7a0aabf0eb1311698030b7ec710699  dnscrypt-proxy.confd
d9db363a07c8284fa0cb38988a19d22240112e8d28208dec609918ab5f495b37  dnscrypt-proxy.setup"
887c0c2d3b3d1a5326e3229ff8180351bc813f7853997e6772123beafc8bd62a  dnscrypt-proxy.setup"
sha512sums="649803b740d16ee1ea20edc13b4f93175d31b94b462c10039c5db9bc789fda181f77643be5a885e5a0cf31c1b74baffd2b2cec9f5fd8b9e17a920cb1ee73ef80  dnscrypt-proxy-1.6.0.tar.bz2
5ad36161fc44d9c8c86a13e20d4d5fa0be81b317097bf1c092aab1e1e307021a8b6f1a92dbf2bec5fb7c534b59cf926235ea507fa6b4ccd2974ac2e3b7baa257  dnscrypt-proxy.initd
8cd2d40c1f465a3b26aa934fe2103650beba9504676faca3ccc9ee2b5bad940e561b3dd201d84c380bfdada72cacbe4862fc1315a4bd44fd7c56ef4f19a884f9  dnscrypt-proxy.confd
0ad9dacf39beebd2364165e45d2f76de39cb7e4b51233ac20eaefb96e6e3c6f3bac192126035f0979b6e2108e01ceb32cf618a3b182d1d5d38b46ecd48453881  dnscrypt-proxy.setup"
904965588e8e1119600413445627dc85a5efc0e32f7f3ad029921f59f214dd5c999bcd98a6622b572e528da4c5265083221fea189ed96407612842033ffcffe1  dnscrypt-proxy.setup"
diff --git a/testing/dnscrypt-proxy/dnscrypt-proxy.setup b/testing/dnscrypt-proxy/dnscrypt-proxy.setup
index 9bb0e72..c1a028c 100644
--- a/testing/dnscrypt-proxy/dnscrypt-proxy.setup
+++ b/testing/dnscrypt-proxy/dnscrypt-proxy.setup
@@ -53,10 +53,10 @@ do
	export RESTART_CLEAN="`echo "${RESTART}" | tr -cd '[:[alnum]:]'`"

	if [ ! $RESTART ] ;then
        	RESTART_CLEAN=eth0
		RESTART_CLEAN=eth0
	fi

 	# tr will strip invalid input to nothing which passes grep
	# tr will strip invalid input to nothing which passes grep
	if [ "$RESTART_CLEAN" != "" ] && echo "$INTERFACES" | grep -e "$RESTART_CLEAN" 1>/dev/null; then
		break
	else
@@ -111,14 +111,14 @@ do
	# Sanitize input to an integer and assign to new variable
	export DNSPORT_CLEAN="`echo "${DNSPORT}" | tr -cd '[:[0-9]:]'`"
        if [ ! $DNSPORT ]; then
             DNSPORT_CLEAN=$defaultport
		DNSPORT_CLEAN=$defaultport
        fi

	if [ $DNSPORT_CLEAN -gt 0 2>/dev/null ] && [ $DNSPORT_CLEAN -le 65535 2>/dev/null ]; then
		print_green "\nPort: $DNSPORT_CLEAN Selected"; break
	else
		#move the cursor & clear the line
        	echo -en "\033[1A\033[39C\033[K"
		echo -en "\033[1A\033[39C\033[K"
	fi
done
}
@@ -220,33 +220,31 @@ output='/tmp/dnscrypt.list'

echo -e "Retrieving current list of free DNS Resolvers\n"
wget -q --no-check-certificate $url -O $output
sed -i 's|\"||g' $output

totalservers=$(cat $output | tail +2 | wc -l)
totalservers=$(cat $output | tail -n +2 | wc -l)

if [ $totalservers = 0 ]; then
	die "Could not contact $url"
fi

#clear

# colour table ##################################################################################

colourheading=$(awk 'BEGIN { format = "%-8s%-40s%-18s%-10s%-10s%-10s%-25s\n"
colourheading=$(awk 'BEGIN { format = "%-8s%-35s%-30s%-10s%-10s%-10s%-25s\n"
	printf format, "#", "Name", "Location", "DNSSEC", "No Logs", "Namecoin", "Resolver Address" }')

colourline=$(awk 'BEGIN { format = "%-8s%-40s%-18s%-10s%-10s%-10s%-25s\n"
	printf format, "---", "----------------------------------------", "------------------", "----------",\
			"----------", "----------", "------------------------------------------" }')
colourline=$(awk 'BEGIN { format = "%-8s%-35s%-30s%-10s%-10s%-10s%-25s\n"
	printf format, "----", "----------------------------------------", "------------------------------", "----------",\
			"----------", "----------", "-----------------------------------" }')

print_green "$colourheading"
print_green "$colourline"

sed -i -e "s/..$//g" $output
tmpfile=$(mktemp)

cat $output | awk 'BEGIN{FS=""}{gsub(/,\ /,"\ "); print}'|tail +2 > $tmpfile
cat $output | awk 'BEGIN{FS=""}{gsub(/,\ /,"\ "); print}' | tail -n +2 > $tmpfile

awk -F"\," 'BEGIN {format="%-8s%-40s%-18s%-10s%-10s%-10s%-25s\n"}{ printf format, "\["NR"\]",$1,$4,$8,$9,$10,$11}' $tmpfile
awk -F"\," 'BEGIN {format="%-8s%-35s%-30s%-10s%-10s%-10s%-25s\n"}{ printf format, "\["NR"\]",$1,$4,$8,$9,$10,$11}' $tmpfile

print_green "$colourline"
print_question "Please choose a DNS Resolver for dnscrypt-proxy to query:" "[1 - $totalservers]"
@@ -255,19 +253,16 @@ print_question "Please choose a DNS Resolver for dnscrypt-proxy to query:" "[1 -

while :
do
	read DNS
	# Sanitize input to an integer
	export DNS_CLEAN="`echo "${DNS}" | tr -cd '[:[0-9]:]'`"

read DNS

# Sanitize input to an integer
export DNS_CLEAN="`echo "${DNS}" | tr -cd '[:[0-9]:]'`"

if [ $DNS_CLEAN -gt 0 2>/dev/null ] && [ $DNS_CLEAN -le $totalservers 2>/dev/null ]; then
	break
else
	#move the cursor & clear the line
	echo -en "\033[1A\033[67C\033[K"
fi

	if [ $DNS_CLEAN -gt 0 2>/dev/null ] && [ $DNS_CLEAN -le $totalservers 2>/dev/null ]; then
		break
	else
		#move the cursor & clear the line
		echo -en "\033[1A\033[67C\033[K"
	fi
done

RESOLVER=$(cat $tmpfile | tr -d "\"" | tr "," ";" | sed -n "$DNS_CLEAN"p |awk -F';' '{print $11}')
@@ -284,7 +279,7 @@ fi

# remove existing Resolver config
if grep "RESOLVER" $config 1> /dev/null; then
   sed -e '/RESOLVER/d' -e '/PROVIDER/d' -e '/PUBKEY/d' $config -i
	sed -e '/RESOLVER/d' -e '/PROVIDER/d' -e '/PUBKEY/d' $config -i
fi

# update Resolver config
@@ -301,13 +296,13 @@ print_green "-------------------------------------------------------------------

# install unbound
if ! which unbound 1> /dev/null; then
   print_question "Install Unbound (Caching DNS Server)" "[ Y / N: Default ]"
   read installsrv
   if [ "$(echo $installsrv | tr '[A-Z]' '[a-z]')" = "y" ]; then
      apk add -q unbound
   else
      echo "nameserver 127.0.0.1" > /etc/resolv.conf
   fi
	print_question "Install Unbound (Caching DNS Server)" "[ Y / N: Default ]"
	read installsrv
	if [ "$(echo $installsrv | tr '[A-Z]' '[a-z]')" = "y" ]; then
	      apk add -q unbound
	else
	      echo "nameserver 127.0.0.1" > /etc/resolv.conf
	fi
fi

# check for / setup secondary loopback for dns caching
@@ -321,7 +316,7 @@ if which unbound 1> /dev/null && ! grep "address 127.0.0.2" /etc/network/interfa
	ifconfig lo:1 $IP up
fi

# modify caching 
# modify caching
if grep "address 127.0.0.2" /etc/network/interfaces 1> /dev/null && [ ! $installsrv ]; then
	print_question "\nRemove DNS Caching (Unbound) / Secondary loopback device ?" "[ Y / N: Default ]"; read removecache
	if [ "$(echo $removecache | tr '[A-Z]' '[a-z]')" = "y" ]; then
@@ -356,3 +351,4 @@ fi
restart_services

exit 0

-- 
2.7.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)