From: Kern Sibbald Date: Sun, 5 Oct 2008 10:42:47 +0000 (+0000) Subject: Do dirty check on hostname (Linux only) and if not resolvable X-Git-Tag: Release-3.0.0~875 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1141947efac69b2599c1c4b9bbf3ebbfbfd2b1c2;p=bacula%2Fbacula Do dirty check on hostname (Linux only) and if not resolvable use localhost as default. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7707 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 81527a19f9..20a91da972 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -2048,6 +2048,11 @@ darwin) platforms/darwin/Makefile" ;; debian) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } if `grep -q ubuntu /etc/apt/sources.list`; then DISTNAME="ubuntu" fi @@ -2081,6 +2086,14 @@ debian) fi ;; freebsd) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`uname -a |awk '{print $3}'` VER=`echo $DISTVER | cut -c 1` if test x$VER = x4 ; then @@ -2140,6 +2153,14 @@ openbsd) platforms/openbsd/bacula-dir" ;; redhat) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi if test -f /etc/whitebox-release ; then f=/etc/whitebox-release else @@ -2164,6 +2185,14 @@ redhat) " ;; mandrake) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`cat /etc/mandrake-release | grep release |\ cut -f 5 -d ' '` TAPEDRIVE="/dev/nst0" @@ -2177,6 +2206,14 @@ mandrake) " ;; gentoo) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release` TAPEDRIVE="/dev/nst0" PSCMD="ps -e -o pid,command" @@ -2188,6 +2225,14 @@ gentoo) platforms/gentoo/bacula-dir" ;; slackware) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`cat /etc/slackware-version` TAPEDRIVE="/dev/nst0" PSCMD="ps -e -o pid,command" @@ -2213,6 +2258,14 @@ solaris) LIBS="$LIBS -lresolv" ;; suse) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`cat /etc/SuSE-release |grep VERSION|\ cut -f 3 -d ' '` TAPEDRIVE="/dev/nst0" @@ -2226,6 +2279,14 @@ suse) platforms/suse/bacula.spec" ;; suse5) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTNAME=suse DISTVER=5.x TAPEDRIVE="/dev/nst0" diff --git a/bacula/configure b/bacula/configure index 0b48a6c0e6..17a2078f6a 100755 --- a/bacula/configure +++ b/bacula/configure @@ -34602,6 +34602,11 @@ darwin) platforms/darwin/Makefile" ;; debian) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } if `grep -q ubuntu /etc/apt/sources.list`; then DISTNAME="ubuntu" fi @@ -34635,6 +34640,14 @@ debian) fi ;; freebsd) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`uname -a |awk '{print $3}'` VER=`echo $DISTVER | cut -c 1` if test x$VER = x4 ; then @@ -34697,6 +34710,14 @@ openbsd) platforms/openbsd/bacula-dir" ;; redhat) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi if test -f /etc/whitebox-release ; then f=/etc/whitebox-release else @@ -34721,6 +34742,14 @@ redhat) " ;; mandrake) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`cat /etc/mandrake-release | grep release |\ cut -f 5 -d ' '` TAPEDRIVE="/dev/nst0" @@ -34734,6 +34763,14 @@ mandrake) " ;; gentoo) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release` TAPEDRIVE="/dev/nst0" PSCMD="ps -e -o pid,command" @@ -34745,6 +34782,14 @@ gentoo) platforms/gentoo/bacula-dir" ;; slackware) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`cat /etc/slackware-version` TAPEDRIVE="/dev/nst0" PSCMD="ps -e -o pid,command" @@ -34773,6 +34818,14 @@ _ACEOF LIBS="$LIBS -lresolv" ;; suse) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTVER=`cat /etc/SuSE-release |grep VERSION|\ cut -f 3 -d ' '` TAPEDRIVE="/dev/nst0" @@ -34786,6 +34839,14 @@ suse) platforms/suse/bacula.spec" ;; suse5) +# Make sure hostname is resolved + ping -c 1 $hostname 2>&1 1>/dev/null + if test ! $? = 0; then + hostname="localhost" + } + if `grep -q ubuntu /etc/apt/sources.list`; then + DISTNAME="ubuntu" + fi DISTNAME=suse DISTVER=5.x TAPEDRIVE="/dev/nst0" diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 854f5a2782..ffd2e840de 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -18,6 +18,8 @@ remove reader/writer in FOPTS???? General: 05Oct08 +kes Do dirty check on hostname (Linux only) and if not resolvable + use localhost as default. kes Increase vtape max block to 20GB. 04Oct08 kes Refactor restore code to create a close_previous_stream(). This