Add ETC folder and plist

fix github setup
This commit is contained in:
unifi-poller-bot 2019-06-12 18:22:37 -07:00
parent 8c535c40c6
commit 1a91e9477c
3 changed files with 47 additions and 9 deletions

View File

@ -23,10 +23,15 @@ script:
# get deploy key for golift/homebrew-repo. # get deploy key for golift/homebrew-repo.
after_success: after_success:
- | - |
openssl aes-256-cbc -K $encrypted_9f3147001275_key -iv $encrypted_9f3147001275_iv -in github_deploy_key.enc -out github_deploy_key -d declare -r SSH_FILE="$(mktemp -u $HOME/.ssh/XXXXX)"
$(npm bin)/set-up-ssh --key "$encrypted_9f3147001275_key" \ echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
--iv "$encrypted_9f3147001275_iv" \ openssl aes-256-cbc -K $encrypted_9f3147001275_key -iv $encrypted_9f3147001275_iv -in ".travis/github_deploy_key.enc" -out "$SSH_FILE" -d
--path-encrypted-key ".travis/github_deploy_key.enc" chmod 600 "$SSH_FILE" \
&& printf "%s\n" \
"Host github.com" \
" IdentityFile $SSH_FILE" \
" StrictHostKeyChecking no" \
" LogLevel ERROR" >> ~/.ssh/config
deploy: deploy:
- provider: releases - provider: releases
api_key: api_key:

View File

@ -179,13 +179,14 @@ install: man readme $(BINARY)
@echo - Otherwise, build and install a package: make rpm -or- make deb @echo - Otherwise, build and install a package: make rpm -or- make deb
@echo See the Package Install wiki for more info: $(URL)/wiki/Package-Install @echo See the Package Install wiki for more info: $(URL)/wiki/Package-Install
@[ "$$(uname)" = "Darwin" ] || (echo "Unable to continue, not a Mac." && false) @[ "$$(uname)" = "Darwin" ] || (echo "Unable to continue, not a Mac." && false)
@[ "$(PREFIX)" != "" ] || (echo "Unable to continue, PREFIX not set. Use: make install PREFIX=/usr/local" && false) @[ "$(PREFIX)" != "" ] || (echo "Unable to continue, PREFIX not set. Use: make install PREFIX=/usr/local ETC=/usr/local/etc" && false)
@[ "$(ETC)" != "" ] || (echo "Unable to continue, ETC not set. Use: make install PREFIX=/usr/local ETC=/usr/local/etc" && false)
# Copying the binary, config file, unit file, and man page into the env. # Copying the binary, config file, unit file, and man page into the env.
/usr/bin/install -m 0755 -d $(PREFIX)/bin $(PREFIX)/share/man/man1 $(PREFIX)/etc/$(BINARY) $(PREFIX)/share/doc/$(BINARY)/examples /usr/bin/install -m 0755 -d $(PREFIX)/bin $(PREFIX)/share/man/man1 $(ETC)/$(BINARY) $(PREFIX)/share/doc/$(BINARY)/examples
/usr/bin/install -m 0755 -cp $(BINARY) $(PREFIX)/bin/$(BINARY) /usr/bin/install -m 0755 -cp $(BINARY) $(PREFIX)/bin/$(BINARY)
/usr/bin/install -m 0644 -cp $(BINARY).1.gz $(PREFIX)/share/man/man1 /usr/bin/install -m 0644 -cp $(BINARY).1.gz $(PREFIX)/share/man/man1
/usr/bin/install -m 0644 -cp examples/up.conf.example $(PREFIX)/etc/$(BINARY)/ /usr/bin/install -m 0644 -cp examples/up.conf.example $(ETC)/$(BINARY)/
[ -f $(PREFIX)/etc/$(BINARY)/up.conf ] || /usr/bin/install -m 0644 -cp examples/up.conf.example $(PREFIX)/etc/$(BINARY)/up.conf [ -f $(ETC)/$(BINARY)/up.conf ] || /usr/bin/install -m 0644 -cp examples/up.conf.example $(ETC)/$(BINARY)/up.conf
/usr/bin/install -m 0644 -cp *.html examples/{*dash.json,up.conf.example} $(PREFIX)/share/doc/$(BINARY)/ /usr/bin/install -m 0644 -cp *.html examples/{*dash.json,up.conf.example} $(PREFIX)/share/doc/$(BINARY)/
# These go to their own folder so the img src in the html pages continue to work. # These go to their own folder so the img src in the html pages continue to work.
/usr/bin/install -m 0644 -cp examples/*.png $(PREFIX)/share/doc/$(BINARY)/examples /usr/bin/install -m 0644 -cp examples/*.png $(PREFIX)/share/doc/$(BINARY)/examples

View File

@ -21,10 +21,42 @@ class UnifiPoller < Formula
bin_path.install Dir["*"] bin_path.install Dir["*"]
cd bin_path do cd bin_path do
system "dep", "ensure" system "dep", "ensure"
system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}" system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}", "ETC=#{etc}"
end end
end end
plist_options :startup => true
def plist; <<-EOS.undent
<?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>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{bin}/unifi-poller</string>
<string>-c</string>
<string>#{etc}/unifi-poller/up.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>#{var}/log/unifi-poller/log</string>
<key>StandardOutPath</key>
<string>#{var}/log/unifi-poller/log</string>
<key>UserName</key>
<string>nobody</string>
<key>GroupName</key>
<string>nobody</string>
</dict>
</plist>
EOS
end
test do test do
assert_match "unifi-poller v#{version}", shell_output("#{bin}/unifi-poller -v 2>&1", 2) assert_match "unifi-poller v#{version}", shell_output("#{bin}/unifi-poller -v 2>&1", 2)
end end