getip.sh suggestion
  • I use my raspi on wifi quite a lot but advmenu then doesn't show the IP address. I've edited the getip.sh file to allow for wifi and ethernet connections. Thought I would share it:


    #!/bin/bash

    eIP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
    wIP=$(/sbin/ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
    blank=""

    if [ "$eIP" != "$blank" ]; then
    echo "eth0 available"
    IP="SeIP"
    elif [ "$wIP" != "$blank" ]; then
    echo "eth0 unavailable"
    echo "wlan0 available"
    IP="$wIP"
    else
    echo "eth0 unavailable"
    echo "wlan0 unavailable"
    IP="$blank"
    fi

    #convert -size 200x30 xc:transparent -font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf -fill black -pointsize 12 -draw "text 5,15 'test'" test2.png

    convert -size 200x60 xc:transparent -font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf -fill white -pointsize 20 -draw "text 55,55 '${IP}'" /root/ipwatermark/theip.png

    composite -gravity south -dissolve 100 /root/ipwatermark/theip.png /root/ipwatermark/watermark_bg.png /root/ipwatermark/advmenu_background.png


    You may need to adjust the locations of the files. Please let me know whether it works.

    Natu
  • Thanks! If you have a GitHub account you can put that into the http://github.com/ssilverm/PiMAME repo yourself. If not, I'll do it later today.

    Thanks for addition!
  • I would make these two subtle changes to prevent error messages on the screen:

    eIP=$(/sbin/ifconfig eth0 |& grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
    wIP=$(/sbin/ifconfig wlan0 |& grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')

    The additional "&" after the first pipe sends errors to the grep instead of standard out. This will prevent messages about interfaces not being enabled.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!