Annotate the background picture with the Hostname, MAC and IP addresses

  1. Get the list of Ethernet interfaces into an array of tuples {name,mac,ip} (Note that the name of the interface is postfixed with a colon ‘:’):

    INTERFACES=($(ip addr | grep -A2 "[1-9]: eth[0-9]:" | awk '{print $2}'))
    IF_NAME=${INTERFACES[0]%?}
    IF_MAC=${INTERFACES[1]}
    IF_IP=${INTERFACES[2]}
  2. Annotate a picture and save the resulting picture to ${HOME}/.annotated_bg.pic:

    SOURCE_PIC=/usr/share/backgrounds/abstract/Waves.png
    convert \
      -pointsize 45 -fill white \
      -gravity SouthWest \
      -annotate +50+50 \
        "$(hostname)\n" \
        "${IF_MAC}\n" \
        "${IF_IP}" \
      ${SOURCE_PIC} ${HOME}/.annotated_bg.pic
  3. Tell Gnome to use the new background picture:

    gconftool-2 --set /desktop/gnome/background/picture_filename --type string "${HOME}/.annotated_bg.pic"
Advertisements
Annotate the background picture with the Hostname, MAC and IP addresses

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s