]> git.sur5r.net Git - bacula/bacula/commitdiff
Implement feature request #1939
authorMarco van Wieringen <mvw@planets.elm.net>
Wed, 10 Oct 2012 14:13:25 +0000 (16:13 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:51:01 +0000 (14:51 +0200)
ACL and XATTR support for GNU/Hurd and autoconf support for
detecting GNU Hurd and setting the correct DISTNAME etc. and
proper platform support for GNU hurd.

13 files changed:
bacula/autoconf/acconfig.h
bacula/autoconf/bacula-macros/os.m4
bacula/autoconf/configure.in
bacula/platforms/Makefile.in
bacula/platforms/hurd/Makefile.in [new file with mode: 0644]
bacula/platforms/hurd/bacula-dir.in [new file with mode: 0644]
bacula/platforms/hurd/bacula-fd.in [new file with mode: 0644]
bacula/platforms/hurd/bacula-sd.in [new file with mode: 0644]
bacula/src/filed/acl.c
bacula/src/filed/xattr.c
bacula/src/filed/xattr.h
bacula/src/lib/mntent_cache.c
bacula/src/streams.h

index 40a91d70e565d9a3ee3b8c299bf5e89dc178382d..4c5f8dd3c4f5afdedd2ba96e71b347be9df7e05c 100644 (file)
 #undef HAVE_CYGWIN
 #undef HAVE_OSF1_OS
 #undef HAVE_DARWIN_OS
+#undef HAVE_HURD_OS
 
 /* Set to correct scanf value for long long int */
 #undef lld
index 2833e4da3ab501731e8650b8f7eeb54fe71c1af6..1af4f903aea65db10804cffe832409dec39eebd7 100644 (file)
@@ -62,6 +62,14 @@ else
         BA_CONDITIONAL(HAVE_SUN_OS, $FALSEPRG)
 fi
 
+if test $HAVE_UNAME=yes -a x`uname -s` = xGNU
+then
+        BA_CONDITIONAL(HAVE_HURD_OS, $TRUEPRG)
+        AC_DEFINE(HAVE_HURD_OS)
+else
+        BA_CONDITIONAL(HAVE_HURD_OS, $FALSEPRG)
+fi
+
 if test $HAVE_UNAME=yes -a x`uname -s` = xOSF1
 then
         BA_CONDITIONAL(HAVE_OSF1_OS, $TRUEPRG)
@@ -168,6 +176,9 @@ then
 elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS
 then
         DISTNAME=solaris
+elif test $HAVE_UNAME=yes -a x`uname -s` = xGNU
+then
+        DISTNAME=hurd
 elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD
 then
         DISTNAME=freebsd
index 7931835fa535f9cbaa4032c3de1f2536b622cb1d..de09194390db0d47c098e0a8e4289039eb688410 100644 (file)
@@ -3152,6 +3152,16 @@ freebsd)
        platforms/freebsd/bacula-dir"
    largefile_support="yes"
   ;;
+hurd)
+   DISTVER=`uname -r`
+   TAPEDRIVE="/dev/nst0"
+   PSCMD="ps -e -o pid,command"
+   PFILES="${PFILES} \
+       platforms/hurd/Makefile \
+       platforms/hurd/bacula-fd \
+       platforms/hurd/bacula-sd \
+       platforms/hurd/bacula-dir"
+  ;;
 hpux)
    PSCMD="UNIX95=1; ps -e -o pid,comm"
    CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
index bba619b7737d1cf6f65ea1b4bcd1838a4ac9668d..fedcde3cf740340608f2741f0e15ac8452e9b9a4 100644 (file)
@@ -11,7 +11,7 @@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL = @INSTALL@
 
-SUBDIRS = freebsd redhat solaris unknown openbsd osx irix gentoo \
+SUBDIRS = hurd freebsd redhat solaris unknown openbsd osx irix gentoo \
          debian darwin aix bsdi mandrake slackware alpha ubuntu systemd
 
 MAKE = make
diff --git a/bacula/platforms/hurd/Makefile.in b/bacula/platforms/hurd/Makefile.in
new file mode 100644 (file)
index 0000000..c8f392e
--- /dev/null
@@ -0,0 +1,88 @@
+#
+# This file is used as the template to create the
+# Makefile for the Debian GNU Hurd specific installation.
+#
+#  21 March 2008 -- Kern Sibbald
+#
+#  for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ -m 754
+
+nothing:
+
+install: install-autostart
+
+install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir
+
+install_logrotate:
+       @$(INSTALL_PROGRAM) ../../scripts/logrotate $(DESTDIR)/etc/logrotate.d/bacula
+
+install-autostart-fd: uninstall-autostart-fd
+       @echo "Installing bacula-fd boot script ..."
+       @$(INSTALL_PROGRAM) bacula-fd $(DESTDIR)/etc/init.d/bacula-fd
+       @echo "Installing bacula-fd symlinks ..."
+       @if test x$(DESTDIR) = x ; then \
+          /usr/sbin/update-rc.d bacula-fd start 91 2 3 4 5 . stop 9 0 1 6 .; \
+       fi
+
+
+install-autostart-sd: uninstall-autostart-sd
+       @echo "Installing bacula-sd boot script ..."
+       @$(INSTALL_PROGRAM) bacula-sd $(DESTDIR)/etc/init.d/bacula-sd
+       @echo "Installing bacula-sd symlinks ..."
+       @if test "x$(DESTDIR)" = "x" ; then \
+          /usr/sbin/update-rc.d bacula-sd start 91 2 3 4 5 . stop 9 0 1 6 .; \
+       fi
+
+
+install-autostart-dir: uninstall-autostart-dir
+       @echo "Installing bacula-dir boot script ..."
+       @$(INSTALL_PROGRAM) bacula-dir $(DESTDIR)/etc/init.d/bacula-dir
+       @echo "Installing bacula-dir symlinks ..."
+       @if test "x$(DESTDIR)" = "x" ; then \
+          /usr/sbin/update-rc.d bacula-dir start 90 2 3 4 5 . stop 9 0 1 6 .; \
+       fi
+
+
+uninstall: uninstall-autostart
+
+uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir
+
+uninstall-logrotate:
+       @rm -f $(DESTDIR)/etc/logrotate.d/bacula
+
+uninstall-autostart-fd:
+       @if test "x$(DESTDIR)" = "x" -a  -f /etc/init.d/bacula-fd; then \
+          /etc/init.d/bacula-fd stop; \
+          rm -f  $(DESTDIR)/etc/init.d/bacula-fd; \
+          /usr/sbin/update-rc.d bacula-fd remove; \
+       fi
+
+
+uninstall-autostart-sd:
+       @if test "x$(DESTDIR)" = "x" -a  -f /etc/init.d/bacula-sd; then \
+          /etc/init.d/bacula-sd stop; \
+          rm -f  $(DESTDIR)/etc/init.d/bacula-sd; \
+          /usr/sbin/update-rc.d bacula-sd remove; \
+       fi
+
+uninstall-autostart-dir:
+       @if test "x$(DESTDIR)" = "x" -a  -f /etc/init.d/bacula-dir; then \
+          /etc/init.d/bacula-dir stop; \
+          rm -f  $(DESTDIR)/etc/init.d/bacula-dir; \
+          /usr/sbin/update-rc.d bacula-dir remove; \
+       fi
+       @rm -f  $(DESTDIR)/etc/init.d/bacula-dir
+
+clean:
+       @rm -f 1 2 3
+
+distclean: clean
+       @rm -f Makefile
+       @rm -f bacula-sd bacula-fd bacula-dir
+
+devclean: clean
+       @rm -f Makefile
+       @rm -f bacula-sd bacula-fd bacula-dir
diff --git a/bacula/platforms/hurd/bacula-dir.in b/bacula/platforms/hurd/bacula-dir.in
new file mode 100644 (file)
index 0000000..88c13a3
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+#
+# bacula  This shell script takes care of starting and stopping
+#        the bacula Director daemon on Debian GNU Hurd systems.
+#
+#   Kern E. Sibbald - 21 March 2008
+#
+#  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+### BEGIN INIT INFO
+# Provides:         bacula-dir
+# Required-Start:    $network
+# Required-Stop:     $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start @BACULA@ Director daemon at boot time
+# Description:      Enable @BACULA@ Director.
+### END INIT INFO
+#
+
+NAME="bacula-dir"
+DESC="@BACULA@ Director"
+DAEMON=@sbindir@/${NAME}
+BUSER=@dir_user@
+BGROUP=@dir_group@
+BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+BPORT=@dir_port@
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+test -f $DAEMON || exit 0
+
+if [ -n "`getent services ${NAME}`" ]; then
+   BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
+fi
+
+if [ -f /etc/default/$NAME ]; then
+   . /etc/default/$NAME
+fi
+
+PIDFILE=@piddir@/${NAME}.${BPORT}.pid
+
+if [ "x${BUSER}" != "x" ]; then
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${USERGRP}:${BGROUP}"
+   fi
+fi
+
+case "$1" in
+   start)
+      echo -n "Starting ${DESC}: "
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS}
+      RETVAL=$?
+      echo "${NAME}"
+      ;;
+   stop)
+      echo -n "Stopping ${DESC}: "
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS}
+      RETVAL=$?
+      echo "${NAME}"
+      ;;
+   restart|force-reload)
+      $0 stop
+      sleep 5
+      $0 start
+      ;;
+   *)
+      echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
+      exit 1
+      ;;
+esac
+exit $RETVAL
diff --git a/bacula/platforms/hurd/bacula-fd.in b/bacula/platforms/hurd/bacula-fd.in
new file mode 100644 (file)
index 0000000..270950a
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+#
+# bacula  This shell script takes care of starting and stopping
+#        the bacula Director daemon on Debian GNU Hurd systems.
+#
+#   Kern E. Sibbald - 21 March 2008
+#
+#  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+### BEGIN INIT INFO
+# Provides:         bacula-fd
+# Required-Start:    $network
+# Required-Stop:     $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start @BACULA@ Client daemon at boot time
+# Description:      Enable @BACULA@ Client.
+### END INIT INFO
+
+
+NAME="bacula-fd"
+DESC="@BACULA@ File Daemon"
+DAEMON=@sbindir@/${NAME}
+BUSER=@fd_user@
+BGROUP=@fd_group@
+BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+BPORT=@fd_port@
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+test -f $DAEMON || exit 0
+
+if [ -n "`getent services ${NAME}`" ]; then
+   BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
+fi
+
+if [ -f /etc/default/$NAME ]; then
+   . /etc/default/$NAME
+fi
+
+PIDFILE=@piddir@/${NAME}.${BPORT}.pid
+
+if [ "x${BUSER}" != "x" ]; then
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${USERGRP}:${BGROUP}"
+   fi
+fi
+
+case "$1" in
+   start)
+      echo -n "Starting ${DESC}: "
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS}
+      RETVAL=$?
+      echo "${NAME}"
+      ;;
+   stop)
+      echo -n "Stopping ${DESC}: "
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS}
+      RETVAL=$?
+      echo "${NAME}"
+      ;;
+   restart|force-reload)
+      $0 stop
+      sleep 5
+      $0 start
+      ;;
+   *)
+      echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
+      exit 1
+      ;;
+esac
+exit $RETVAL
diff --git a/bacula/platforms/hurd/bacula-sd.in b/bacula/platforms/hurd/bacula-sd.in
new file mode 100644 (file)
index 0000000..ff1ad29
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+#
+# bacula  This shell script takes care of starting and stopping
+#        the bacula Director daemon on Debian GNU Hurd systems.
+#
+#   Kern E. Sibbald - 21 March 2008
+#
+#  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+### BEGIN INIT INFO
+# Provides:         bacula-sd
+# Required-Start:    $network
+# Required-Stop:     $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start @BACULA@ Storage daemon at boot time
+# Description:      Enable @BACULA@ Storage daemon.
+### END INIT INFO
+
+
+NAME="bacula-sd"
+DESC="@BACULA@ Storage Daemon"
+DAEMON=@sbindir@/${NAME}
+BUSER=@sd_user@
+BGROUP=@sd_group@
+BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+BPORT=@sd_port@
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+test -f $DAEMON || exit 0
+
+if [ -n "`getent services ${NAME}`" ]; then
+   BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
+fi
+
+if [ -f /etc/default/$NAME ]; then
+   . /etc/default/$NAME
+fi
+
+PIDFILE=@piddir@/${NAME}.${BPORT}.pid
+
+if [ "x${BUSER}" != "x" ]; then
+   USERGRP="--chuid ${BUSER}"
+   if [ "x${BGROUP}" != "x" ]; then
+      USERGRP="${USERGRP}:${BGROUP}"
+   fi
+fi
+
+case "$1" in
+   start)
+      echo -n "Starting ${DESC}: "
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS}
+      RETVAL=$?
+      echo "${NAME}"
+      ;;
+   stop)
+      echo -n "Stopping ${DESC}: "
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP}  --exec ${DAEMON} -- ${BOPTIONS}
+      RETVAL=$?
+      echo "${NAME}"
+      ;;
+   restart|force-reload)
+      $0 stop
+      sleep 5
+      $0 start
+      ;;
+   *)
+      echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
+      exit 1
+      ;;
+esac
+exit $RETVAL
index b83bd7a19ef63a643e33611e3831750e09bf6cb2..59eac94e277322721e8f4b51dfa12e3b17e7d4b8 100644 (file)
@@ -32,6 +32,7 @@
  *   - AIX (pre-5.3 and post 5.3 acls, acl_get and aclx_get interface)
  *   - Darwin
  *   - FreeBSD (POSIX and NFSv4/ZFS acls)
