Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1.  
  2. # In case the dhcp server is not capable of assigning a dnsdomainname, hostname -f fails.
  3. # Fallback to IP of host.
  4.  
  5.  
  6. diff --git a/dist/obsapisetup b/dist/obsapisetup
  7. index 678dc64..d428ef5 100755
  8. --- a/dist/obsapisetup
  9. +++ b/dist/obsapisetup
  10. @@ -30,6 +30,14 @@ webuidir=/srv/www/obs/webui
  11.  
  12. FQHOSTNAME=`hostname -f`
  13.  
  14. +if [ "$?" != "0" ]; then
  15. + # Fallback to IP of the VM/host
  16. + FQHOSTNAME=`ip addr | sed -n 's,.*inet \(.*\)/.* brd.*,\1,p' | grep -v ^127. | head -n 1`
  17. + if [ "$?" != "0" ]; then
  18. + echo " Can't determine hostname or IP - Network setup failed!"
  19. + echo " Check if networking is up and dhcp is working!"
  20. + fi
  21. +fi
  22. . /etc/sysconfig/obs-server
  23.  
  24. if [ "$OBS_API_AUTOSETUP" != "yes" ]; then
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement