Add test for internet availability

This commit is contained in:
macmpi 2023-09-18 19:24:49 +02:00
parent aa87d4b540
commit ebc52d13a8
2 changed files with 16 additions and 1 deletions

Binary file not shown.

View File

@ -39,7 +39,7 @@ _restore() {
fi fi
} }
##### End of part to be dupplicated into post-cleanup (do not alter!) ##### End of part to be duplicated into post-cleanup (do not alter!)
# Redirect stdout and errors to console as rc.local does not log anything # Redirect stdout and errors to console as rc.local does not log anything
@ -189,6 +189,16 @@ sed -n '/^#* End .*alter!)$/q;p' /etc/local.d/headless.start > /tmp/.trash/post-
cat <<-EOF >> /tmp/.trash/post-cleanup cat <<-EOF >> /tmp/.trash/post-cleanup
_tst_inet() {
## Tested URL redirects to github project page: is.gd shortener provides basic analytics.
## Analytics are public and can be checked at https://is.gd/stats.php?url=apkovl_run
## Privacy policy: https://is.gd/privacy.php
INET="failed"
wget -q -T 10 --spider https://is.gd/apkovl_run > /dev/null 2>&1 &&
INET="success"
logger -st ${0##*/} "Internet access: \$INET"
}
logger -st ${0##*/} "Cleaning-up..." logger -st ${0##*/} "Cleaning-up..."
_restore "/etc/ssh/sshd_config" _restore "/etc/ssh/sshd_config"
_restore "/etc/conf.d/sshd" _restore "/etc/conf.d/sshd"
@ -202,6 +212,11 @@ cat <<-EOF >> /tmp/.trash/post-cleanup
rc-update del local default rc-update del local default
rm /etc/local.d/headless.start rm /etc/local.d/headless.start
# Internet connectivity test
# Can be skipped by creating a 'opt-out'-named dummy file aside apkovl file
[ -f "${ovlpath}/opt-out" ] || _tst_inet &
# Run unattended script if available
if [ -f "${ovlpath}/unattended.sh" ]; then if [ -f "${ovlpath}/unattended.sh" ]; then
install -m755 "${ovlpath}/unattended.sh" /tmp/unattended.sh install -m755 "${ovlpath}/unattended.sh" /tmp/unattended.sh
/tmp/unattended.sh >/dev/console 2>&1 & /tmp/unattended.sh >/dev/console 2>&1 &