]> git.sur5r.net Git - bacula/bacula/commitdiff
Integrate patch for building dmg on OSX from Lorenz Schori <lo@znerol.ch>
authorLorenz Schori <lo@znerol.ch>
Fri, 21 Aug 2009 06:50:45 +0000 (08:50 +0200)
committerKern Sibbald <kern@sibbald.com>
Fri, 21 Aug 2009 06:50:45 +0000 (08:50 +0200)
13 files changed:
bacula/autoconf/bacula-macros/os.m4
bacula/autoconf/configure.in
bacula/configure
bacula/platforms/Makefile.in
bacula/platforms/osx/Makefile.in [new file with mode: 0644]
bacula/platforms/osx/files/org.bacula.bacula-fd.plist.in [new file with mode: 0644]
bacula/platforms/osx/files/uninstall.command.in [new file with mode: 0644]
bacula/platforms/osx/resources/Description.plist.in [new file with mode: 0644]
bacula/platforms/osx/resources/Info.plist.in [new file with mode: 0644]
bacula/platforms/osx/resources/ReadMe.html.in [new file with mode: 0644]
bacula/platforms/osx/resources/postflight.in [new file with mode: 0644]
bacula/platforms/osx/resources/preupgrade.in [new file with mode: 0644]
bacula/technotes

index 7fe1a6bf6da3e644a47cc38215bbf482910f03c3..7a3ce55d5a67c58d78b28b79e3d699cc9808e4b0 100644 (file)
@@ -207,6 +207,9 @@ then
 elif test -f /etc/slackware-version
 then
         DISTNAME=slackware
+elif test x$host_vendor = xapple
+then
+    DISTNAME=osx
 elif test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
 then
     DISTNAME=darwin
index 149f9e7c3eb4ef17ce59979a7082735e0546ad4d..fb074230d8e93fc12b07f0464c4bc1cbff7522f1 100644 (file)
@@ -2617,6 +2617,14 @@ darwin)
    PFILES="${PFILES} \
       platforms/darwin/Makefile"
   ;;
+osx)
+   DISTVER=`uname -r`
+   TAPEDRIVE="/dev/nst0"
+   PSCMD="ps -e -o pid,command"
+   MACOSX=macosx
+   PFILES="${PFILES} \
+      platforms/osx/Makefile"
+  ;;
 debian)
    if `test -f /etc/apt/sources.list && grep -q ubuntu /etc/apt/sources.list`; then
       DISTNAME="ubuntu"
index 25a0a85cc8b348d570f7a51e27cee085ec58db23..b711d9fc9682bb22a82bc7efd7bc4128d798b507 100755 (executable)
@@ -16408,6 +16408,9 @@ then
 elif test -f /etc/slackware-version
 then
         DISTNAME=slackware
+elif test x$host_vendor = xapple
+then
+    DISTNAME=osx
 elif test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
 then
     DISTNAME=darwin
@@ -42624,6 +42627,14 @@ darwin)
    PFILES="${PFILES} \
       platforms/darwin/Makefile"
   ;;
+osx)
+   DISTVER=`uname -r`
+   TAPEDRIVE="/dev/nst0"
+   PSCMD="ps -e -o pid,command"
+   MACOSX=macosx
+   PFILES="${PFILES} \
+      platforms/osx/Makefile"
+  ;;
 debian)
    if `test -f /etc/apt/sources.list && grep -q ubuntu /etc/apt/sources.list`; then
       DISTNAME="ubuntu"
index 1a7b89408bd0e92d4e01ec1036cf28b3a583c93d..79101b07fd9b31bf25e53ab48335bcf81d5953c9 100644 (file)
@@ -11,7 +11,7 @@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL = @INSTALL@
 
-SUBDIRS = freebsd redhat solaris unknown openbsd irix gentoo \
+SUBDIRS = freebsd redhat solaris unknown openbsd osx irix gentoo \
          debian darwin aix bsdi mandrake slackware alpha ubuntu
 
 MAKE = make
