~alpine/devel

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

[alpine-devel] [PATCH] testing/dnscrypt-proxy: small bugfix setup-dnscrypt

Details
Message ID
<1411008802-2053-1-git-send-email-developer@it-offshore.co.uk>
Sender timestamp
1411008802
DKIM signature
missing
Download raw message
Patch: +52 -19
Minor change to /sbin/setup-dnscrypt to account for new github tags
---
 testing/dnscrypt-proxy/APKBUILD             |  2 +-
 testing/dnscrypt-proxy/dnscrypt-proxy.setup | 69 +++++++++++++++++++++--------
 2 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/testing/dnscrypt-proxy/APKBUILD b/testing/dnscrypt-proxy/APKBUILD
index 4ae7f41..eb362aa 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=4
pkgrel=5
pkgdesc="A tool for securing communications between a client and a DNS resolver"
url="http://dnscrypt.org/"
arch="all"
diff --git a/testing/dnscrypt-proxy/dnscrypt-proxy.setup b/testing/dnscrypt-proxy/dnscrypt-proxy.setup
index 92aafe1..eea49fa 100644
--- a/testing/dnscrypt-proxy/dnscrypt-proxy.setup
+++ b/testing/dnscrypt-proxy/dnscrypt-proxy.setup
@@ -215,38 +215,69 @@ fi

##### Download DNS Resolver details ################################################################

url='https://raw.githubusercontent.com/jedisct1/dnscrypt-proxy/master/dnscrypt-resolvers.csv'
starttag='<thead>'
endtag='<\/table>'
url='https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv'
output='/tmp/dnscrypt.list'
IFS="|"

echo -e "Retrieving current list of free DNS Resolvers\n"
wget -q --no-check-certificate $url -O $output
curl -k --compressed -o $output -s $url; sed -i -n "/$starttag/,/$endtag/p" $output

totalservers=$(cat $output | tail +2 | wc -l)
# remove leading & trailing whitespace
sed -i 's/^[ \t]*//;s/[ \t]*$//' $output

deletetags='<thead>|<tr id=|<td 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
#remove stray <td> under MUSL C
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
# fix <td> on MUSL


totalservers=$(awk 'END{print NR}' $output)

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

#clear
clear

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

colourheading=$(awk 'BEGIN { format = "%-8s%-40s%-18s%-10s%-10s%-10s%-25s\n"
colourheading=$(awk 'BEGIN { format = "%-3s%-40s%-18s%-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"
colourline=$(awk 'BEGIN { format = "%-3s%-40s%-18s%-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

awk -F"\," 'BEGIN {format="%-8s%-40s%-18s%-10s%-10s%-10s%-25s\n"}{ printf format, "\["NR"\]",$1,$4,$8,$9,$10,$11}' $tmpfile
awk 'BEGIN { format = "%-3s%-40s%-18s%-10s%-10s%-10s%-25s\n" }
        { printf format,$1,$3,$5,$9,$10,$11,$12 }' FS=\| $output

print_green "$colourline"
print_question "Please choose a DNS Resolver for dnscrypt-proxy to query:" "[1 - $totalservers]"
@@ -258,12 +289,9 @@ 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
@@ -273,9 +301,9 @@ fi

done

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}')
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 }')

######## END Changes ###########################################################################

@@ -359,3 +387,8 @@ fi
restart_services

exit 0





-- 
2.1.0



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Details
Message ID
<541A7474.50607@it-offshore.co.uk>
In-Reply-To
<edb82f33897a4477fc30761e80b8aa5c@bsod.eu> (view parent)
Sender timestamp
1411019892
DKIM signature
missing
Download raw message
Hi Francesco,

Sorry I didn't realise (I'm still running uclibc) - ignore this patch.

I think dnscrypt needs to be rebuilt against the current version of
libsodium - trying to install dnscrypt in musl complains of
"libsodium.so.4 missing".

Stuart.



On 09/18/2014 06:13 AM, Francesco wrote:
> Il 2014-09-18 05:53 Stuart Cardall ha scritto:
>
>> -url='https://raw.githubusercontent.com/jedisct1/dnscrypt-proxy/master/dnscrypt-resolvers.csv'
>>
>> +starttag='<thead>'
>> +endtag='<\/table>'
>> +url='https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv'
>>
>>  output='/tmp/dnscrypt.list'
>> +IFS="|"
>
> Hi Stuart.
> Why do you want still want to parse the html when you can have a clean
> CSV file?
> Basically you are reverting what I did in:
> http://git.alpinelinux.org/cgit/aports/commit/?id=7a7d2ea42d92ed9cc0bafd1ddcc00153a9ed6954
>
> What kind of problems have you encountered in running that setup?
>
> Thanks!
>
Details
Message ID
<edb82f33897a4477fc30761e80b8aa5c@bsod.eu>
In-Reply-To
<1411008802-2053-1-git-send-email-developer@it-offshore.co.uk> (view parent)
Sender timestamp
1411017199
DKIM signature
missing
Download raw message
Il 2014-09-18 05:53 Stuart Cardall ha scritto:

> -url='https://raw.githubusercontent.com/jedisct1/dnscrypt-proxy/master/dnscrypt-resolvers.csv'
> +starttag='<thead>'
> +endtag='<\/table>'
> +url='https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv'
>  output='/tmp/dnscrypt.list'
> +IFS="|"

Hi Stuart.
Why do you want still want to parse the html when you can have a clean 
CSV file?
Basically you are reverting what I did in: 
http://git.alpinelinux.org/cgit/aports/commit/?id=7a7d2ea42d92ed9cc0bafd1ddcc00153a9ed6954

What kind of problems have you encountered in running that setup?

Thanks!

-- 
:: Francesco ::
Twit.....http://twitter.com/fcolista
Jabber...francesco@jabber.org
E-Mail...francesco@bsod.eu
AboutMe..http://about.me/fcolista



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Details
Message ID
<2810b89114d20c7b5e4cf34b1be7e89f@bsod.eu>
In-Reply-To
<541A7474.50607@it-offshore.co.uk> (view parent)
Sender timestamp
1411020781
DKIM signature
missing
Download raw message
Il 2014-09-18 08:58 IT Developer ha scritto:
> Hi Francesco,
> 
>  Sorry I didn't realise (I'm still running uclibc) - ignore this
> patch.
> 
>  I think dnscrypt needs to be rebuilt against the current version of
> libsodium - trying to install dnscrypt in musl complains of
> "libsodium.so.4 missing".

Actually, the missing library is not related to the patch.
Let me know if you need help.

-- 
:: Francesco ::
Twit.....http://twitter.com/fcolista
Jabber...francesco@jabber.org
E-Mail...francesco@bsod.eu
AboutMe..http://about.me/fcolista



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