]> git.sur5r.net Git - bacula/bacula/commitdiff
Apply Lorenz' OSX patch
authorLorenz Schori <lo@znerol.ch>
Mon, 24 Aug 2009 16:29:27 +0000 (18:29 +0200)
committerKern Sibbald <kern@sibbald.com>
Mon, 24 Aug 2009 16:29:27 +0000 (18:29 +0200)
bacula/.gitignore
bacula/platforms/osx/Makefile.in
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
bacula/platforms/osx/resources/Info.plist.in [deleted file]
bacula/platforms/osx/resources/ReadMe.html.in
bacula/platforms/osx/resources/postflight.in

index 5d0f544b58ccfef7183762f387926a9fceb36bec..1a4780920198d6c450735ef0febef6641fb5ddd6 100644 (file)
@@ -1329,3 +1329,7 @@ updatedb/update_sqlite_tables_9_to_10
 /rescue/solaris/1
 /rescue/solaris/bacula-fd
 /rescue/solaris/bacula-fd.conf
+platforms/osx/build
+platforms/osx/dl
+platforms/osx/products
+platforms/osx/tools
index cd483d7ee67cc0374a784caea5bb65830c86b71b..8be1b78fb6ffc42af6eb38efcc7f631c12820fc0 100644 (file)
@@ -40,6 +40,7 @@ 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
 
 # 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
@@ -55,7 +56,7 @@ 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_RESOURCES:=Description.plist ReadMe.html postflight preupgrade
 PACKAGE_XRESOURCES:=postflight preupgrade
 
 FAKEROOT_TAR:=${DL_DIR}/fakeroot-${FAKEROOT_VERSION}.tar.gz
@@ -74,18 +75,27 @@ 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 ${FAKEROOT_DESTDIR}
        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}/resources/Info.plist\""
+               -r "\"${WORKING_DIR}/resources\"" -i "\"${WORKING_DIR}/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" \
+       sed ${INFILE_SUBST} \
                files/uninstall.command.in > "${PACKAGE_DIR}/uninstall.command";
        chmod 0775 "${PACKAGE_DIR}/uninstall.command"
 
@@ -93,7 +103,7 @@ ${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" \
+               sed ${INFILE_SUBST} \
                        resources/$$res.in > "${WORKING_DIR}/resources/$$res"; \
        done
 
@@ -115,7 +125,7 @@ ${BACULA_DESTDIR}: ${BACULA_SOURCE}
        done
 
        mkdir -p "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons"
-       sed "s,@PREFIX@,${BACULA_PREFIX},g" files/org.bacula.bacula-fd.plist.in \
+       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}
diff --git a/bacula/platforms/osx/README b/bacula/platforms/osx/README
new file mode 100644 (file)
index 0000000..a5ffaaf
--- /dev/null
@@ -0,0 +1,66 @@
+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
+
+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 gets built and used during the packaging process 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..142da56
--- /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>@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>
index 9952c4021610b97fe45f52b3bcd3d32e9302d518..1432d081565d9fdf578bfd5e85cf6b1289a92683 100644 (file)
@@ -9,7 +9,7 @@
                <string>@PREFIX@/sbin/bacula-fd</string>
                <string>-f</string>
                <string>-c</string>
-               <string>@PREFIX@/etc/bacula-fd.conf</string>
+               <string>@FD_CONF@</string>
        </array>
        <key>Sockets</key>
        <dict>
diff --git a/bacula/platforms/osx/resources/Info.plist.in b/bacula/platforms/osx/resources/Info.plist.in
deleted file mode 100644 (file)
index 9d1cd1c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?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>
index 22914c8dea208a894ada3f42e3bcd9876fb58a73..41b396fe93d42345683080f3347c3baf7ab4df7e 100644 (file)
   </p>
   <h2>Installation</h2>
   <p>
-    Open the Bacula File Daemon @BACULA_VERSION@ installer package and follow the
-    directions given to you.
+    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>
+    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>
index d0e4bee93f312983ce4690930b1cbd499ec03815..f0d18ef27ff4bab9b7c95931cbdaa33ff55212c8 100644 (file)
@@ -5,7 +5,7 @@ function genpw() {
 }
 
 # copy example config files and fix permissions
-if [ ! -f $3@PREFIX@/etc/bacula-fd.conf ]; then
+if [ ! -f $3@FD_CONF@ ]; then
   DIR_PW=$(genpw)
   FD_PW=$(genpw)
   SD_PW=$(genpw)
@@ -13,6 +13,7 @@ if [ ! -f $3@PREFIX@/etc/bacula-fd.conf ]; then
   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" \
@@ -22,9 +23,9 @@ if [ ! -f $3@PREFIX@/etc/bacula-fd.conf ]; then
     -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"
+    "$3@PREFIX@/etc/bacula-fd.conf.example" > "$3@FD_CONF@"
 fi
-chmod 0640 "$3@PREFIX@/etc/bacula-fd.conf"
+chmod 0600 "$3@FD_CONF@"
 
 # install startup item
 mkdir -p -m 0755 "$3/Library/LaunchDaemons"