diff --git a/bacula/platforms/osx/Makefile.in b/bacula/platforms/osx/Makefile.in
new file mode 100644 (file)
index 0000000..cd483d7
--- /dev/null
@@ -0,0 +1,149 @@
+#
+# This is the makefile template for the platform directory
+# which contains general platform installation.
+#
+#  17 August 2009 -- Lorenz Schori
+# 
+#   for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+
+
+# bacula version and download site
+BACULA_VERSION:=@VERSION@
+BACULA_DL_URL:=http://downloads.sourceforge.net/project/bacula/bacula/${BACULA_VERSION}/bacula-${BACULA_VERSION}.tar.gz
+
+# fakeroot version and download site
+FAKEROOT_VERSION:=1.13
+FAKEROOT_DL_URL:=http://ftp.de.debian.org/debian/pool/main/f/fakeroot/fakeroot_${FAKEROOT_VERSION}.tar.gz
+
+# Build universal binary. Comment out when building versions of bacula < 3.0.0
+ARCHFLAGS:=-arch i386 -arch ppc
+MACOSX_SDK_SYSROOT:=/Developer/SDKs/MacOSX10.4u.sdk
+MACOSX_VERSION_FLAGS:=-mmacosx-version-min=10.4
+
+# Tools
+PM:=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
+MAKE:=/usr/bin/make
+CURL:=/usr/bin/curl
+TAR:=/usr/bin/tar
+
+########### you should not have to edit anything beyond this line ###########
+
+# Build paths
+DL_DIR:=dl
+BUILD_DIR:=build
+PRODUCTS_DIR:=products
+TOOLS_DIR:=tools
+
+WORKING_DIR:=${BUILD_DIR}/${BACULA_VERSION}
+BACULA_TAR:=${DL_DIR}/bacula-${BACULA_VERSION}.tar.gz
+BACULA_SOURCE:=${WORKING_DIR}/bacula-${BACULA_VERSION}
+BACULA_DESTDIR:=${WORKING_DIR}/destdir
+BACULA_PREFIX:=/usr/local/bacula-${BACULA_VERSION}
+
+# Detect whether we sit inside the bacula source tree. In this case we won't
+# download the tar from sourceforge but instead work with what its there
+# already
+CURSUB:=$(CURDIR:%/platforms/osx=%)
+ifneq ($(CURDIR),$(CURSUB))
+       BACULA_TAR:=
+       BACULA_SOURCE:=../../
+#      BACULA_VERSION:=$(shell sed -n 's,^VERSION=,,p' $(CURSUB)/autoconf/Make.common)
+endif
+
+PACKAGE_TITLE:=Bacula File Daemon ${BACULA_VERSION}
+PACKAGE_DIR:=${PRODUCTS_DIR}/${PACKAGE_TITLE}
+PACKAGE_BUNDLE:=${PACKAGE_DIR}/${PACKAGE_TITLE}.pkg
+PACKAGE_DMG:=${PRODUCTS_DIR}/${PACKAGE_TITLE}.dmg
+PACKAGE_RESOURCES:=Description.plist Info.plist ReadMe.html postflight preupgrade
+PACKAGE_XRESOURCES:=postflight preupgrade
+
+FAKEROOT_TAR:=${DL_DIR}/fakeroot-${FAKEROOT_VERSION}.tar.gz
+FAKEROOT_SOURCE:=${TOOLS_DIR}/fakeroot-${FAKEROOT_VERSION}
+FAKEROOT_DESTDIR:=${FAKEROOT_SOURCE}/destdir
+FAKEROOT:=${FAKEROOT_DESTDIR}/bin/fakeroot
+
+# Flags for the toolchain
+CONFIGFLAGS:=--enable-client-only --prefix=${BACULA_PREFIX} \
+    --with-dir-password=@DIR_PW@ --with-fd-password=@FD_PW@ \
+    --with-sd-password=@SD_PW@ --with-mon-dir-password=@MON_DIR_PW@ \
+    --with-mon-fd-password=@MON_FD_PW@ --with-mon-sd-password=@MON_SD_PW@ \
+    --with-basename=@BASENAME@ --with-hostname=@HOSTNAME@
+CPPFLAGS:=-isysroot ${MACOSX_SDK_SYSROOT} ${MACOSX_VERSION_FLAGS}
+CFLAGS:=-O -g ${ARCHFLAGS}
+CXXFLAGS:=${CFLAGS}
+LDFLAGS:=${MACOSX_VERSION_FLAGS} ${ARCHFLAGS}
+
+dmg: pkg
+       hdiutil create -srcfolder "${PACKAGE_DIR}" "${PACKAGE_DMG}"
+
+pkg: ${BACULA_DESTDIR} ${WORKING_DIR}/resources ${FAKEROOT_DESTDIR}
+       mkdir -p "${PACKAGE_DIR}"
+
+       ${FAKEROOT} ${PM} -build -ds -v -f "\"${BACULA_DESTDIR}\"" -p "\"${PACKAGE_BUNDLE}\"" \
+               -r "\"${WORKING_DIR}/resources\"" -i "\"${WORKING_DIR}/resources/Info.plist\""
+
+       cp ${WORKING_DIR}/resources/ReadMe.html "${PACKAGE_DIR}/ReadMe.html"
+
+       sed -e "s,@PREFIX@,${BACULA_PREFIX},g" -e "s,@BACULA_VERSION@,${BACULA_VERSION},g" \
+               files/uninstall.command.in > "${PACKAGE_DIR}/uninstall.command";
+       chmod 0775 "${PACKAGE_DIR}/uninstall.command"
+
+${WORKING_DIR}/resources: ${BACULA_DESTDIR}
+       mkdir -p "${WORKING_DIR}/resources"
+
+       for res in ${PACKAGE_RESOURCES}; do \
+               sed -e "s,@PREFIX@,${BACULA_PREFIX},g" -e "s,@BACULA_VERSION@,${BACULA_VERSION},g" \
+                       resources/$$res.in > "${WORKING_DIR}/resources/$$res"; \
+       done
+
+       for xres in ${PACKAGE_XRESOURCES}; do \
+               chmod +x "${WORKING_DIR}/resources/$$xres"; \
+       done
+
+       cp "${BACULA_SOURCE}/LICENSE" "${WORKING_DIR}/resources/License.txt"
+
+${BACULA_DESTDIR}: ${BACULA_SOURCE}
+       (cd ${BACULA_SOURCE} && ./configure ${CONFIGFLAGS} CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}")
+       ${MAKE} -C ${BACULA_SOURCE} LDFLAGS="-Wl,-syslibroot,${MACOSX_SDK_SYSROOT} ${LDFLAGS}"
+       ${MAKE} -C ${BACULA_SOURCE} install DESTDIR="${CURDIR}/${BACULA_DESTDIR}"
+
+       rm -rf "${BACULA_DESTDIR}/tmp"
+
+       for conffile in ${BACULA_DESTDIR}${BACULA_PREFIX}/etc/*.conf; do \
+               mv $$conffile $$conffile.example; \
+       done
+
+       mkdir -p "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons"
+       sed "s,@PREFIX@,${BACULA_PREFIX},g" files/org.bacula.bacula-fd.plist.in \
+               > "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons/org.bacula.bacula-fd.plist"
+
+${BACULA_SOURCE}: ${BACULA_TAR}
+       mkdir -p "${WORKING_DIR}"
+       ${TAR} -xzf "${BACULA_TAR}" -C "${WORKING_DIR}"
+
+${BACULA_TAR}:
+       mkdir -p "${DL_DIR}"
+       ${CURL} -L -o "${BACULA_TAR}" "${BACULA_DL_URL}"
+
+${FAKEROOT_DESTDIR}: ${FAKEROOT_SOURCE}
+       (cd ${FAKEROOT_SOURCE} && ./configure --prefix=${CURDIR}/${FAKEROOT_DESTDIR})
+       ${MAKE} -C ${FAKEROOT_SOURCE}
+       ${MAKE} -C ${FAKEROOT_SOURCE} install
+
+${FAKEROOT_SOURCE}: ${FAKEROOT_TAR}
+       mkdir -p "${TOOLS_DIR}"
+       ${TAR} -xzf "${FAKEROOT_TAR}" -C "${TOOLS_DIR}"
+
+${FAKEROOT_TAR}:
+       mkdir -p "${DL_DIR}"
+       ${CURL} -L -o "${FAKEROOT_TAR}" "${FAKEROOT_DL_URL}"
+
+.PHONY: distclean
+distclean: clean
+       rm -rf "${DL_DIR}" "${PRODUCTS_DIR}" "${TOOLS_DIR}"
+
+.PHONY: clean
+clean:
+       rm -rf "${BUILD_DIR}" "${PACKAGE_DIR}" "${PACKAGE_DMG}"
+
diff --git a/bacula/platforms/osx/files/org.bacula.bacula-fd.plist.in b/bacula/platforms/osx/files/org.bacula.bacula-fd.plist.in
new file mode 100644 (file)
index 0000000..9952c40
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>Label</key>
+       <string>org.bacula.bacula-fd</string>
+       <key>ProgramArguments</key>
+       <array>
+               <string>@PREFIX@/sbin/bacula-fd</string>
+               <string>-f</string>
+               <string>-c</string>
+               <string>@PREFIX@/etc/bacula-fd.conf</string>
+       </array>
+       <key>Sockets</key>
+       <dict>
+               <key>Listeners</key>
+               <array>
+                       <dict>
+                               <key>SockServiceName</key>
+                               <string>bacula-fd</string>
+                       </dict>
+               </array>
+       </dict>
+</dict>
+</plist>
diff --git a/bacula/platforms/osx/files/uninstall.command.in b/bacula/platforms/osx/files/uninstall.command.in
new file mode 100644 (file)
index 0000000..90b1efa
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+echo "Bacula file daemon @BACULA_VERSION@ uninstaller"
+
+# Remove startup item
+echo "* Bacula startup item... "
+if [ -f /Library/LaunchDaemons/org.bacula.bacula-fd.plist ]; then
+       sudo launchctl unload /Library/LaunchDaemons/org.bacula.bacula-fd.plist
+       sudo rm /Library/LaunchDaemons/org.bacula.bacula-fd.plist
+       echo "  + removed successfully"
+else
+  echo "  - not found, nothing to remove"
+fi
+
+echo "* Bacula file daemon... "
+if [ -d "/usr/local/bacula-@BACULA_VERSION@" ]; then
+  sudo rm -r "/usr/local/bacula-@BACULA_VERSION@"
+       echo "  + removed successfully"
+else
+  echo "  - not found, nothing to remove"  
+fi
+
+echo "* Installer receipt... "
+if [ -d "/Library/Receipts/Bacula File Daemon @BACULA_VERSION@.pkg" ]; then
+  sudo rm -r "/Library/Receipts/Bacula File Daemon @BACULA_VERSION@.pkg"
+       echo "  + removed successfully"
+else
+  echo "  - not found, nothing to remove"  
+fi
diff --git a/bacula/platforms/osx/resources/Description.plist.in b/bacula/platforms/osx/resources/Description.plist.in
new file mode 100644 (file)
index 0000000..976546e
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>IFPkgDescriptionDescription</key>
+       <string></string>
+       <key>IFPkgDescriptionTitle</key>
+       <string>Bacula File Daemon @BACULA_VERSION@</string>
+</dict>
+</plist>
diff --git a/bacula/platforms/osx/resources/Info.plist.in b/bacula/platforms/osx/resources/Info.plist.in
new file mode 100644 (file)
index 0000000..9d1cd1c
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleIdentifier</key>
+       <string>org.bacula.bacula-fd</string>
+       <key>CFBundleShortVersionString</key>
+       <string>@BACULA_VERSION@</string>
+</dict>
+</plist>
diff --git a/bacula/platforms/osx/resources/ReadMe.html.in b/bacula/platforms/osx/resources/ReadMe.html.in
new file mode 100644 (file)
index 0000000..22914c8
--- /dev/null
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+   "http://www.w3.org/TR/html4/strict.dtd">
+
+<html lang="en">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Bacula File Daemon @BACULA_VERSION@</title>
+  <meta name="author" content="Lorenz Schori">
+  <style type="text/css" media="screen">
+    body {font-family: Helvetica, sans-serif}
+  </style>
+  <!-- Date: 2009-08-12 -->
+</head>
+<body>
+  <h1>Bacula File Daemon @BACULA_VERSION@</h1>
+  <p>
+    Bacula is on Open Source, enterprise ready, network based backup program.
+    This installer package contains the bacula file daemon for Mac OS X 10.4
+    or later built as an universal binary for PPC and Intel processors.
+  </p>
+  <h2>Requirements</h2>
+  <p>
+    The bacula file daemon is only the client component of the backup system.
+    For proper operation the file daemon needs to have access to a bacula
+    director and storage daemon, typically installed on a server machine in
+    the local network.
+  </p>
+  <h2>Installation</h2>
+  <p>
+    Open the Bacula File Daemon @BACULA_VERSION@ installer package and follow the
+    directions given to you.
+  </p>
+  <h2>Configuration</h2>
+  <p>
+    After the installation is complete you have to adapt the configuration
+    file to your needs. Use your favorite command line editor and don't forget
+    to become root before you try to open the file. E.g:
+    <pre>sudo vim /usr/local/bacula-@BACULA_VERSION@/etc/bacula-fd.conf</pre>
+  </p>
+  <h2>Operating the File Daemon</h2>
+  <p>
+    Use launchctl to enable and disable the bacula file daemon.
+    <pre>sudo launchctl load -w /Library/LaunchDaemons/org.bacula.bacula-fd.plist</pre></br>
+    <pre>sudo launchctl unload -w /Library/LaunchDaemons/org.bacula.bacula-fd.plist</pre></br>
+  </p>
+  <h2>Uninstalling the File Daemon</h2>
+  <p>
+    Doubleclick the script uninstaller.command to remove the bacula file
+    daemon completely from your system.
+  </p>
+  <h2>Resources</h2>
+  <p>
+    Refer to the bacula website for more information.
+  </p>
+  <a href="http://bacula.org/">http://bacula.org</a>
+</body>
+</html>
diff --git a/bacula/platforms/osx/resources/postflight.in b/bacula/platforms/osx/resources/postflight.in
new file mode 100644 (file)
index 0000000..d0e4bee
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+function genpw() {
+  openssl rand -base64 33
+}
+
+# copy example config files and fix permissions
+if [ ! -f $3@PREFIX@/etc/bacula-fd.conf ]; then
+  DIR_PW=$(genpw)
+  FD_PW=$(genpw)
+  SD_PW=$(genpw)
+  MON_DIR_PW=$(genpw)
+  MON_FD_PW=$(genpw)
+  MON_SD_PW=$(genpw)
+  HOSTNAME=$(hostname -s)
+  sed \
+    -e "s,@DIR_PW@,$DIR_PW,g" \
+    -e "s,@FD_PW@,$FD_PW,g" \
+    -e "s,@SD_PW@,$SD_PW,g" \
+    -e "s,@MON_DIR_PW@,$MON_DIR_PW,g" \
+    -e "s,@MON_FD_PW@,$MON_FD_PW,g" \
+    -e "s,@MON_SD_PW@,$MON_SD_PW,g" \
+    -e "s,@BASENAME@,$HOSTNAME,g" \
+    -e "s,@HOSTNAME@,$HOSTNAME,g" \
+    "$3@PREFIX@/etc/bacula-fd.conf.example" > "$3@PREFIX@/etc/bacula-fd.conf"
+fi
+chmod 0640 "$3@PREFIX@/etc/bacula-fd.conf"
+
+# install startup item
+mkdir -p -m 0755 "$3/Library/LaunchDaemons"
+chmod 0644 "$3@PREFIX@/Library/LaunchDaemons/org.bacula.bacula-fd.plist"
+ln -fs "$3@PREFIX@/Library/LaunchDaemons/org.bacula.bacula-fd.plist" "$3/Library/LaunchDaemons/org.bacula.bacula-fd.plist"
+
+# Load startup item
+/bin/launchctl load "$3/Library/LaunchDaemons/org.bacula.bacula-fd.plist"
diff --git a/bacula/platforms/osx/resources/preupgrade.in b/bacula/platforms/osx/resources/preupgrade.in
new file mode 100644 (file)
index 0000000..99f8d30
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+# unload bacula file daemon before upgrading
+
+if [ -f "$3/Library/LaunchDaemons/org.bacula.bacula-fd.plist" ]; then
+  /bin/launchctl unload "$3/Library/LaunchDaemons/org.bacula.bacula-fd.plist"
+fi
+
index 246115310baa6fd741e04a04232fd94da6a7542c..047d39520b850a4e49814c0c140dc3f299b22415 100644 (file)
@@ -3,6 +3,7 @@
 General:
 
 21Aug09
+kes  Integrate patch for building dmg on OSX from Lorenz Schori <lo@znerol.ch>
 kes  Add commas in num files for estimate command
 19Aug09
 kes  Fix bat crash due to alignment diff in bat and core code