Commit a638febb authored by Bernhard Landauer's avatar Bernhard Landauer
Browse files

use nw_check.py

parent 17f43a34
......@@ -6,9 +6,10 @@ DATADIR = /share/manjaro-architect
BIN = \
bin/btrfs-subvol-functions \
bin/check-translate.in \
bin/check-translate \
bin/ma-launcher \
bin/manjaro-architect
bin/manjaro-architect \
bin/nw_check
LIBS = \
lib/ini_val.sh \
......
#!/usr/bin/env python3
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon, and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
"""connectivity check, kindly contributed by @fhdk"""
import sys
from urllib.request import urlopen
remote_host = "https://manjaro.org"
maxwait = 2
data = None
try:
data = urlopen(remote_host, timeout=maxwait)
except:
pass
if data:
sys.exit(0)
else:
sys.exit(1)
......@@ -12,7 +12,7 @@
[[ -e /run/miso/bootmnt ]] && setfont ter-116n
while [[ ! $(ping -c 2 manjaro.org) ]]; do
while ! nw_check; do
if [[ $(cat /proc/1/comm) == "systemd" ]];then
if [[ $(systemctl is-active NetworkManager) == "active" ]]; then
dialog --backtitle ":: Manjaro Architect ::" --yesno "\nPlease connect to the internet:\n" 0 0 && \
......
......@@ -341,7 +341,7 @@ set_keymap() {
}
mk_connection() {
if [[ ! $(ping -c 2 google.com) ]]; then
if ! nw_check; then
DIALOG " $_NoCon " --yesno "\n$_EstCon\n " 0 0 && $NW_CMD && return 0 || clear && exit 0
fi
}
......@@ -358,7 +358,7 @@ check_requirements() {
exit 1
fi
if [[ ! $(ping -c 1 google.com) ]]; then
if ! nw_check; then
DIALOG " $_ErrTitle " --infobox "\n$_ConFailBody\n " 0 0
sleep 2
exit 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment