]> git.sur5r.net Git - bacula/bacula/commitdiff
Get osx files from master
authorKern Sibbald <kern@sibbald.com>
Fri, 16 Oct 2009 16:13:19 +0000 (18:13 +0200)
committerKern Sibbald <kern@sibbald.com>
Fri, 16 Oct 2009 16:13:19 +0000 (18:13 +0200)
bacula/autoconf/configure.in
bacula/configure
bacula/platforms/osx/Makefile.in [new file with mode: 0644]
bacula/platforms/osx/README [new file with mode: 0644]
bacula/platforms/osx/files/Info.plist.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/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]

index 886f4088b8a2ca9514c06bb501dcdd6eac09ad9e..61727585572c7e7395a9eac2eb61f3ca95377508 100644 (file)
@@ -2551,6 +2551,7 @@ PFILES="platforms/Makefile"
 PSCMD="ps -e"
 WIN32=
 MACOSX=
+
 hostname=`uname -n | cut -d '.' -f 1`
 if test x${hostname} = x ; then
    hostname="localhost"
@@ -2605,6 +2606,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)
    dnl Make sure hostname is resolved
    ping -c 1 $hostname 2>&1 1>/dev/null
index 4caae70a98bf7936c4d62497134544c84990d3fb..c6b311ffbd8f0a07066870884fade6b9e5bdb721 100755 (executable)
@@ -42559,6 +42559,7 @@ PFILES="platforms/Makefile"
 PSCMD="ps -e"
 WIN32=
 MACOSX=
+
 hostname=`uname -n | cut -d '.' -f 1`
 if test x${hostname} = x ; then
    hostname="localhost"
@@ -42613,6 +42614,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)
       ping -c 1 $hostname 2>&1 1>/dev/null
    if test ! $? = 0; then
