Hi, I have a new problem with the rc_hosts file.
The site: http://www.ssmedia.com/utilities/hosts/ ... ?format=pc
doesn't support http1.1 transfer anymore and the http server at ssmedia.com refuse to send the file.
I must add the parameter '-m' to the snarf command to emulate MSIE browser:
This is my snarf command line that works fine for me:
snarf -n -m -T 180 http://www.ssmedia.com/utilities/hosts/ ... ?format=pc /pkg/hosts.ssmedia
I add -T 180 to both lines to avoid problems, this is the 2nd. snarf command:
snarf -n -T 180 http://www.mvps.org/winhelp2002/hosts.txt /pkg/hosts.mvps
With this changes I don't have any problems anymore.
I hope this will help and you can update the package.
regards,
Ricky
working RC_HOSTS entire file:
#!/bin/sh
#
# hosts update version 1.9
. /etc/.language
. /etc/$DLANG.cch
. /etc/colors
[ -d /pkg/lang/hosts-1.9/$DLANG ] && LANG=$DLANG || LANG=english
. /pkg/lang/hosts-1.9/$LANG/rc_hosts
if [ -f /pkg/rc/rc_dns ]
then DNS=/pkg/rc/rc_dns
else DNS=/rc/rc_dns
fi
fn1() {
if [ ! "`fn2`" ]; then
if [ "`fn3`" ]; then
cat $DNS | sed 's:/boot/etc/dns.cfg:/boot/etc/dns.cfg /pkg/etc/hosts.include /pkg/etc/hosts.dnld:' >$DNS.1
else
cat $DNS | sed 's:/etc/dns.cfg:/etc/dns.cfg /pkg/etc/hosts.include /pkg/etc/hosts.dnld:' >$DNS.1
fi
mv $DNS.1 $DNS
chmod +x $DNS
sync
fi
rc_dns $rest 1>/dev/null
}
fn2() {
sed -n '/hosts.dnld/P' $DNS
}
fn3() {
sed -n ':/boot/etc/dns.cfg:P' $DNS
}
fn4() {
if [ -f /pkg/etc/hosts.exclude -a /pkg/etc/hosts.dnld ]; then
for i in `cat /pkg/etc/hosts.exclude | sed 's/#.*//;s/\//\\\//g;s/\./\\\./g;s/\ //g;s/\ //g;/^$/d'`; do
cat /pkg/etc/hosts.dnld | sed "/0\.0\.0\.0\ $i/d" >/pkg/etc/hosts.tmp
mv /pkg/etc/hosts.tmp /pkg/etc/hosts.dnld
done
fi
}
stp() {
echo -n "$AA...$HT"
:> /pkg/etc/hosts
sed 's/\ \/pkg\/etc\/hosts.include\ \/pkg\/etc\/hosts.dnld//' $DNS >$DNS.1
mv $DNS.1 $DNS
chmod +x $DNS
rc_dns restart 1>/dev/null
=
}
upd() {
echo "$AB...$HT"
snarf -n -m -T 180 http://www.ssmedia.com/utilities/hosts/ ... ?format=pc /pkg/hosts.ssmedia
B=$?
snarf -n -T 180 http://www.mvps.org/winhelp2002/hosts.txt /pkg/hosts.mvps
A=`expr $B + $?`
if [ $A -eq 0 ]; then
sed '/localhost/d;/*$/d;/^#/d;s/#.*//;s/127.0.0.1 /0.0.0.0\ /g;s/
//g' /pkg/hosts.mvps >/pkg/etc/hosts.dnld
sed '/localhost/d;/^$/d;/^#/d;/\</d;s/#.*//;s/127.0.0.1 /0.0.0.0\ /g;s/
//g' /pkg/hosts.ssmedia >>/pkg/etc/hosts.dnld
rc_dns $stop 1>/dev/null
rm -f /etc/hosts
[ -f /pkg/etc/hosts ] || :>/pkg/etc/hosts
ln -sf /pkg/etc/hosts /etc/
fn4
fn1
rm -f /pkg/hosts.mvps /pkg/hosts.ssmedia
logger -t "rc_hosts" "$AC"
echo -n "$AD...$HT"
else
echo -n "$AE...$HT"
logger -t "rc_hosts" "$AF"
fi
= $A
}
case "$1" in
$setu) edit /pkg/etc/hosts.exclude
edit /pkg/etc/hosts.include
crontab -e;;
$stop) stp;;
$update) upd;;
$exclude|$activate) echo -n "$AG...$HT"
fn4
fn1
=;;
$star|$rest)
echo -n "$AH...$HT"
fn1
=
;;
$stat)
if [ "`fn2`" ]
then echo "$AI"
else echo "$AJ"
fi;;
esac