File: 80at-home

package info (click to toggle)
whereami 0.3.36
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 424 kB
  • sloc: sh: 1,094; perl: 524; makefile: 24
file content (26 lines) | stat: -rwxr-xr-x 875 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
#
# This script identifies that I am at home.  I haven't got around to having dhcp at
# home so I have to ifconfig and then ping to see if there's something at the other
# end.
#
# For future development the code section below should really be separated as a
# script in the ./scripts directory which will test a particular IP and return
# a true/false answer.  In that case we could do many of these sort of checks
# easily.  Also it would be nice to 'C' code this in some way to try and improve
# the speed with which we can see if a particular IP is valid.
#

TESTIP=192.168.55.10
MYIP=20

if ( /usr/share/whereami/findnet $TESTIP $MYIP); then

  LOCATION=home

  # We only put the location out if we find that we are here, which is different
  # from the docked / undocked case where we always say one or the other.
  echo $LOCATION >>iwillbe
  LOCATED=1
fi