[Bug 4921] New: bacula storage deamon

bugzilla-daemon at amethyst.openembedded.net bugzilla-daemon at amethyst.openembedded.net
Thu Dec 11 14:03:11 UTC 2008


http://bugs.openembedded.net/show_bug.cgi?id=4921

           Summary: bacula storage deamon
    Classification: Unclassified
           Product: Openembedded
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: Distributions
        AssignedTo: openembedded-issues at lists.openembedded.org
        ReportedBy: eric at eric-weiss.de


i tried to interact with with an bacula backup system.
this faild cause openembedded still supports only 1.38 version.
this provides the storage daemon for 2.5 series of the bacula  system

--------
DESCRIPTION = "Bacula storagedeaemon for  Bacula a network based backup
program"
SECTION = "console/network"
PRIORITY = "optional"
HOMEPAGE = "http://www.bacula.org"
LICENSE = "GPL"
PR ="r1"
DEPENDS = "gmp openssl zlib readline sqlite cpio"

SRC_URI =
"http://heanet.dl.sourceforge.net/sourceforge/bacula/bacula-2.5.16.tar.gz \
           file://bacula-nosetpgrp.patch;patch=1\
           file://bacula-sd.init\
           file://findlib-attribs_2.5.16.patch;patch=1"
#
S = "${WORKDIR}/bacula-2.5.16"

# Makefile is broken using ccache
# No idea how to fix it so I turned ccache off
CCACHE = ""

inherit autotools update-rc.d

LDFLAGS += "-L${STAGING_LIBDIR}"
CFLAGS += "-L${STAGING_LIBDIR} -I${STAGING_INCDIR}"

INITSCRIPT_NAME = "bacula-fd"
do_configure() {
        oe_runconf --enable-build-stored \
                   --prefix=/usr \
                   --with-working-dir=/var/lib/bacula  \
                   --with-sd-user=root \
                   --with-sd-group=root \
                   --enable-static-sd\
                   --disable-build-dird\
                   --with-sqlite=${STAGING_EXECPREFIXDIR}/include
}

do_compile() {
        oe_runmake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
}

do_install() {
         mkdir -p ${D}/${sbindir}
         mkdir -p ${D}/${libdir}
         mkdir -p ${D}/var/lib/bacula
         mkdir -p ${D}/var/run/bacula
         mkdir -p ${D}/${sysconfdir}/bacula
         mkdir -p ${D}/${sysconfdir}/bacula/scripts

         install -m 0754 ${S}/src/lib/.libs/libbac*.so* ${D}/${libdir}/
         install -m 0754 ${S}/src/stored/.libs/* ${D}/${sbindir}/
         install ${S}/src/stored/bacula-sd.conf ${D}/${sysconfdir}/bacula/
         install ${S}/scripts/mtx-changer ${D}/${sysconfdir}/bacula/scripts
         install ${S}/scripts/mtx-changer.conf
${D}/${sysconfdir}/bacula/scripts

}

# Add group
pkg_postinst() {
        grep -q bacula: /etc/group || addgroup bacula
}

do_install_append() {
         mkdir -p ${D}/${sysconfdir}/init.d
 #        mkdir -p ${D}/var/run/bacula-sd

         install ${WORKDIR}/bacula-sd.init ${D}/${sysconfdir}/init.d/bacula-sd
}
-------------------------------------------------------------------------
and additional for the files dir.
------------------ findlib-attribs_2.5.16.patch --------------------
diff -Nur bacula-2.5.16/src/findlib/attribs.c
/tmp/bacula-2.5.16/src/findlib/attribs.c
--- bacula-2.5.16/src/findlib/attribs.c 2008-09-28 17:44:29.000000000 +0200
+++ /tmp/bacula-2.5.16/src/findlib/attribs.c    2008-12-09 15:39:37.000000000
+0100
@@ -206,12 +206,7 @@
    p += to_base64((int64_t)ff_pkt->LinkFI, p);
    *p++ = ' ';

-#ifdef HAVE_CHFLAGS
-   /* FreeBSD function */
-   p += to_base64((int64_t)statp->st_flags, p);  /* output st_flags */
-#else
    p += to_base64((int64_t)0, p);     /* output place holder */
-#endif
    *p++ = ' ';
    p += to_base64((int64_t)data_stream, p);
    *p = 0;
@@ -304,11 +299,6 @@
    if (*p == ' ' || (*p != 0 && *(p+1) == ' ')) {
       p++;
       p += from_base64(&val, p);
-#ifdef HAVE_CHFLAGS
-      plug(statp->st_flags, val);
-   } else {
-      statp->st_flags  = 0;
-#endif
    }

    /* Look for data stream id */
@@ -471,21 +461,6 @@
             attr->ofname, be.bstrerror());
          ok = false;
       }
-#ifdef HAVE_CHFLAGS
-      /*
-       * FreeBSD user flags
-       *
-       * Note, this should really be done before the utime() above,
-       *  but if the immutable bit is set, it will make the utimes()
-       *  fail.
-       */
-      if (chflags(attr->ofname, attr->statp.st_flags) < 0 && my_uid == 0) {
-         berrno be;
-         Jmsg2(jcr, M_ERROR, 0, _("Unable to set file flags %s: ERR=%s\n"),
-            attr->ofname, be.bstrerror());
-         ok = false;
-      }
-#endif
    }

 bail_out:
@@ -494,7 +469,6 @@
    return ok;
 }
 -
 /*=============================================================*/
 /*                                                             */
 /*                 * * *  U n i x * * * *                      */
