-
Notifications
You must be signed in to change notification settings - Fork 0
/
05_internet-connect.sh
executable file
·45 lines (34 loc) · 1.71 KB
/
05_internet-connect.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /usr/bin/env sh
PROGRESS_PERCENTAGE=5
DIALOG_STEP_TITLE="Internet connection setup"
show_info_box "$DIALOG_STEP_TITLE" $PROGRESS_PERCENTAGE "We will now check for internet connectivity ..."
ping -c 5 -t 10 8.8.8.8 | show_progress_box "$DIALOG_STEP_TITLE" $PROGRESS_PERCENTAGE "Checking internet connection ..."
PROGRESS_PERCENTAGE=$((PROGRESS_PERCENTAGE + 1))
if [[ "$?" != "0" ]]; then
wifi=$(show_selection_menu "$DIALOG_STEP_TITLE" $PROGRESS_PERCENTAGE \
"Do you want to connect via wifi or ethernet?" \
0 ethernet \
1 wifi)
PROGRESS_PERCENTAGE=$((PROGRESS_PERCENTAGE + 1))
if [[ "$wifi" == "1" ]]; then
wifi-menu
else
interfaces=$(ip -o link | awk '{ gsub(":","",$1); gsub(":","",$2); print $2 " " $1 }')
interface=$(show_selection_menu "$DIALOG_STEP_TITLE" $PROGRESS_PERCENTAGE \
"Select network interface" \
$interfaces)
dhcpcd $interface
PROGRESS_PERCENTAGE=$((PROGRESS_PERCENTAGE + 1))
fi
ping -c 5 -t 10 8.8.8.8 | show_progress_box "$DIALOG_STEP_TITLE" $PROGRESS_PERCENTAGE "Checking internet connection again ..."
[[ "$?" == "0" ]] || \
(
show_info_box "$DIALOG_STEP_TITLE" $PROGRESS_PERCENTAGE \
"Could not connect to the internet. Please make sure you can connect to the internet and try to run the install scripts again."
exit 1
)
fi
timedatectl set-ntp true
PROGRESS_PERCENTAGE=9
show_info_box "$DIALOG_STEP_TITLE" $PROGRESS_PERCENTAGE "So we have an internet connection and the system time will be synced by ntp now. Let's move on!"
# vim: set tabstop=2 softtabstop=0 expandtab shiftwidth=2 number: