Skip to content

Commit

Permalink
#57 add a script to get the IP address
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyweston committed Apr 20, 2018
1 parent fc0fd86 commit a74b719
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ mappings in Universal := (mappings in Universal).value.
mappings in Universal ++= (proguard in Proguard).value.map(jar => jar -> ("lib/" + jar.getName))

// point the classpath to the output from the proguard task
scriptClasspath := (proguard in Proguard).value.map(jar => jar.getName)
scriptClasspath := (proguard in Proguard).value.map(jar => jar.getName)

bashScriptExtraDefines ++= IO.readLines(sourceDirectory.value / "universal" / "conf" / "find_ip.sh")
11 changes: 11 additions & 0 deletions src/universal/conf/find_ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Pi specific function to try and find the externally facing IP address
getIpAddress() {
local eth0=`grep "eth0" /proc/net/dev`
if [ -n "eth0" ] ; then
local lan="eth0"
else
local lan="wlan0"
fi
echo $( ip -f inet addr show ${lan} | grep -Po 'inet \K[\d.]+' )
}

0 comments on commit a74b719

Please sign in to comment.