Skip to content

Commit

Permalink
Fixes Mac Os X build
Browse files Browse the repository at this point in the history
  • Loading branch information
Aron Schüler authored and joergsteffens committed Sep 18, 2017
1 parent 24fdf26 commit 35b2fc0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 32 deletions.
5 changes: 2 additions & 3 deletions platforms/osx/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ BAREOS_TAR:=${DL_DIR}/bareos-${BAREOS_VERSION}.tar.gz
BAREOS_SOURCE:=${WORKING_DIR}/bareos-${BAREOS_VERSION}
BAREOS_DESTDIR:=${WORKING_DIR}/destdir
BAREOS_PREFIX:=/usr/local
BAREOS_FD_CONF:=${BAREOS_PREFIX}/etc/bareos/bareos-fd.conf
BAREOS_WORKING_DIR:=/var/run/bareos/working
#BAREOS_PMDOC:=${WORKING_DIR}/installer.pmdoc

Expand All @@ -63,7 +62,8 @@ CONFIGFLAGS:=--enable-client-only --prefix=${BAREOS_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-basename="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
--with-hostname="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
--with-working-dir=${BAREOS_WORKING_DIR}
CPPFLAGS:=
CFLAGS:=-O -g
Expand All @@ -79,7 +79,6 @@ CXXPP:=cpp
INFILE_SUBST=\
-e "s,@PREFIX@,${BAREOS_PREFIX},g" \
-e "s,@BAREOS_VERSION@,${BAREOS_VERSION},g" \
-e "s,@FD_CONF@,${BAREOS_FD_CONF},g" \
-e "s,@BAREOS_DESTDIR@,${BAREOS_DESTDIR},g" \
-e "s,@PACKAGE_ID@,${PACKAGE_ID},g"

Expand Down
2 changes: 1 addition & 1 deletion platforms/osx/README
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Requirements:

Example (compile and create package from within bareos source tree):
$ ./configure --enable-client-only
$ make -C platforms/osx
$ make -C platforms/osx all

By moving the contents of platforms/osx to some other directory (e.g.
~/bareos-standalone-bulder), it is possible to create installer packages from
Expand Down
2 changes: 0 additions & 2 deletions platforms/osx/files/org.bareos.bareos-fd.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<array>
<string>@PREFIX@/sbin/bareos-fd</string>
<string>-f</string>
<string>-c</string>
<string>@FD_CONF@</string>
</array>
<key>RunAtLoad</key>
<true/>
Expand Down
4 changes: 4 additions & 0 deletions platforms/osx/resources/ReadMe.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
Use launchctl to enable and disable the bareos file daemon.
<pre>sudo launchctl load -w /Library/LaunchDaemons/org.bareos.bareos-fd.plist</pre></br>
<pre>sudo launchctl unload -w /Library/LaunchDaemons/org.bareos.bareos-fd.plist</pre></br>

You can also use launchctl to check if the daemon is running.
<pre>sudo launchctl list</pre>
Here you should find org.bareos.bareos-fd.plist listed.
</p>
<h2>Resources</h2>
<p>
Expand Down
26 changes: 1 addition & 25 deletions platforms/osx/resources/postflight.in
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
#!/bin/sh

function genpw() {
openssl rand -base64 33
}
@scriptdir@/bareos-config initilaize_local_hostname

# 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/bareos-fd.conf.example" > "$3@FD_CONF@"
fi
chmod 0600 "$3@FD_CONF@"

# install startup item
mkdir -p -m 0755 "$3/Library/LaunchDaemons"
Expand Down
6 changes: 5 additions & 1 deletion scripts/bareos-config-lib.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,11 @@ replace()
for file in `grep -l ${SEARCH} ${DIR_CFG}/*.conf ${DIR_CFG}/bareos-*.d/*/*.conf 2>/dev/null`; do
if [ -f "$file" ]; then
echo "replacing '${SEARCH}' with '${REPLACE}' in $file"
sed -i'' "s#${SEARCH}#${REPLACE}#g" "${file}"
if [ "$os_type" = "Darwin" ]; then
sed -i '' "s#${SEARCH}#${REPLACE}#g" "${file}"
else
sed -i'' "s#${SEARCH}#${REPLACE}#g" "${file}"
fi
fi
done
return 0
Expand Down

0 comments on commit 35b2fc0

Please sign in to comment.