Deal with config file and logging path ownership.
This commit is contained in:
parent
41d2d201ac
commit
b68c4e03ea
2
Makefile
2
Makefile
|
|
@ -5,7 +5,7 @@ all: clean test man build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
for p in $(PACKAGES); do rm -f `echo $${p}|cut -d/ -f3`{,.1,.1.gz}; done
|
for p in $(PACKAGES); do rm -f `echo $${p}|cut -d/ -f3`{,.1,.1.gz}; done
|
||||||
rm -rf build unifi-poller_*.deb unifi-poller-*.rpm unifi-poller-*.pkg
|
rm -rf package_build unifi-poller_*.deb unifi-poller-*.rpm unifi-poller-*.pkg
|
||||||
|
|
||||||
build:
|
build:
|
||||||
for p in $(PACKAGES); do go build -ldflags "-w -s" $${p}; done
|
for p in $(PACKAGES); do go build -ldflags "-w -s" $${p}; done
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This file is used by osxpkg packages. FPM use.
|
||||||
|
|
||||||
|
# Copy the config file into place if it does not exist.
|
||||||
|
if [ ! -f /usr/local/etc/unifi-poller/up.conf ] && [ -f /usr/local/etc/unifi-poller/up.conf.example ]; then
|
||||||
|
cp /usr/local/etc/unifi-poller/up.conf.example /usr/local/etc/unifi-poller/up.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure admins can write logs.
|
||||||
|
chgrp admin /usr/local/var/log
|
||||||
|
chmod g=rwx /usr/local/var/log
|
||||||
|
|
||||||
|
# This starts it as root. no no no .... not sure how to fix that.
|
||||||
|
# launchctl load /Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist
|
||||||
|
|
@ -42,4 +42,4 @@ fpm -s dir -t ${OUTPUT} \
|
||||||
--version ${VERSION} \
|
--version ${VERSION} \
|
||||||
--after-install scripts/after-install.sh \
|
--after-install scripts/after-install.sh \
|
||||||
--before-remove scripts/before-remove.sh \
|
--before-remove scripts/before-remove.sh \
|
||||||
-C package_build
|
--chdir package_build
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ BINFIX=/usr/local
|
||||||
# Make a build environment.
|
# Make a build environment.
|
||||||
rm -rf package_build
|
rm -rf package_build
|
||||||
mkdir -p package_build${BINFIX}/bin package_build${PREFIX}/etc/${BINARY} package_build${BINFIX}/share/man/man1
|
mkdir -p package_build${BINFIX}/bin package_build${PREFIX}/etc/${BINARY} package_build${BINFIX}/share/man/man1
|
||||||
|
mkdir -p package_build${PREFIX}/var/log
|
||||||
|
|
||||||
# Copy the binary, config file and man page into the env.
|
# Copy the binary, config file and man page into the env.
|
||||||
cp ${BINARY} package_build${BINFIX}/bin
|
cp ${BINARY} package_build${BINFIX}/bin
|
||||||
cp *.1.gz package_build${BINFIX}/share/man/man1
|
cp *.1.gz package_build${BINFIX}/share/man/man1
|
||||||
cp examples/up.conf.example package_build${PREFIX}/etc/${BINARY}/up.conf
|
cp examples/up.conf.example package_build${PREFIX}/etc/${BINARY}/
|
||||||
|
|
||||||
# Copy in launch agent.
|
# Copy in launch agent.
|
||||||
mkdir -p package_build/Library/LaunchAgents
|
mkdir -p package_build/Library/LaunchAgents
|
||||||
|
|
@ -35,5 +36,6 @@ cp init/launchd/com.github.davidnewhall.unifi-poller.plist package_build/Library
|
||||||
fpm -s dir -t osxpkg \
|
fpm -s dir -t osxpkg \
|
||||||
--name ${BINARY} \
|
--name ${BINARY} \
|
||||||
--version ${VERSION} \
|
--version ${VERSION} \
|
||||||
|
--after-install scripts/after-install-osx.sh \
|
||||||
--osxpkg-identifier-prefix com.github.davidnewhall \
|
--osxpkg-identifier-prefix com.github.davidnewhall \
|
||||||
-C package_build
|
--chdir package_build
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue