hosts 447 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. echo "\
  3. # This file is automagically regenerated
  4. # Note! /etc/nsswitch.conf may override this!
  5. # For loopbacking
  6. 127.0.0.1 localhost
  7. # Our local IPs"
  8. hostname=`hostname`
  9. test "$hostname" || hostname=localhost
  10. domain=`(. /boot.conf; echo "$DNSDOMAINNAME")`
  11. test "$domain" && hostname="$hostname $hostname.$domain"
  12. ip -o a l \
  13. | grep -F 'inet ' \
  14. | sed -e 's/^.*inet //' -e 's:[ /].*$: '"$hostname"':'
  15. echo
  16. echo "# End of /etc/hosts"