Skip to content

Commit ebc52d1

Browse files
committed
Add test for internet availability
1 parent aa87d4b commit ebc52d1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

headless.apkovl.tar.gz

292 Bytes
Binary file not shown.

overlay/etc/local.d/headless.start

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _restore() {
3939
fi
4040
}
4141

42-
##### End of part to be dupplicated into post-cleanup (do not alter!)
42+
##### End of part to be duplicated into post-cleanup (do not alter!)
4343

4444

4545
# 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-
189189

190190
cat <<-EOF >> /tmp/.trash/post-cleanup
191191
192+
_tst_inet() {
193+
## Tested URL redirects to github project page: is.gd shortener provides basic analytics.
194+
## Analytics are public and can be checked at https://is.gd/stats.php?url=apkovl_run
195+
## Privacy policy: https://is.gd/privacy.php
196+
INET="failed"
197+
wget -q -T 10 --spider https://is.gd/apkovl_run > /dev/null 2>&1 &&
198+
INET="success"
199+
logger -st ${0##*/} "Internet access: \$INET"
200+
}
201+
192202
logger -st ${0##*/} "Cleaning-up..."
193203
_restore "/etc/ssh/sshd_config"
194204
_restore "/etc/conf.d/sshd"
@@ -202,6 +212,11 @@ cat <<-EOF >> /tmp/.trash/post-cleanup
202212
rc-update del local default
203213
rm /etc/local.d/headless.start
204214
215+
# Internet connectivity test
216+
# Can be skipped by creating a 'opt-out'-named dummy file aside apkovl file
217+
[ -f "${ovlpath}/opt-out" ] || _tst_inet &
218+
219+
# Run unattended script if available
205220
if [ -f "${ovlpath}/unattended.sh" ]; then
206221
install -m755 "${ovlpath}/unattended.sh" /tmp/unattended.sh
207222
/tmp/unattended.sh >/dev/console 2>&1 &

0 commit comments

Comments
 (0)