mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +00:00
Once again pi-hole had a more robust stty setup so lets borrow that :)
This commit is contained in:
parent
7c64afdc92
commit
67722ca7f4
2 changed files with 15 additions and 8 deletions
|
@ -17,14 +17,17 @@ pivpnGitUrl="https://github.com/pivpn/pivpn.git"
|
||||||
pivpnFilesDir="/etc/.pivpn"
|
pivpnFilesDir="/etc/.pivpn"
|
||||||
|
|
||||||
|
|
||||||
# Find the rows and columns
|
# Find the rows and columns. Will default to 80x24 if it can not be detected.
|
||||||
rows=$(stty size | awk '{print $1}')
|
screen_size=$(stty size 2>/dev/null || echo 24 80)
|
||||||
columns=$(stty size | awk '{print $2}')
|
rows=$(echo $screen_size | awk '{print $1}')
|
||||||
|
columns=$(echo $screen_size | awk '{print $2}')
|
||||||
|
|
||||||
# Divide by two so the dialogs take up half of the screen, which looks nice.
|
# Divide by two so the dialogs take up half of the screen, which looks nice.
|
||||||
r=$(( rows / 2 ))
|
r=$(( rows / 2 ))
|
||||||
c=$(( columns / 2 ))
|
c=$(( columns / 2 ))
|
||||||
|
# Unless the screen is tiny
|
||||||
|
r=$(( r < 20 ? 20 : r ))
|
||||||
|
c=$(( c < 70 ? 70 : c ))
|
||||||
|
|
||||||
# Find IP used to route to outside world
|
# Find IP used to route to outside world
|
||||||
|
|
||||||
|
@ -32,7 +35,7 @@ IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1
|
||||||
IPv4addr=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
|
IPv4addr=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
|
||||||
IPv4gw=$(ip route get 8.8.8.8 | awk '{print $3}')
|
IPv4gw=$(ip route get 8.8.8.8 | awk '{print $3}')
|
||||||
|
|
||||||
availableInterfaces=$(ip -o link | awk '{print $2}' | grep -v "lo" | cut -d':' -f1)
|
availableInterfaces=$(ip -o link | awk '{print $2}' | grep -v "lo" | cut -d':' -f1 | cut -d'@' -f1)
|
||||||
dhcpcdFile=/etc/dhcpcd.conf
|
dhcpcdFile=/etc/dhcpcd.conf
|
||||||
|
|
||||||
######## FIRST CHECK ########
|
######## FIRST CHECK ########
|
||||||
|
|
|
@ -22,13 +22,17 @@ NO_UFW=$(cat /etc/pivpn/NO_UFW)
|
||||||
PORT=$(cat /etc/pivpn/INSTALL_PORT)
|
PORT=$(cat /etc/pivpn/INSTALL_PORT)
|
||||||
PROTO=$(cat /etc/pivpn/INSTALL_PROTO)
|
PROTO=$(cat /etc/pivpn/INSTALL_PROTO)
|
||||||
|
|
||||||
# Find the rows and columns
|
# Find the rows and columns. Will default to 80x24 if it can not be detected.
|
||||||
rows=$(stty size | awk '{print $1}')
|
screen_size=$(stty size 2>/dev/null || echo 24 80)
|
||||||
columns=$(stty size | awk '{print $2}')
|
rows=$(echo $screen_size | awk '{print $1}')
|
||||||
|
columns=$(echo $screen_size | awk '{print $2}')
|
||||||
|
|
||||||
# Divide by two so the dialogs take up half of the screen, which looks nice.
|
# Divide by two so the dialogs take up half of the screen, which looks nice.
|
||||||
r=$(( rows / 2 ))
|
r=$(( rows / 2 ))
|
||||||
c=$(( columns / 2 ))
|
c=$(( columns / 2 ))
|
||||||
|
# Unless the screen is tiny
|
||||||
|
r=$(( r < 20 ? 20 : r ))
|
||||||
|
c=$(( c < 70 ? 70 : c ))
|
||||||
|
|
||||||
spinner()
|
spinner()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue