Verified Commit 233bd6e7 authored by Erazem Kokot's avatar Erazem Kokot
Browse files

Update library function for connecting to wifi

parent 45069081
......@@ -23,9 +23,7 @@ start_menu() {
case "${menu_choice}" in
Update)
if ! is_online; then
wifi-menu -o
fi
check_connection
# Update Arch packages and keyring
log "Updating pacman keys"
......@@ -66,7 +64,7 @@ main() {
start_menu
set_keys
update_mirrors
check_connection
get_connection_info
set_locale
set_zone
prepare_drives
......
......@@ -4,9 +4,7 @@
. libanarchy.sh
. /etc/anarchy.conf
if ! is_online; then
wifi-menu -o
fi
check_connection
tmp_dir="$(mktemp -d)"
......
......@@ -27,14 +27,11 @@ enable_service() {
log "Enabled systemd service: $1"
}
# Check if user has an internet connection
is_online() {
if nc -zw1 1.1.1.1 443; then
# Sucessfully connected
return 0
else
# No internet connection
return 1
# Check if user has an internet connection, if not connect to wifi
check_connection() {
if ! nc -zw1 1.1.1.1 443; then
# No connection, use wifi
wifi-menu -o
fi
}
......
#!/usr/bin/env bash
# Copyright (C) 2017 Dylan Schacht
check_connection() {
get_connection_info() {
op_title="${connection_op_msg}"
(
test_mirror="$(grep </etc/pacman.d/mirrorlist "^Server" | awk 'NR==1{print $3}' | sed 's/$.*//')"
......
#!/usr/bin/env bash
update_mirrors() {
# Connect to wifi if we're not online
if ! is_online; then
log "Not online, connecting using wifi"
wifi-menu -o
fi
check_connection
op_title="${mirror_op_msg}"
......
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