Code: Select all
root@porteus:~# fastest-mirror
Checking fastest mirror ...
Results:
Would you like to add as your main Porteus server? [y/n]
At times my internet connection stays on, but everything https:// or Email-wise SMTP or SSL IMAP will not work. The only page https:// that will work is the confirmation page for that very WLAN.
Looking into the code of fastest-mirror I realized that it is a version I tweaked back in V2020-12-13 (I totally forgot about that. I blame the weirdness that was the lockdown-covid-madness back then up to mid/late 2021. )
Now I updated it to remove the possible error when someone else is on an open WLAN and stumbles upon the same wonkyness.
fastest-mirrorV2022-10-03:
Code: Select all
#!/bin/bash
# mirror_test.sh
# This script tests a list of porteus mirrors for speed
#
# AUTHOR: Lance Rushing <lance_rushing@hotmail.com>
# Modified for Porteus by brokenman <brokenman@porteus.org> , updated by Rava - V2020-12-13
# Modified by Rava V2022-10-03 - added some sanity checks for funky networks
# This script is covered under the GNU Public License: http://www.gnu.org/licenses/gpl.txt
. /usr/share/porteus/porteus-functions
get_colors
## Vars
DUMP=/tmp/.fmr.tmp
## Trap ctrl C exits
cutandrun(){
[ -e $DUMP ] && rm $DUMP
exit
}
trap cutandrun SIGHUP SIGINT SIGTERM
is_online_url http://porteus.org/porteus-mirrors.txt || { red "The porteus server appears to be offline."; exit; }
## get list
MIRRORS=$(curl -s http://porteus.org/porteus-mirrors.txt)
## Number of seconds before the test is considered a failure
TIMEOUT="4"
## Sting to store results in
RESULTS=""
echo "Checking fastest mirror ..."
for MIRROR in $MIRRORS ; do
echo -n "Testing ${MIRROR} "
URL="${MIRROR}%{FILE}"
TIME=`curl --max-time $TIMEOUT --silent --output /dev/null --write-out %{time_total} $URL`
if [ "$TIME" == "0.000" ] ; then
red "Fail";
else
if [ "$TIME"x == "x" ] ; then
red "Fail";
else
echo $TIME
RESULTS="${RESULTS}${TIME}\t${MIRROR}\n";
fi
fi
done;
echo -e "\nResults:"
echo -e $RESULTS | sort -n | tee $DUMP
FMIR=`sed '/^$/d' $DUMP | head -n1 | awk '{print$2}'`
echo
if [ "$FMIR"x == "x" ] ; then
red "Something went wrong. Check your network and try again."
else
read -p "`gettext " Would you like to add $FMIR as your main Porteus server? [y/n]"`" -n 1 -r -s && echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
sed -i 's@^SERVER=.*@SERVER='$FMIR'@g' /etc/porteus.conf
if [ $? -eq 0 ] ; then
green "Porteus server updated in /etc/porteus.conf"
else
red "Couldn't update Porteus server in /etc/porteus.conf"
fi
fi
fi
cutandrun
Code: Select all
root@porteus:~# fastest-mirror
Checking fastest mirror ...
Results:
Something went wrong. Check your network and try again.