From 5f382288604958b634002c79d5b06901b4fa47af Mon Sep 17 00:00:00 2001 From: cimryan Date: Thu, 18 Oct 2018 09:07:13 -0700 Subject: [PATCH] Get the IP address of the archive server by parsing ping output instead of using getent This seems to work for more network configurations. --- windows_archive/setup-teslausb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows_archive/setup-teslausb b/windows_archive/setup-teslausb index 045360c..55524c6 100644 --- a/windows_archive/setup-teslausb +++ b/windows_archive/setup-teslausb @@ -109,7 +109,7 @@ function create_usb_drive_backing_files () { function configure_archive () { echo "Configuring the archive..." mkdir /mnt/archive - local archive_server_ip_address="$(getent hosts $archiveserver | cut -d' ' -f1)" + local archive_server_ip_address="$(ping -c 1 -w 1 $archiveserver 2>/dev/null | head -n 1 | grep -o -e "(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d '()')" echo "//$archive_server_ip_address/$sharename /mnt/archive cifs vers=3,credentials=/root/.teslaCamArchiveCredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0" >> /etc/fstab echo "username=$shareuser" > /root/.teslaCamArchiveCredentials