diff -Nur bacula-2.5.16/src/findlib/create_file.c
/tmp/bacula-2.5.16/src/findlib/create_file.c
--- bacula-2.5.16/src/findlib/create_file.c     2008-10-04 12:50:50.000000000
+0200
+++ /tmp/bacula-2.5.16/src/findlib/create_file.c        2008-12-09
15:39:48.000000000 +0100
@@ -307,48 +307,12 @@
          Dmsg2(130, "Hard link %s => %s\n", attr->ofname, attr->olname);
          if (link(attr->olname, attr->ofname) != 0) {
             berrno be;
-#ifdef HAVE_CHFLAGS
-            struct stat s;

-        /*
-            * If using BSD user flags, maybe has a file flag
-            * preventing this. So attempt to disable, retry link,
-            * and reset flags.
-            * Note that BSD securelevel may prevent disabling flag.
-        */
-
-            if (stat(attr->olname, &s) == 0 && s.st_flags != 0) {
-               if (chflags(attr->olname, 0) == 0) {
-                  if (link(attr->olname, attr->ofname) != 0) {
-                     /* restore original file flags even when linking failed
*/
-                     if (chflags(attr->olname, s.st_flags) < 0) {
-                        Qmsg2(jcr, M_ERROR, 0, _("Could not restore file flags
for file %s: ERR=%s\n"),
-                              attr->olname, be.bstrerror());
-                     }
-#endif /* HAVE_CHFLAGS */
             Qmsg3(jcr, M_ERROR, 0, _("Could not hard link %s -> %s:
ERR=%s\n"),
                   attr->ofname, attr->olname, be.bstrerror());
             Dmsg3(200, "Could not hard link %s -> %s: ERR=%s\n",
                   attr->ofname, attr->olname, be.bstrerror());
             return CF_ERROR;
-#ifdef HAVE_CHFLAGS
-                  }
-                  /* finally restore original file flags */
-                  if (chflags(attr->olname, s.st_flags) < 0) {
-                     Qmsg2(jcr, M_ERROR, 0, _("Could not restore file flags
for file %s: ERR=%s\n"),
-                            attr->olname, be.bstrerror());
-                  }
-               } else {
-                 Qmsg2(jcr, M_ERROR, 0, _("Could not reset file flags for file
%s: ERR=%s\n"),
-                       attr->olname, be.bstrerror());
-               }
-            } else {
-              Qmsg3(jcr, M_ERROR, 0, _("Could not hard link %s -> %s:
ERR=%s\n"),
-                    attr->ofname, attr->olname, be.bstrerror());
-              return CF_ERROR;
-            }
-#endif /* HAVE_CHFLAGS */
-
          }
          return CF_CREATED;
 #endif
----------------------------------------------------------------------------


------------------------- bacula-nosetpgrp.patch ----------------------
diff -Nur bacula-2.5.16.orig/configure bacula-2.5.16/configure
--- bacula-2.5.16.orig/configure        2008-10-18 11:19:04.000000000 +0200
+++ bacula-2.5.16/configure     2008-12-08 19:12:02.000000000 +0100
@@ -37475,7 +37475,6 @@
    getpid \
    gettimeofday \
    setpgid \
-   setpgrp \
    setsid \
    signal \
    strerror \
@@ -39789,77 +39788,6 @@

 fi

-{ echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5
-echo $ECHO_N "checking whether setpgrp takes no argument... $ECHO_C" >&6; }
-if test "${ac_cv_func_setpgrp_void+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling"
>&5
-echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-/* If this system has a BSD-style setpgrp which takes arguments,
-  setpgrp(1, 1) will fail with ESRCH and return -1, in that case
-  exit successfully. */
-  return setpgrp (1,1) != -1;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_setpgrp_void=no
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_setpgrp_void=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext
conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5
-echo "${ECHO_T}$ac_cv_func_setpgrp_void" >&6; }
-if test $ac_cv_func_setpgrp_void = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define SETPGRP_VOID 1
-_ACEOF
-
-fi
            # AC_FUNC_FNMATCH    dnl use local version

 { echo "$as_me:$LINENO: checking for gettext in -lintl" >&5
--------------------------------------------------------------------------

------------------- bacula-sd.init ---------------------------------------
#!/bin/sh
### BEGIN INIT INFO
# Provides:          bacula-sd
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO
#
# bacula-fd     SysV init script for Bacula-FD.
#
#       Written by Miquel van Smoorenburg <miquels at cistron.nl>.
#       Modified for Debian GNU/Linux by Ian Murdock <imurdock at gnu.ai.mit.edu>
#       Customized for Bacula by Jose Luis Tallon <jltallon at adv-solutions.net>
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/bacula-sd
NAME="bacula-sd"
PORT=9103
DESC="Bacula Storage daemon"
ARGS="-c /etc/bacula/bacula-sd.conf -u bacula -g tape"

test -f $DAEMON || exit 0

set -e

if [ -n "`getent services bacula-sd`" ]; then
        PORT=`getent services bacula-sd | awk '{ gsub("/tcp","",$2); print $2;
}'`
fi

. /usr/share/bacula-common/common-functions
create_var_run_dir

PIDFILE=/var/run/bacula/$NAME.$PORT.pid

case "$1" in
  start)
        if [ -f /etc/bacula/do_not_run ]; then
                echo "Not starting $DESC: disabled via /etc/bacula/do_not_run"
                exit 0
        fi

        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
                --exec $DAEMON -- $ARGS
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
                --exec $DAEMON -- $ARGS
        echo "$NAME."
        ;;

  restart|force-reload)
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --quiet --pidfile $PIDFILE \
                --exec $DAEMON -- $ARGS
        sleep 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
                --exec $DAEMON -- $ARGS
        echo "$NAME."
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
-------------------------------------------------------------------------

-- 
Configure bugmail: http://bugs.openembedded.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.




More information about the Openembedded-issues mailing list