Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions bin/ncp-diag
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,15 @@ echo "port check 80|$( is_port_open 80 )"
echo "port check 443|$( is_port_open 443 )"

# LAN
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )
GW=$( ip r | grep "default via" | awk '{ print $3 }' | head -1 )
if [ ! -e /usr/sbin/unchroot ]; then
## Standard Install
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )
GW=$( ip r | grep "default via" | awk '{ print $3 }' | head -1 )
else
## Android Container
IFACE=$( ip r | awk '{ print $3 }' | head -1 )
GW=$( ip r get 9.9.9.9 | grep "via" | awk '{ print $3 }' | head -1 )
fi
IP="$(get_ip)"

echo "IP|$IP"
Expand Down
12 changes: 9 additions & 3 deletions etc/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,15 @@ function nc_version()

function get_ip()
{
local iface
iface="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
ip a show dev "$iface" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1
if [ ! -e /usr/sbin/unchroot ]; then
## Standard Install
local iface
iface="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
ip a show dev "$iface" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1
else
## Android Container
(ip -o route get to 9.9.9.9 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')
fi
}

function is_an_ip()
Expand Down
3 changes: 3 additions & 0 deletions lamp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ install()

mkdir -p /run/php

## Android container needs to explicitly set this Apache default
[ -e /usr/sbin/unchroot ] && sed -i 's/#Mutex file:${APACHE_LOCK_DIR} default/Mutex file:${APACHE_LOCK_DIR} default/g' /etc/apache2/apache2.conf

# mariaDB password
local DBPASSWD="default"
echo -e "[client]\npassword=$DBPASSWD" > /root/.my.cnf
Expand Down