diff --git a/bacula/platforms/osx/Makefile.in b/bacula/platforms/osx/Makefile.in
new file mode 100644 (file)
index 0000000..3c7256f
--- /dev/null
@@ -0,0 +1,139 @@
+#
+# 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
+
+# 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
+FAKEROOT:=/usr/local/bin/fakeroot
+
+########### you should not have to edit anything beyond this line ###########
+
+# Build paths
+DL_DIR:=dl
+BUILD_DIR:=build
+PRODUCTS_DIR:=products
+
+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}
+BACULA_FD_CONF:=/Library/Preferences/bacula/bacula-fd.conf
+BACULA_WORKING_DIR:=/private/var/bacula/working
+
+# 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 ReadMe.html postflight preupgrade
+PACKAGE_XRESOURCES:=postflight preupgrade
+
+# 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@ \
+    --with-working-dir=${BACULA_WORKING_DIR}
+CPPFLAGS:=-isysroot ${MACOSX_SDK_SYSROOT} ${MACOSX_VERSION_FLAGS}
+CFLAGS:=-O -g ${ARCHFLAGS}
+CXXFLAGS:=${CFLAGS}
+LDFLAGS:=${MACOSX_VERSION_FLAGS} ${ARCHFLAGS}
+
+# Placeholders for *.in files
+INFILE_SUBST=\
+  -e "s,@PREFIX@,${BACULA_PREFIX},g" \
+  -e "s,@BACULA_VERSION@,${BACULA_VERSION},g" \
+  -e "s,@FD_CONF@,${BACULA_FD_CONF},g"
+
+dmg: pkg
+       hdiutil create -srcfolder "${PACKAGE_DIR}" "${PACKAGE_DMG}"
+
+pkg: ${BACULA_DESTDIR} ${WORKING_DIR}/resources
+       mkdir -p "${PACKAGE_DIR}"
+
+       sed ${INFILE_SUBST} \
+               files/Info.plist.in > "${WORKING_DIR}/Info.plist";
+
+       ${FAKEROOT} ${PM} -build -ds -v -f "\"${BACULA_DESTDIR}\"" -p "\"${PACKAGE_BUNDLE}\"" \
+               -r "\"${WORKING_DIR}/resources\"" -i "\"${WORKING_DIR}/Info.plist\""
+
+       cp ${WORKING_DIR}/resources/ReadMe.html "${PACKAGE_DIR}/ReadMe.html"
+
+       sed ${INFILE_SUBST} \
+               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 ${INFILE_SUBST} \
+                       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 ${INFILE_SUBST} 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}"
+
+.PHONY: distclean
+distclean: clean
+       rm -rf "${DL_DIR}" "${PRODUCTS_DIR}"
+
+.PHONY: clean
+clean:
+       rm -rf "${BUILD_DIR}" "${PACKAGE_DIR}" "${PACKAGE_DMG}"
+
diff --git a/bacula/platforms/osx/README b/bacula/platforms/osx/README
new file mode 100644 (file)
index 0000000..6b2a33c
--- /dev/null
@@ -0,0 +1,68 @@
+Bacula file daemon package builder for Mac OS X
+===============================================
+
+This package build script lets you download, compile and package the bacula
+file daemon easily with a single command line. Beside the bacula file daemon
+the resulting installer package contains a short ReadMe file with instructions
+on how to install and use the software. Also a basic launchd property list is
+included along with preugrade and postflight installer scripts to stop and
+restart the daemon while upgrading. To ensure the security of the users the
+passwords in the configuration files are generated during a first time
+installation and file permissions are checked and corrected on upgrades.
+
+Requirements:
+* Mac OS X 10.4 or later
+* Mac OS X developer tools installed
+* fakeroot >= 1.13 (http://ftp.debian.org/debian/pool/main/f/fakeroot/)
+  The makefile expects the compiled binary at /usr/local/bin/fakeroot.
+
+Example (compile and create package from within bacula source tree):
+$ ./configure --enable-client-only
+$ make -C platforms/osx
+
+By moving the contents of platforms/osx to some other directory (e.g.
+~/bacula-standalone-bulder), it is possible to create installer packages from
+older bacula versions and for specific platforms.
+
+Examples (standalone mode):
+ 1. Create an installer package from the newest supported bacula source
+    containing the bacula file daemon as a PPC/Intel universal binary.
+    $ make dmg
+
+ 2. Create an installer package from a specified version of the bacula source
+    containing the bacula file daemon as a PPC/Intel universal binary.
+    $ make dmg BACULA_VERSION=3.0.0
+
+ 3. Create an installer package from the newest supported bacula source
+    containing the bacula file daemon for PPC architecture only.
+    $ make dmg ARCHFLAGS="-arch ppc" PACKAGE_TITLE="Bacula File Daemon PPC x.y.z"
+
+ 4. Create an installer package from a specified version of the bacula source
+    containing the bacula file daemon for the current architecture.
+    $ make dmg BACULA_VERSION=2.4.4 ARCHFLAGS=""
+
+You find the built disk images in the products folder.
+
+Misc commands:
+  1. Cleanup the build directory
+     $ make clean
+  2. Additionally remove the downloads and products:
+     $ make distclean
+
+Additional notes on the build-script:
+  * The following *FLAGS are used tu build universal binary with 10.4 SDK:
+    CPPFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
+    CFLAGS=-O -g -arch i386 -arch ppc
+    CXXFLAGS=${CFLAGS}
+    LDFLAGS=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 -arch ppc
+
+    Because the configure-scripts fails on 10.4 when -syslibroot is specified,
+    this option is supplied to make only.
+
+  * In order to build Mac OS X installer packages in a repeatable manner with
+    the correct owner/group and permissions, PackageMakers's cheap and broken
+    mechanism of applying recommended permissions is not used. Instead
+    Debian's fakeroot tool is used during package building phase to ensure
+    that the ownership of the files in the installer's Archive.pax.gz is set
+    to root and that permissions are kept exactly like "make install" set them
+    before.
diff --git a/bacula/platforms/osx/files/Info.plist.in b/bacula/platforms/osx/files/Info.plist.in
new file mode 100644 (file)
index 0000000..48402bf
--- /dev/null
@@ -0,0 +1,32 @@
+<?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>
+       <key>IFPkgFlagAllowBackRev</key>
+       <false/>
+       <key>IFPkgFlagAuthorizationAction</key>
+       <string>RootAuthorization</string>
+       <key>IFPkgFlagDefaultLocation</key>
+       <string>/</string>
+       <key>IFPkgFlagFollowLinks</key>
+       <true/>
+       <key>IFPkgFlagInstallFat</key>
+       <false/>
+       <key>IFPkgFlagIsRequired</key>
+       <false/>
+       <key>IFPkgFlagOverwritePermissions</key>
+       <false/>
+       <key>IFPkgFlagRelocatable</key>
+       <false/>
+       <key>IFPkgFlagRestartAction</key>
+       <string>None</string>
+       <key>IFPkgFlagRootVolumeOnly</key>
+       <false/>
+       <key>IFPkgFlagUpdateInstalledLanguages</key>
+       <false/>
+</dict>
+</plist>
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..1432d08
--- /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>@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/ReadMe.html.in b/bacula/platforms/osx/resources/ReadMe.html.in
new file mode 100644 (file)
index 0000000..41b396f
--- /dev/null
@@ -0,0 +1,62 @@
+<!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. The file is located in system-wide Preferences folder:
+    <pre>/Library/Preferences/bacula/bacula-fd.conf</pre>
+  </p>
+  <p>
+    <strong>Note:</strong> The configuration file contains passwords and
+    therefore must not be accessible for any users except root. Use the
+    following command line to edit the file as root-user:
+    <pre>sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /Library/Preferences/bacula/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..f0d18ef
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+function genpw() {
+  openssl rand -base64 33
+}
+
+# copy example config files and fix permissions
+if [ ! -f $3@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)
+  mkdir -p "$(dirname $3@FD_CONF@)"
+  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@FD_CONF@"
+fi
+chmod 0600 "$3@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
+