Sylvain303 / install_script

YunoHost installation scripts
http://yunohost.org
1 stars 0 forks source link

show IP obtained by dhcp in the biq Y on the console #2

Open Sylvain303 opened 8 years ago

Sylvain303 commented 8 years ago

If I remember well, the wheezy raspberry version display its IP at the final prompt.

Discover how this message is made and add the same kind of hint about the IP and direct the user to the web interface.

Sylvain303 commented 8 years ago

It seems generated by the script: /etc/init.d/boot_prompt.sh

Where does this script come from? It has IP information in it. May be not at the good step in the process.

declare -A address
j=0
for i in $(ip address | egrep '^\w*:.*(BROADCAST|POINTOPOINT)'| grep -v DOWN | awk '{print $2}'| sed 's/://' | sed 's/@NONE//'); do
  addr6=$(ip addr show $i | grep '.*inet6\s.*' | awk '{print $2}' | sed ':a;N;$!ba;s/\n/ /g')
  addr4=$(ip addr show $i | grep '.*inet\s.*' | awk '{print $2}' | sed 's#/\w*##' | sed ':a;N;$!ba;s/\n/ /g')
  [ ! "$addr6" ] && [ ! "$addr4" ] && continue
  [[ $i == eth* ]] && [ "$addr4" ] && ip=$addr4
  addrs="IPs of interface "$i": addr6: "$addr6", addr4: "$addr4
  address[$j]=$addrs
  j=$((j+1)) 
done