diff --git a/bin/ncp-diag b/bin/ncp-diag index bed4cfe43..a34c8097e 100644 --- a/bin/ncp-diag +++ b/bin/ncp-diag @@ -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" diff --git a/etc/library.sh b/etc/library.sh index b0ee48986..8c678d851 100644 --- a/etc/library.sh +++ b/etc/library.sh @@ -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() diff --git a/lamp.sh b/lamp.sh index d62c49965..a884f12e2 100644 --- a/lamp.sh +++ b/lamp.sh @@ -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