+ *   - GNU Hurd
  *   - HPUX
  *   - IRIX
  *   - Linux
@@ -543,7 +544,8 @@ static bacl_exit_code (*os_parse_acl_streams)
       defined(HAVE_FREEBSD_OS) || \
       defined(HAVE_IRIX_OS) || \
       defined(HAVE_OSF1_OS) || \
-      defined(HAVE_LINUX_OS)
+      defined(HAVE_LINUX_OS) || \
+      defined(HAVE_HURD_OS)
 
 #include <sys/types.h>
 
@@ -642,7 +644,8 @@ static int acl_count_entries(acl_t acl)
 {
    int count = 0;
 #if defined(HAVE_FREEBSD_OS) || \
-    defined(HAVE_LINUX_OS)
+    defined(HAVE_LINUX_OS) || \
+    defined(HAVE_HURD_OS)
    acl_entry_t ace;
    int entry_available;
 
@@ -684,7 +687,8 @@ static bool acl_is_trivial(acl_t acl)
    acl_entry_t ace;
    acl_tag_t tag;
 #if defined(HAVE_FREEBSD_OS) || \
-    defined(HAVE_LINUX_OS)
+    defined(HAVE_LINUX_OS) || \
+    defined(HAVE_HURD_OS)
    int entry_available;
 
    entry_available = acl_get_entry(acl, ACL_FIRST_ENTRY, &ace);
@@ -1275,7 +1279,8 @@ static bacl_exit_code (*os_parse_acl_streams)
                       freebsd_parse_acl_streams;
 
 #elif defined(HAVE_IRIX_OS) || \
-      defined(HAVE_LINUX_OS)
+      defined(HAVE_LINUX_OS) || \
+      defined(HAVE_HURD_OS)
 /*
  * Define the supported ACL streams for these OSes
  */
@@ -1293,6 +1298,13 @@ static int os_access_acl_streams[1] = {
 static int os_default_acl_streams[1] = {
    STREAM_ACL_LINUX_DEFAULT_ACL
 };
+#elif defined(HAVE_HURD_OS)
+static int os_access_acl_streams[1] = {
+   STREAM_ACL_HURD_ACCESS_ACL
+};
+static int os_default_acl_streams[1] = {
+   STREAM_ACL_HURD_DEFAULT_ACL
+};
 #endif
 
 static bacl_exit_code generic_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
index faf86d578c6a7275c9840123ac407d357f796db6..21a63650d815720d79febbe3d781c70e481d1141 100644 (file)
@@ -35,6 +35,7 @@
  *   - AIX (Extended Attributes)
  *   - Darwin (Extended Attributes)
  *   - FreeBSD (Extended Attributes)
+ *   - GNU HURD (Extended Attributes)
  *   - IRIX (Extended Attributes)
  *   - Linux (Extended Attributes)
  *   - NetBSD (Extended Attributes)
@@ -1035,7 +1036,8 @@ static bxattr_exit_code (*os_parse_xattr_streams)
                         irix_parse_xattr_streams;
 
 #elif defined(HAVE_DARWIN_OS) || \
-      defined(HAVE_LINUX_OS)
+      defined(HAVE_LINUX_OS) || \
+      defined(HAVE_HURD_OS)
 
 #if (!defined(HAVE_LISTXATTR) && !defined(HAVE_LLISTXATTR)) || \
     (!defined(HAVE_GETXATTR) && !defined(HAVE_LGETXATTR)) || \
@@ -1077,6 +1079,16 @@ static const char *xattr_acl_skiplist[3] = {
 static const char *xattr_skiplist[1] = {
    NULL
 };
+#elif defined(HAVE_HURD_OS)
+static int os_default_xattr_streams[1] = {
+   STREAM_XATTR_HURD
+};
+static const char *xattr_acl_skiplist[1] = {
+   NULL
+};
+static const char *xattr_skiplist[1] = {
+   NULL
+};
 #endif
 
 /*
index cb1c68e45117d36c67e5b0895a765be9b346c450..b61ec111617159fec11184bc220c4d2d640f10a5 100644 (file)
@@ -33,6 +33,8 @@
 #define BXATTR_ENOTSUP EOPNOTSUPP
 #elif defined(HAVE_DARWIN_OS)
 #define BXATTR_ENOTSUP ENOTSUP
+#elif defined(HAVE_HURD_OS)
+#define BXATTR_ENOTSUP ENOTSUP
 #endif
 
 /*
index c30cc912fee6008b80e548a6dad533bf736496f7..ca2c8a8db46b2eadef41d9a7e943595c9a78a00e 100644 (file)
 #include <sys/stat.h>
 
 #if defined(HAVE_GETMNTENT)
-#if defined(HAVE_LINUX_OS) || defined(HAVE_HPUX_OS) || defined(HAVE_AIX_OS)
+#if defined(HAVE_LINUX_OS) || \
+    defined(HAVE_HPUX_OS) || \
+    defined(HAVE_AIX_OS)
 #include <mntent.h>
 #elif defined(HAVE_SUN_OS)
 #include <sys/mnttab.h>
+#elif defined(HAVE_HURD_OS)
+#include <hurd/paths.h>
+#include <mntent.h>
 #endif /* HAVE_GETMNTENT */
 #elif defined(HAVE_GETMNTINFO)
 #if defined(HAVE_OPENBSD_OS)
@@ -181,7 +186,11 @@ static void refresh_mount_cache(void)
 #if defined(HAVE_GETMNTENT)
    FILE *fp;
    struct stat st;
-#if defined(HAVE_LINUX_OS) || defined(HAVE_HPUX_OS) || defined(HAVE_IRIX_OS) || defined(HAVE_AIX_OS)
+#if defined(HAVE_LINUX_OS) || \
+    defined(HAVE_HPUX_OS) || \
+    defined(HAVE_IRIX_OS) || \
+    defined(HAVE_AIX_OS) || \
+    defined(HAVE_HURD_OS)
    struct mntent *mnt;
 
 #if defined(HAVE_LINUX_OS)
@@ -202,6 +211,10 @@ static void refresh_mount_cache(void)
    if ((fp = setmntent(MNTTAB, "r")) == (FILE *)NULL) {
       return;
    }
+#elif defined(HAVE_HURD_OS)
+   if ((fp = setmntent(_PATH_MNTTAB, "r")) == (FILE *)NULL) {
+      return;
+   }
 #endif
 
    while ((mnt = getmntent(fp)) != (struct mntent *)NULL) {
index 1fc8c829cb66297545a78fc69bea880cf8f4be3c..78b1e6897eca357510fdc2a24930de880910f2bc 100644 (file)
 #define STREAM_ACL_FREEBSD_NFS4_ACL      1017    /* FreeBSD specific acl_t string representation
                                                   * from acl_to_text (NFSv4 or ZFS acl)
                                                   */
+#define STREAM_ACL_HURD_DEFAULT_ACL      1018    /* GNU HURD specific acl_t string representation
+                                                  * from acl_to_text (POSIX acl) for default acls.
+                                                  */
+#define STREAM_ACL_HURD_ACCESS_ACL       1019    /* GNU HURD specific acl_t string representation
+                                                  * from acl_to_text (POSIX acl) for access acls.
+                                                  */
+#define STREAM_XATTR_HURD                1989    /* GNU HURD specific extended attributes */
 #define STREAM_XATTR_IRIX                1990    /* IRIX specific extended attributes */
 #define STREAM_XATTR_TRU64               1991    /* TRU64 specific extended attributes */
 #define STREAM_XATTR_AIX                 1992    /* AIX specific extended attributes */