Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Anarchy Installer
installer
Commits
233bd6e7
Verified
Commit
233bd6e7
authored
Nov 11, 2020
by
Erazem Kokot
Browse files
Update library function for connecting to wifi
parent
45069081
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
21 deletions
+10
-21
src/usr/bin/anarchy
src/usr/bin/anarchy
+2
-4
src/usr/bin/anarchy-update
src/usr/bin/anarchy-update
+1
-3
src/usr/bin/libanarchy.sh
src/usr/bin/libanarchy.sh
+5
-8
src/usr/lib/anarchy/setup-connection
src/usr/lib/anarchy/setup-connection
+1
-1
src/usr/lib/anarchy/setup-mirrors
src/usr/lib/anarchy/setup-mirrors
+1
-5
No files found.
src/usr/bin/anarchy
View file @
233bd6e7
...
...
@@ -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
...
...
src/usr/bin/anarchy-update
View file @
233bd6e7
...
...
@@ -4,9 +4,7 @@
.
libanarchy.sh
.
/etc/anarchy.conf
if
!
is_online
;
then
wifi-menu
-o
fi
check_connection
tmp_dir
=
"
$(
mktemp
-d
)
"
...
...
src/usr/bin/libanarchy.sh
View file @
233bd6e7
...
...
@@ -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
}
...
...
src/usr/lib/anarchy/setup-connection
View file @
233bd6e7
#!/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/$.*//'
)
"
...
...
src/usr/lib/anarchy/setup-mirrors
View file @
233bd6e7
#!/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
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment