aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2014-06-30 09:06:45 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2014-06-30 09:06:51 +0000
commit7a7d2ea42d92ed9cc0bafd1ddcc00153a9ed6954 (patch)
tree1a69076f2b418c4d9dbf7812c319831f4ed68706 /testing
parent924ee3e40ec7e80bb641ad99ac275ae00ee16b11 (diff)
downloadaports-7a7d2ea42d92ed9cc0bafd1ddcc00153a9ed6954.tar.bz2
aports-7a7d2ea42d92ed9cc0bafd1ddcc00153a9ed6954.tar.xz
testing/dnscrypt-proxy: review of setup script. Substituded html with csv, minor improvements.
Diffstat (limited to 'testing')
-rw-r--r--testing/dnscrypt-proxy/APKBUILD4
-rw-r--r--testing/dnscrypt-proxy/dnscrypt-proxy.post-install14
-rw-r--r--testing/dnscrypt-proxy/dnscrypt-proxy.setup65
3 files changed, 20 insertions, 63 deletions
diff --git a/testing/dnscrypt-proxy/APKBUILD b/testing/dnscrypt-proxy/APKBUILD
index 8dae2b2d4f..95503450dc 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.4.0
-pkgrel=1
+pkgrel=2
pkgdesc="A tool for securing communications between a client and a DNS resolver"
url="http://dnscrypt.org/"
arch="all"
@@ -10,7 +10,7 @@ license="custom"
depends="libsodium"
depends_dev="libtool automake autoconf libsodium-dev"
makedepends="$depends_dev"
-install="$pkgname.post-install $pkgname.pre-install"
+install="$pkgname.pre-install"
pkgusers=dnscrypt
pkggroups=dnscrypt
subpackages="$pkgname-doc $pkgname-setup"
diff --git a/testing/dnscrypt-proxy/dnscrypt-proxy.post-install b/testing/dnscrypt-proxy/dnscrypt-proxy.post-install
deleted file mode 100644
index 7e305644ed..0000000000
--- a/testing/dnscrypt-proxy/dnscrypt-proxy.post-install
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-NORMAL="\033[1;0m"
-STRONG="\033[1;1m"
-GREEN="\033[1;32m"
-
-print_strong() {
- local prompt="${STRONG}$1 ${GREEN}$2${NORMAL}"
- printf "${prompt} %s\n"
-}
-
-print_strong "\nTo configure alternative DNS Resolvers & DNS caching please run:" "\n\n/sbin/setup-dnscrypt\n"
-exit 0
-
diff --git a/testing/dnscrypt-proxy/dnscrypt-proxy.setup b/testing/dnscrypt-proxy/dnscrypt-proxy.setup
index f82e7c39ee..92aafe1919 100644
--- a/testing/dnscrypt-proxy/dnscrypt-proxy.setup
+++ b/testing/dnscrypt-proxy/dnscrypt-proxy.setup
@@ -215,65 +215,38 @@ fi
##### Download DNS Resolver details ################################################################
-starttag='<thead>'
-endtag='<\/table>'
-url='https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv'
+url='https://raw.githubusercontent.com/jedisct1/dnscrypt-proxy/master/dnscrypt-resolvers.csv'
output='/tmp/dnscrypt.list'
-IFS="|"
echo -e "Retrieving current list of free DNS Resolvers\n"
-curl -k --compressed -o $output -s $url; sed -i -n "/$starttag/,/$endtag/p" $output
+wget -q --no-check-certificate $url -O $output
-# remove leading & trailing whitespace
-sed -i 's/^[ \t]*//;s/[ \t]*$//' $output
-
-deletetags='<thead>|<tr id=|<td class=|<span id=|<tbody>|<th>|<\/tr>|<\/thead>|<\/tbody>|<\/table>'
-# remove rows without data (& the headers in <th>)
-for tags in $deletetags
-do
- sed -i '/'$tags'/d' $output
-done
-
-#remove stray </td>
-sed -i "s/^<\/td>//g" $output
-# delete empty lines
-sed -i '/^$/d' $output
-# change rows to columns
-awk 'ORS=NR%14?" ":"\n"' $output > $output.table
-# replace closing tags with pipe
-sed -i 's/<\/td>/|/g' $output.table
-sed -i 's/<\/th>/|/g' $output.table
-# remove remaining html tags
-sed -i 's/<[^>]\+>//g' $output.table
-# number rows
-awk '{ print FNR "|" $0 }' $output.table > $output; rm $output.table
-# tidy up after AWK
-sed -i "s/&#39;/'/g" $output
-# remove whitespace after pipe
-sed -i 's/| */|/g' $output
-
-totalservers=$(awk 'END{print NR}' $output)
+totalservers=$(cat $output | tail +2 | wc -l)
if [ $totalservers = 0 ]; then
die "Could not contact $url"
fi
-clear
+#clear
# colour table ##################################################################################
-colourheading=$(awk 'BEGIN { format = "%-3s%-40s%-18s%-10s%-10s%-10s%-25s\n"
+colourheading=$(awk 'BEGIN { format = "%-8s%-40s%-18s%-10s%-10s%-10s%-25s\n"
printf format, "#", "Name", "Location", "DNSSEC", "No Logs", "Namecoin", "Resolver Address" }')
-colourline=$(awk 'BEGIN { format = "%-3s%-40s%-18s%-10s%-10s%-10s%-25s\n"
+colourline=$(awk 'BEGIN { format = "%-8s%-40s%-18s%-10s%-10s%-10s%-25s\n"
printf format, "---", "----------------------------------------", "------------------", "----------",\
"----------", "----------", "------------------------------------------" }')
print_green "$colourheading"
print_green "$colourline"
-awk 'BEGIN { format = "%-3s%-40s%-18s%-10s%-10s%-10s%-25s\n" }
- { printf format,$1,$3,$5,$9,$10,$11,$12 }' FS=\| $output
+sed -i -e "s/..$//g" $output
+tmpfile=$(mktemp)
+
+cat $output | awk 'BEGIN{FS=""}{gsub(/,\ /,"\ "); print}'|tail +2 > $tmpfile
+
+awk -F"\," 'BEGIN {format="%-8s%-40s%-18s%-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]"
@@ -285,9 +258,12 @@ do
read DNS
+echo "DNS: $DNS"
# Sanitize input to an integer
export DNS_CLEAN="`echo "${DNS}" | tr -cd '[:[0-9]:]'`"
+echo "DNS_CLEAN: $DNS_CLEAN"
+
if [ $DNS_CLEAN -gt 0 2>/dev/null ] && [ $DNS_CLEAN -le $totalservers 2>/dev/null ]; then
break
else
@@ -297,9 +273,9 @@ fi
done
-RESOLVER=$(sed -n "$DNS_CLEAN"p $output | awk -F'|' '{ print $12 }')
-PROVIDER=$(sed -n "$DNS_CLEAN"p $output | awk -F'|' '{ print $13 }')
-PUBKEY=$(sed -n "$DNS_CLEAN"p $output | awk -F'|' '{ print $14 }')
+RESOLVER=$(cat $tmpfile | tr -d "\"" | tr "," ";" | sed -n "$DNS_CLEAN"p |awk -F';' '{print $11}')
+PROVIDER=$(cat $tmpfile | tr -d "\"" | tr "," ";" | sed -n "$DNS_CLEAN"p |awk -F';' '{print $12}')
+PUBKEY=$(cat $tmpfile | tr -d "\"" | tr "," ";" | sed -n "$DNS_CLEAN"p |awk -F';' '{print $13}')
######## END Changes ###########################################################################
@@ -383,8 +359,3 @@ fi
restart_services
exit 0
-
-
-
-
-