From 7fbce898b79f883e122619ad9c04740a1d8c3791 Mon Sep 17 00:00:00 2001 From: unifi-poller-bot Date: Wed, 12 Jun 2019 17:45:58 -0700 Subject: [PATCH 1/4] trying something else fix synatx error --- integrations/inputunifi/.travis.yml | 5 ++--- integrations/inputunifi/scripts/formula-deploy.sh | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/integrations/inputunifi/.travis.yml b/integrations/inputunifi/.travis.yml index 6e1df712..654b43c2 100644 --- a/integrations/inputunifi/.travis.yml +++ b/integrations/inputunifi/.travis.yml @@ -37,8 +37,7 @@ deploy: repo: davidnewhall/unifi-poller tags: true - provider: script - script: scripts/formula-deploy.sh ${TRAVIS_TAG} + script: scripts/formula-deploy.sh on: repo: davidnewhall/unifi-poller - tags: true -secure: "0yBdTabuF8LM8nQ8hSF1wjigQawal9N/v2NlR62oioMvzqWOy0zKo8R+mcfHK+pCByx0Ki/VWslms/WBKQnQvolGKY32UOg2cJvoVMoOemcwaezLK0kGZt8+O83ZQLr0CsiuzLQxJoqjiYf8ca6N2tjDFIowLPzSNPQR32mAP8cTe5fkxKyFAXgmA41BkzWMTx/V9R6udcX+Oofi8tpIZv1fyqSMNVlItHLxLFeP7F/r6OSM/Y87abAOt1U/ugPDufCL1MpmjRNhkL+NnHajSI30RsHFMv0c96hV3Va2g1VXrEVTB3F/0HhwBd9vwWwmiAGDMP/Nh7WfkQjHgHYCWVlbYgEdZj3rxeP9p14WEki3VavW2tZENjXoHpJswcT3UhB2m49p+pyV9NbzxZKeJDa2oniYBA9RfCrIURUIDI9Mk7vb+SVdcwx8JioiOebo568eRNHFI66KmQFrCGs+ZSuGFMk2ftaqhHSSctaD14EXzIurmWernw8xwmJAyiyBx6bKUIF969lBPlLVVCbl86ekNjm5xPxCaUM+Evugzo6nGsGckEUor85Ej54Q8qcxO/3m12F6gbHaEUUVK1splk+3dvDrSTZ6zJ+opxKkFph1MLjqQOIwqGU6DMMKy0JxMusjRg8n135LQQ/V05+Mzci4AF+kctidKfE42JDt5vA=" + secure: "0yBdTabuF8LM8nQ8hSF1wjigQawal9N/v2NlR62oioMvzqWOy0zKo8R+mcfHK+pCByx0Ki/VWslms/WBKQnQvolGKY32UOg2cJvoVMoOemcwaezLK0kGZt8+O83ZQLr0CsiuzLQxJoqjiYf8ca6N2tjDFIowLPzSNPQR32mAP8cTe5fkxKyFAXgmA41BkzWMTx/V9R6udcX+Oofi8tpIZv1fyqSMNVlItHLxLFeP7F/r6OSM/Y87abAOt1U/ugPDufCL1MpmjRNhkL+NnHajSI30RsHFMv0c96hV3Va2g1VXrEVTB3F/0HhwBd9vwWwmiAGDMP/Nh7WfkQjHgHYCWVlbYgEdZj3rxeP9p14WEki3VavW2tZENjXoHpJswcT3UhB2m49p+pyV9NbzxZKeJDa2oniYBA9RfCrIURUIDI9Mk7vb+SVdcwx8JioiOebo568eRNHFI66KmQFrCGs+ZSuGFMk2ftaqhHSSctaD14EXzIurmWernw8xwmJAyiyBx6bKUIF969lBPlLVVCbl86ekNjm5xPxCaUM+Evugzo6nGsGckEUor85Ej54Q8qcxO/3m12F6gbHaEUUVK1splk+3dvDrSTZ6zJ+opxKkFph1MLjqQOIwqGU6DMMKy0JxMusjRg8n135LQQ/V05+Mzci4AF+kctidKfE42JDt5vA=" diff --git a/integrations/inputunifi/scripts/formula-deploy.sh b/integrations/inputunifi/scripts/formula-deploy.sh index d6d51dc3..bed02775 100755 --- a/integrations/inputunifi/scripts/formula-deploy.sh +++ b/integrations/inputunifi/scripts/formula-deploy.sh @@ -5,9 +5,6 @@ make unifi-poller.rb VERSION=$(grep -E '^\s*version\s*"' unifi-poller.rb | cut -d\" -f 2) -git config user.name "unifi-poller-bot" -git config user.email "unifi@poller.bot" - rm -rf homebrew-repo git clone https://$GITHUB_API_KEY@github.com/golift/homebrew-repo.git @@ -15,6 +12,8 @@ cp unifi-poller.rb homebrew-repo/Formula pushd homebrew-repo echo "Showing diff:" git diff +git config user.name "unifi-poller-bot" +git config user.email "unifi@poller.bot" git commit -m "Update unifi-poller on Release: v${VERSION}" Formula/unifi-poller.rb git push popd From e1ec5ca0d3fb5b5f015b4117ec52a1689457ff84 Mon Sep 17 00:00:00 2001 From: unifi-poller-bot Date: Wed, 12 Jun 2019 18:02:49 -0700 Subject: [PATCH 2/4] Add new deploy setup. make it deploy. --- .../inputunifi/.github_deploy_key.enc | Bin 3376 -> 0 bytes integrations/inputunifi/.travis.yml | 18 ++++++++++++------ .../inputunifi/.travis/github_deploy_key.enc | Bin 0 -> 3392 bytes .../inputunifi/scripts/formula-deploy.sh | 4 +--- 4 files changed, 13 insertions(+), 9 deletions(-) delete mode 100644 integrations/inputunifi/.github_deploy_key.enc create mode 100644 integrations/inputunifi/.travis/github_deploy_key.enc diff --git a/integrations/inputunifi/.github_deploy_key.enc b/integrations/inputunifi/.github_deploy_key.enc deleted file mode 100644 index 7cd019409603ebbd5862810d3176e664d4b28ada..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3376 zcmV-04bSp|5hU=+Y4JS}#l}L##5A`PlQagEQn^B`%z7BBhO}A8M<6UBY=TAh9=wld z5T=jKITR9M4-BSrZ8!~lgA0U+A?$JE^E^CC{QmDEnOdU|&D9#^#7XX;Xui6b#|J?B zP=LLzW(>>{8_9xDR}ax3;Ugg@PMc)f2 zYp(v^Un27oBTECmtv=7s+c8`;zQCjDtcNcXdOTfDlo~s3h)|@g?SLZUwoP)nAzlD6Ys9RTk)+TsP`+VWO_V*%_;-DM zIcK}wt|)w3vy&Lto#0k-YO)zxSrl2$J*{KaHy!r9F9x--D3cA@jlhe)&Q67ZCNRjY zIYT2S(0P#xVXSIoff_kUd^YUUclyuf>m7|rvO6@h;bf%QaUe7E$Vjn(yd}f9f?GO= z7*xc+NQQp8_Ul|>+p9iz^}<%SBM_mds>#k%^8w$LL_$Ft#3EIT;3j(9(B^HSIiEIG zrMM}m*8Z$k>fK&DDe3@NsBl#06K=n*HnBT|Z~B4EhT>ebqV^4ccuGb>X5)lELO+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+;bi5{f zcYGQMn+tqhwASh1IHlY3p;}{EAo=z6z@W`^BA5F#EYb9N}1F?3hMwsrDKNG ztswe85}`TUoA$_2*Yg(z3C->9W5RBjcfe9FYAM855ER#N8cFX)hd68=F84+$8@^d~ zEwqc-n(Xh<2J-_QRTL5^n2b&6Citn5Rc$5vW)o?_Mm26V)?cdJb&et;P5BYNw2?nZ z5ruL;y<@xSXC6v!xBGsPl>FILr_f&d89jFEtB`E{ZDS%=rDa&M6r#ZH3_Y7Ij*a!Hn-K{Ys>;m>HqK3=^8m+y-dp}1B__k!u zflCwCd)x=Ma4WEX`sj_0J88u<_y0$9;yApWRGAMx89-ovLs%}u{iGrT55^q_WP3A# z8mXH989rKNUFjTCcVrL{}<D6&s7kNAcv z(STIE4)D};dnCabegI~2I5)!!Y4yB8o09WXf72X#KK$K7lx|S*AHfTTya>%Z?gF?E z){Xn3Sm583nqzL07stKlXfSCuIL zA0FJ{PX0&mZ2w)+{rm$7Ls0_X1ai2O^eY}@eCo>-XJ_Ed^b{6WQNK2DNojy62N}Bk zXf3Efk{=md0g%X-pVfo?QQvl$&NGkS+fWX>G6}S?k$UwHq!Tn z0iUxBiV~XXHM9yA+Nb$tqE*&=z>UxOUt<(P*TR7qK36?NX& zPlpM3cJfm&#CK%k9rjXrr6}nkB6co z2(pG7u}yQYJU{7Ow0GT(I+zVH=Mp5ZK*y&R{dRT}>Y7 Date: Wed, 12 Jun 2019 18:22:37 -0700 Subject: [PATCH 3/4] Add ETC folder and plist fix github setup --- integrations/inputunifi/.travis.yml | 13 ++++--- integrations/inputunifi/Makefile | 9 ++--- .../inputunifi/templates/unifi-poller.rb.tmpl | 34 ++++++++++++++++++- 3 files changed, 47 insertions(+), 9 deletions(-) diff --git a/integrations/inputunifi/.travis.yml b/integrations/inputunifi/.travis.yml index 12225e54..45dcc358 100644 --- a/integrations/inputunifi/.travis.yml +++ b/integrations/inputunifi/.travis.yml @@ -23,10 +23,15 @@ script: # get deploy key for golift/homebrew-repo. after_success: - | - openssl aes-256-cbc -K $encrypted_9f3147001275_key -iv $encrypted_9f3147001275_iv -in github_deploy_key.enc -out github_deploy_key -d - $(npm bin)/set-up-ssh --key "$encrypted_9f3147001275_key" \ - --iv "$encrypted_9f3147001275_iv" \ - --path-encrypted-key ".travis/github_deploy_key.enc" + declare -r SSH_FILE="$(mktemp -u $HOME/.ssh/XXXXX)" + echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config + openssl aes-256-cbc -K $encrypted_9f3147001275_key -iv $encrypted_9f3147001275_iv -in ".travis/github_deploy_key.enc" -out "$SSH_FILE" -d + chmod 600 "$SSH_FILE" \ + && printf "%s\n" \ + "Host github.com" \ + " IdentityFile $SSH_FILE" \ + " StrictHostKeyChecking no" \ + " LogLevel ERROR" >> ~/.ssh/config deploy: - provider: releases api_key: diff --git a/integrations/inputunifi/Makefile b/integrations/inputunifi/Makefile index eb7f723f..613e92e0 100644 --- a/integrations/inputunifi/Makefile +++ b/integrations/inputunifi/Makefile @@ -179,13 +179,14 @@ install: man readme $(BINARY) @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 @[ "$$(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. - /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 0644 -cp $(BINARY).1.gz $(PREFIX)/share/man/man1 - /usr/bin/install -m 0644 -cp examples/up.conf.example $(PREFIX)/etc/$(BINARY)/ - [ -f $(PREFIX)/etc/$(BINARY)/up.conf ] || /usr/bin/install -m 0644 -cp examples/up.conf.example $(PREFIX)/etc/$(BINARY)/up.conf + /usr/bin/install -m 0644 -cp examples/up.conf.example $(ETC)/$(BINARY)/ + [ -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)/ # 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 diff --git a/integrations/inputunifi/templates/unifi-poller.rb.tmpl b/integrations/inputunifi/templates/unifi-poller.rb.tmpl index c086d8c8..acfb8a67 100644 --- a/integrations/inputunifi/templates/unifi-poller.rb.tmpl +++ b/integrations/inputunifi/templates/unifi-poller.rb.tmpl @@ -21,10 +21,42 @@ class UnifiPoller < Formula bin_path.install Dir["*"] cd bin_path do system "dep", "ensure" - system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}" + system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}", "ETC=#{etc}" end end + plist_options :startup => true + + def plist; <<-EOS.undent + + + + + Label + #{plist_name} + ProgramArguments + + #{bin}/unifi-poller + -c + #{etc}/unifi-poller/up.conf + + RunAtLoad + + KeepAlive + + StandardErrorPath + #{var}/log/unifi-poller/log + StandardOutPath + #{var}/log/unifi-poller/log + UserName + nobody + GroupName + nobody + + + EOS + end + test do assert_match "unifi-poller v#{version}", shell_output("#{bin}/unifi-poller -v 2>&1", 2) end From f5dbef88f56b9490682c226d9d3dc26c5336a28e Mon Sep 17 00:00:00 2001 From: unifi-poller-bot Date: Wed, 12 Jun 2019 18:48:56 -0700 Subject: [PATCH 4/4] Final workings. Final workings. fix --- integrations/inputunifi/.travis.yml | 2 +- integrations/inputunifi/scripts/formula-deploy.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/integrations/inputunifi/.travis.yml b/integrations/inputunifi/.travis.yml index 45dcc358..f009af4e 100644 --- a/integrations/inputunifi/.travis.yml +++ b/integrations/inputunifi/.travis.yml @@ -46,7 +46,7 @@ deploy: - provider: script script: scripts/formula-deploy.sh on: - all_branches: true + tags: true repo: davidnewhall/unifi-poller env: global: diff --git a/integrations/inputunifi/scripts/formula-deploy.sh b/integrations/inputunifi/scripts/formula-deploy.sh index 44f238c4..8313843c 100755 --- a/integrations/inputunifi/scripts/formula-deploy.sh +++ b/integrations/inputunifi/scripts/formula-deploy.sh @@ -6,6 +6,8 @@ make unifi-poller.rb VERSION=$(grep -E '^\s*version\s*"' unifi-poller.rb | cut -d\" -f 2) rm -rf homebrew-repo +git config --global user.email "unifi@auto.releaser" +git config --global user.name "unifi-auto-releaser" git clone git@github.com:golift/homebrew-repo.git cp unifi-poller.rb homebrew-repo/Formula