Commit c64fa359 authored by Eric Bollengier's avatar Eric Bollengier
Browse files

Rework MacOS package

parent 80b57bca
......@@ -3604,8 +3604,6 @@ osx)
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
......
......@@ -6,14 +6,24 @@
# which contains general platform installation.
#
# 17 August 2009 -- Lorenz Schori
# 29 Jun 2022 -- Eric Bollengier
#
# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
# for Bacula
#
# 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
BACULA_VERSION ?= $(shell ../../scripts/getver ../../src/version.h)
SWIFT_APP_GIT ?= git@bsweb:macosx
SWIFT_APP_BRANCH ?= master
OPENSSL_VERSION_BASE ?= 1.1.1
OPENSSL_VERSION=$(shell curl https://www.openssl.org/source/ 2>/dev/null| perl -ne '/openssl-(${OPENSSL_VERSION_BASE}[a-z]+).tar.gz/ && print $$1')
OPENSSL_DL_URL:=https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
LZO_VERSION=2.10
LZO_DL_URL=https://www.oberhumer.com/opensource/lzo/download/lzo-${LZO_VERSION}.tar.gz
# Build universal binary. Comment out when building versions of bacula < 3.0.0
ARCHFLAGS:=
......@@ -33,11 +43,23 @@ DL_DIR:=dl
BUILD_DIR:=build
PRODUCTS_DIR:=products
WORKING_DIR:=${BUILD_DIR}/${BACULA_VERSION}
# Can source ~/config to have all it set
# To unlock the security, use security unlock
# "Developer ID Application: Bacula YYYY (XXX)"
BIN_KEY ?= "Must specify BIN_KEY='Developer ID Application: Bacula YYYY (XXX)'"
# "Developer ID Installer: Bacula YYYY (XXXX)"
PRODUCT_KEY ?= "Must specify PRODUCT_KEY='Developer ID Installer: Bacula YYYY (XXXX)'"
APPLEID_USER ?= "Must specify APPLEID_USER='test@bacula.org'"
APPLEID_APP_PASS ?= "Must specify APPLEID_APP_PASS='xxx'"
WORKING_DIR:=${BUILD_DIR}
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_PREFIX:=/Applications/Bacula.app/Contents/Resources/BaculaBin
BACULA_FD_CONF:=/Library/Preferences/bacula/bacula-fd.conf
BACULA_WORKING_DIR:=/private/var/bacula/working
BACULA_PMDOC:=${WORKING_DIR}/installer.pmdoc
......@@ -49,11 +71,13 @@ 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_ID:=org.bacula.bacula-fd.pkg
NOW=$(shell date +%d%h%y-%H%M)
PACKAGE_TITLE:=bacula-client-${BACULA_VERSION}-${NOW}
PACKAGE_BASE:=org.bacula
PACKAGE_ID:=${PACKAGE_BASE}.bacula-fd.pkg
PACKAGE_DIR:=${PRODUCTS_DIR}/${PACKAGE_TITLE}
PACKAGE_BUNDLE:=${PACKAGE_DIR}/${PACKAGE_TITLE}.pkg
PACKAGE_DMG:=${PRODUCTS_DIR}/${PACKAGE_TITLE}.dmg
......@@ -72,7 +96,10 @@ CONFIGFLAGS:= \
--with-mon-sd-password=@MON_SD_PW@ \
--with-basename=@BASENAME@ \
--with-hostname=@HOSTNAME@ \
--with-working-dir=${BACULA_WORKING_DIR}
--with-working-dir=@CONTAINER_PATH@ \
--with-pid-dir=@CONTAINER_PATH@ \
--with-openssl=${PWD}/openssl \
--with-lzo=${PWD}/lzo
CPPFLAGS:=
CFLAGS:=-O -g
CXXFLAGS:=${CFLAGS}
......@@ -87,40 +114,52 @@ CXXPP:=cpp
# Placeholders for *.in files
INFILE_SUBST=\
-e "s,@PACKAGE_BASE@,${PACKAGE_BASE},g" \
-e "s,@PREFIX@,${BACULA_PREFIX},g" \
-e "s,@BACULA_VERSION@,${BACULA_VERSION},g" \
-e "s,@FD_CONF@,${BACULA_FD_CONF},g" \
-e "s,@BACULA_DESTDIR@,${BACULA_DESTDIR},g" \
-e "s,@PACKAGE_ID@,${PACKAGE_ID},g"
dmg: pkg
hdiutil create -srcfolder "${PACKAGE_DIR}" "${PACKAGE_DMG}"
all: sign-fd ${PACKAGE_TITLE}.pkg notarize-pkg
pkg: ${BACULA_DESTDIR} ${BACULA_PMDOC} ${WORKING_DIR}/resources
mkdir -p "${PACKAGE_DIR}"
clean-fd:
rm -rf ${CURDIR}/${BACULA_DESTDIR}
mkdir -p "${CURDIR}/${BACULA_DESTDIR}${WORKING_DIR}"
install-fd: clean-fd build-fd
${MAKE} -C ${BACULA_SOURCE} install DESTDIR="${CURDIR}/${BACULA_DESTDIR}"
${MAKE} -C ${BACULA_SOURCE}/src/tools install-bsnapshot DESTDIR="${CURDIR}/${BACULA_DESTDIR}"
cp lzo/lib/*.dylib ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/lib
cp lzo/share/doc/lzo/COPYING ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/share/doc/COPYING.lzo
cp openssl/lib/*.dylib ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/lib
cp -r openssl/lib/engines* ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/lib
cp -r openssl/ssl ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/
cp -r openssl/bin/* ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/sbin/
cp -r openssl/bin/* ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/sbin/
chmod 755 ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/sbin/*
chmod 644 ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/lib/*.dylib
chmod 755 ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/etc
rm -rf "${BACULA_DESTDIR}/tmp"
rm -rf "${BACULA_DESTDIR}/opt"
rm -rf "${BACULA_DESTDIR}/private"
rm -rf "${BACULA_DESTDIR}/usr"
${PB} --identifier "${PACKAGE_ID}" --root "${CURDIR}/${BACULA_DESTDIR}" "${PACKAGE_TITLE}.pkg"
for conffile in ${BACULA_DESTDIR}${BACULA_PREFIX}/etc/*.conf; do \
mv $$conffile $$conffile.example; \
done
cp "${PACKAGE_TITLE}.pkg" "${PACKAGE_DIR}"
cp ${WORKING_DIR}/resources/ReadMe.html "${PACKAGE_DIR}/ReadMe.html"
chmod 644 ${CURDIR}/${BACULA_DESTDIR}/${BACULA_PREFIX}/etc/*.example
sed ${INFILE_SUBST} \
files/uninstall.command.in > "${PACKAGE_DIR}/uninstall.command";
chmod 0775 "${PACKAGE_DIR}/uninstall.command"
mkdir -p "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons"
sed ${INFILE_SUBST} files/bacula-fd.plist.in \
> "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons/${PACKAGE_BASE}.bacula-fd.plist"
${BACULA_PMDOC}: ${BACULA_DESTDIR} ${WORKING_DIR}/resources
mkdir -p "${BACULA_PMDOC}"
for f in index.xml 01destdir.xml; do \
sed ${INFILE_SUBST} \
files/installer.pmdoc.in/$$f > "${BACULA_PMDOC}/$$f"; \
done
python installer-gencontents.py ${BACULA_DESTDIR} > ${BACULA_PMDOC}/01destdir-contents.xml
${WORKING_DIR}/resources: ${BACULA_DESTDIR}
mkdir -p "${WORKING_DIR}/resources"
for res in ${PACKAGE_RESOURCES}; do \
......@@ -134,35 +173,95 @@ ${WORKING_DIR}/resources: ${BACULA_DESTDIR}
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}" CC="${CC}" CPP="${CPP}" CXX="${CXX}" CXXPP="${CXXPP}")
${MAKE} -C ${BACULA_SOURCE}
${MAKE} -C ${BACULA_SOURCE} install DESTDIR="${CURDIR}/${BACULA_DESTDIR}"
${MAKE} -C ${BACULA_SOURCE}/src/tools bsnapshot
${MAKE} -C ${BACULA_SOURCE}/src/tools install-bsnapshot DESTDIR="${CURDIR}/${BACULA_DESTDIR}"
rm -rf "${BACULA_DESTDIR}/tmp"
dmg: pkg
rm -rf "${PACKAGE_DIR}"
mkdir -p "${PACKAGE_DIR}"
cp ${PACKAGE_TITLE}.pkg "${PACKAGE_DIR}"
cp ${WORKING_DIR}/resources/ReadMe.html "${PACKAGE_DIR}/ReadMe.html"
for conffile in ${BACULA_DESTDIR}${BACULA_PREFIX}/etc/*.conf; do \
mv $$conffile $$conffile.example; \
sed ${INFILE_SUBST} \
files/uninstall.command.in > "${PACKAGE_DIR}/uninstall.command";
chmod 0775 "${PACKAGE_DIR}/uninstall.command"
hdiutil create -srcfolder "${PACKAGE_DIR}" "${PACKAGE_DMG}"
pkg: setup-pkg sign-pkg notarize-pkg
notarize-pkg: ${PACKAGE_TITLE}.pkg
@echo "Sending the notarize request to Apple"
xcrun altool --notarize-app --file $< --username $(APPLEID_USER) --password $(APPLEID_APP_PASS) --primary-bundle-id "${PACKAGE_BASE}.pkg" > 1
@cat 1
./wait-notarize 1
${PACKAGE_TITLE}.unsigned.pkg:
${PB} --identifier "${PACKAGE_ID}" --version ${BACULA_VERSION} --install-location /Applications --root "${BACULA_DESTDIR}/Applications" ${PACKAGE_TITLE}.unsigned.pkg
sign-pkg: ${PACKAGE_TITLE}.pkg
${PACKAGE_TITLE}.pkg: ${PACKAGE_TITLE}.unsigned.pkg
productsign --sign "$(PRODUCT_KEY)" ${PACKAGE_TITLE}.unsigned.pkg ${PACKAGE_TITLE}.pkg
rm ${PACKAGE_TITLE}.unsigned.pkg
echo ${PACKAGE_TITLE}.pkg
sign-fd: install-fd
for binfile in ${BACULA_DESTDIR}${BACULA_PREFIX}/sbin/* ${BACULA_DESTDIR}${BACULA_PREFIX}/lib/*dylib ${BACULA_DESTDIR}${BACULA_PREFIX}/lib/*/*dylib ${BACULA_DESTDIR}${BACULA_PREFIX}/lib/*.so ; do \
./update-libs ${BACULA_PREFIX} $$binfile ;\
codesign -v --force --timestamp --options=runtime --sign "$(BIN_KEY)" $$binfile; \
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"
build-fd: configure-fd
make -C ${BACULA_SOURCE}
configure-fd: openssl lzo ${BACULA_SOURCE}/configure
(cd ${BACULA_SOURCE} && ./configure ${CONFIGFLAGS} CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" CC="${CC}" CPP="${CPP}" CXX="${CXX}" CXXPP="${CXXPP}")
grep " TLS support:" ${BACULA_SOURCE}/config.out | grep yes
grep "Encryption support:" ${BACULA_SOURCE}/config.out | grep yes
touch $@
lzo-${LZO_VERSION}.tar.gz:
@echo "Download LZO ${LZO_VERSION}"
${CURL} --output $@ ${LZO_DL_URL}
lzo-${LZO_VERSION}: lzo-${LZO_VERSION}.tar.gz
tar xfz $<
${BACULA_SOURCE}: ${BACULA_TAR}
mkdir -p "${WORKING_DIR}"
${TAR} -xzf "${BACULA_TAR}" -C "${WORKING_DIR}"
lzo: lzo-${LZO_VERSION} lzo-${LZO_VERSION}/Makefile
rm -rf lzo
make -j3 -C lzo-${LZO_VERSION}
make -j3 -C lzo-${LZO_VERSION} install
${BACULA_TAR}:
mkdir -p "${DL_DIR}"
${CURL} -L -o "${BACULA_TAR}" "${BACULA_DL_URL}"
lzo-${LZO_VERSION}/Makefile:
(cd lzo-${LZO_VERSION} && ./configure --prefix=${PWD}/lzo --enable-shared)
openssl-${OPENSSL_VERSION}.tar.gz:
@echo "Download ${OPENSSL_VERSION}"
${CURL} --output $@ ${OPENSSL_DL_URL}
openssl-${OPENSSL_VERSION}: openssl-${OPENSSL_VERSION}.tar.gz
tar xfz $<
openssl: openssl-${OPENSSL_VERSION} openssl-${OPENSSL_VERSION}/Makefile
rm -rf openssl
make -j4 -C openssl-${OPENSSL_VERSION}
make -j4 -C openssl-${OPENSSL_VERSION} install
openssl-${OPENSSL_VERSION}/Makefile:
(cd openssl-${OPENSSL_VERSION} && ./config --prefix=${PWD}/openssl)
################################################################
unlock:
security unlock
.PHONY: distclean
distclean: clean
rm -rf "${DL_DIR}" "${PRODUCTS_DIR}"
rm -rf build
make -C ../../ distclean
.PHONY: clean
.PHONY: clean cleanup
clean:
rm -rf "${BUILD_DIR}" "${PACKAGE_DIR}" "${PACKAGE_DMG}"
rm -rf *.pkg *.dmg 1 products sign-pkg pkg check-pkg setup-swift-app configure-fd pkg Applications
cleanup:
make -C ../../ clean
<?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>@PACKAGE_BASE@.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>RunAtLoad</key>
<true/>
</dict>
</plist>
......@@ -53,4 +53,4 @@ def generateContentsDocument(path):
if __name__ == "__main__":
# construct document
doc = generateContentsDocument(sys.argv[1])
print doc.toprettyxml(indent=" "),
print (doc.toprettyxml(indent=" "),)
......@@ -14,9 +14,9 @@
<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.
Bacula is an Open Source, enterprise ready, network based backup program.
This installer package contains the Bacula Enterprise File daemon for Mac OS X 12
or later built as an universal binary for M1 and Intel processors.
</p>
<h2>Requirements</h2>
<p>
......@@ -25,10 +25,17 @@
director and storage daemon, typically installed on a server machine in
the local network.
</p>
<h3>OpenSSL support</h3>
<p>
Please note that this package have been built with OpenSSL support enabled.
</p>
<h2>Installation</h2>
<p>
Open the Bacula File Daemon @BACULA_VERSION@ installer package and follow
the directions given to you.
the directions given to you. The application can be installed only in /Applications.
At the first startup, the Bacula.app will configure the system to start the application
automatically at login by creating a file on ~/Library/LaunchAgents/bacula-fd.plist
</p>
<h2>Configuration</h2>
<p>
......
#!/bin/sh
# Update path to libraries, probably done by libtool but not working here
dest=$1
file=$2
otool -L $file | awk '/Users/ { print $1 }' | while read fname
do
f=`basename $fname`
install_name_tool -change $fname $dest/lib/$f $file
done
#!/bin/sh
output=$1
uuid=`awk -F= '/RequestUUID/ { print $2 }' $output`
while xcrun altool --notarization-info $uuid --username $APPLEID_USER --password $APPLEID_APP_PASS | grep "in progress"
do
sleep 15
done
xcrun altool --notarization-info $uuid --username $APPLEID_USER --password $APPLEID_APP_PASS | tee wait-notarize.out
grep "Package Approved" wait-notarize.out
ret=$?
rm -f wait-notarize.out
exit $ret
#!/bin/sh
versionh=$1
if [ ! -f "$1" ]; then
echo "Usage: $0 version.h" >&2
exit 1
fi
sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' $versionh
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment