Hi Jacco.

May I suggest adding this attached little DHCP helper script to RSEL6 (and maybe RSEL7 if dhclient is the same).

This script print the DHCP address while booting.
Very useful when installing a new Raspberry with no attached keyboard :)
I made it myself - dunno if a similar script exists in any distribution ?

BR,
Bjarne

#!/bin/bash
#
# whatsmyip.sh: dhclient-script plugin for printing dhcp ip lease,
#         place in /etc/dhcp/dhclient.d and 'chmod +x whatsmyip.sh' to enable
#
# Copyright (C) 2015 Redsleeve Community
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Author: Bjarne Saltbaek <[email protected]>
#

whatsmyip_config() {
  OS=`uname`
  IO="" # store IP
  case $OS in
    Linux)           IP=`ifconfig    | grep 'inet addr:'    | grep -v 
'127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;;
    FreeBSD|OpenBSD) IP=`ifconfig    | grep -E 'inet.[0-9]' | grep -v 
'127.0.0.1' |               awk '{ print $2}'` ;;
    SunOS)           IP=`ifconfig -a | grep inet            | grep -v 
'127.0.0.1' |               awk '{ print $2} '` ;;
    *)               IP="Unknown";;
  esac
  echo " $IP"
}

whatsmyip_restore() {
  DUMMY=""
}
_______________________________________________
users mailing list
[email protected]
https://lists.redsleeve.org/mailman/listinfo/users

Reply via email to