--- ofpathname.orig 2007-07-17 16:10:47.000000000 +0200 +++ ofpathname 2007-08-12 13:00:21.000000000 +0200 @@ -27,6 +33,7 @@ echo "Optional arguments." echo " -l Convert Open Firmware device pathname to" echo " logical device name." + echo " -a Find matching Open Firmware device alias[es]." echo " -q, --quiet do not report failures, exit quietly" echo " -V, --version display version information and exit" echo " -h, --help display this help information and exit" @@ -226,7 +234,16 @@ OF_PATH=$OFPATH:1\\ppc\\bootinfo.txt fi - echo $OF_PATH + if [[ $do_alias = "0" ]]; then + echo $OF_PATH + else + (shopt -s nullglob + for i in /proc/device-tree/aliases/* ; do + if sed -e "s/\x00$//g" $i | grep -qx "$OF_PATH" ; then + basename $i + fi + done) + fi } # @@ -613,10 +638,14 @@ # default: convert logical => OFpath do_of2l=0 +# default: do not alias-ize +do_alias=0 getopt -o "l:Vqh" -l "help,version,quiet" $@ > /dev/null 2>&1 while [[ -n $1 ]]; do case "$1" in + -a) do_alias=1 ;; + -l) do_of2l=1 DEVNAME_ARG=$2 shift ;;