#!/bin/bash
#
# This script identifies if my laptop is in its docking base by checking the output
# of lspci for 'CMD' which is the manufacturer of the IDE interface in the docking station.
# For a less easily identifiable difference a diff between a saved 'lspci' and the current
# 'lspci' should also work fine.
#

# unless evidence to the contrary, we will assume 'undocked'
LOCATION=undocked

if ( lspci | grep CMD >/dev/null ) then
  LOCATION=docked
fi

# The last location written to the 'iwillbe' file will be the controlling one.
# This wouldn't usually be 'docked' - we would normally grep the 'iam' file
# would be used (which is what the 'iwillbe' file is renamed to when whereami
# builds and runs its script).
echo $LOCATION >>iwillbe
