chaunceygardiner / purple-proxy

Proxy server for PurpleAir air quality sensor. Serves current and archived readings which are averaged over a specified interval.
GNU General Public License v3.0
0 stars 1 forks source link

Install errors on RPi running Raspbian buster #1

Open sjthespian opened 4 years ago

sjthespian commented 4 years ago

I get a handful of errors when I attempt to install the purple-proxy:

cp: cannot create regular file '/etc/logwatch/conf/services/': No such file or directory
cp: cannot create regular file '/etc/logwatch/conf/logfiles/': No such file or directory
cp: cannot create regular file '/etc/logwatch/scripts/services/': No such file or directory
Failed to enable unit: File /etc/init.d/purple-proxy: Invalid argument
./install: 70: ./install: /etc/init.d/purple-proxy: Permission denied

The first three are because I don't use logwatch, the script should check for the existence of the directory.

The last two lines appear to be because it doesn't set execute permission on the script and because you are calling systemctl with the full script path instead of just the name.

I also found that it wouldn't start, as execute permission is missing off of the wrapper.

--- install.orig    2020-09-01 13:21:09.066778016 -0700
+++ install 2020-09-01 13:25:17.085619200 -0700
@@ -32,13 +32,16 @@
 mkdir    "$target_dir"/bin/server 2> /dev/null

 cp ${src_dir}/etc/logrotate.d/purple-proxy ${etc}/logrotate.d/
-cp ${src_dir}/etc/logwatch/conf/services/purple-proxy.conf ${etc}/logwatch/conf/services/
-cp ${src_dir}/etc/logwatch/conf/logfiles/purple-proxy.conf ${etc}/logwatch/conf/logfiles/
-cp ${src_dir}/etc/logwatch/scripts/services/purple-proxy ${etc}/logwatch/scripts/services/
+if [ -d ${etc}/logwatch ]; then
+  cp ${src_dir}/etc/logwatch/conf/services/purple-proxy.conf ${etc}/logwatch/conf/services/
+  cp ${src_dir}/etc/logwatch/conf/logfiles/purple-proxy.conf ${etc}/logwatch/conf/logfiles/
+  cp ${src_dir}/etc/logwatch/scripts/services/purple-proxy ${etc}/logwatch/scripts/services/
+fi
 cp ${src_dir}/etc/rsyslog.d/purple-proxy.conf ${etc}/rsyslog.d/

 # cp and fixup /etc/init.d/purple-proxy
 cat ${src_dir}/etc/init.d/purple-proxy | sed "s%/home/purpleproxy%$target_dir%g" > /${etc}/init.d/purple-proxy
+chmod 755 ${etc}/init.d/purple-proxy

 # cp bin files
 cp ${src_dir}/home/purpleproxy/bin/server/__init__.py ${target_dir}/bin/server/
@@ -49,6 +52,7 @@

 # copy and fix up the wrapper
 cat ${src_dir}/home/purpleproxy/bin/purpleproxy-wrapper.sh | sed "s%/home/purpleproxy%$target_dir%g" > ${target_dir}/bin/purpleproxy-wrapper.sh
+chmod 755 ${target_dir}/bin/purpleproxy-wrapper.sh

 echo "# PurpleProxy configuration file" > ${target_dir}/purpleproxy.conf
 echo "debug = 0" >> ${target_dir}/purpleproxy.conf
@@ -66,6 +70,6 @@
 if [ "$etc" = "/etc" ]; then
     service rsyslog restart
     service logrotate restart
-    systemctl enable /etc/init.d/purple-proxy
+    systemctl enable purple-proxy
     /etc/init.d/purple-proxy start
 fi
chaunceygardiner commented 4 years ago

Thanks.

I assume you want to use this with my weewx-purple extension to weewx. I do say there that the install is crude. I should probably add some disclaimers on the repository itself.

I’ll try to clean things up; but I am swamped presently and won’t get to this for a week or two.

On Sep 1, 2020, at 1:27 PM, Daniel Rich notifications@github.com wrote:

 I get a handful of errors when I attempt to install the purple-proxy:

cp: cannot create regular file '/etc/logwatch/conf/services/': No such file or directory cp: cannot create regular file '/etc/logwatch/conf/logfiles/': No such file or directory cp: cannot create regular file '/etc/logwatch/scripts/services/': No such file or directory Failed to enable unit: File /etc/init.d/purple-proxy: Invalid argument ./install: 70: ./install: /etc/init.d/purple-proxy: Permission denied The first three are because I don't use logwatch, the script should check for the existence of the directory.

The last two lines appear to be because it doesn't set execute permission on the script and because you are calling systemctl with the full script path instead of just the name.

I also found that it wouldn't start, as execute permission is missing off of the wrapper.

--- install.orig 2020-09-01 13:21:09.066778016 -0700 +++ install 2020-09-01 13:25:17.085619200 -0700 @@ -32,13 +32,16 @@ mkdir "$target_dir"/bin/server 2> /dev/null

cp ${src_dir}/etc/logrotate.d/purple-proxy ${etc}/logrotate.d/ -cp ${src_dir}/etc/logwatch/conf/services/purple-proxy.conf ${etc}/logwatch/conf/services/ -cp ${src_dir}/etc/logwatch/conf/logfiles/purple-proxy.conf ${etc}/logwatch/conf/logfiles/ -cp ${src_dir}/etc/logwatch/scripts/services/purple-proxy ${etc}/logwatch/scripts/services/ +if [ -d ${etc}/logwatch ]; then

  • cp ${src_dir}/etc/logwatch/conf/services/purple-proxy.conf ${etc}/logwatch/conf/services/
  • cp ${src_dir}/etc/logwatch/conf/logfiles/purple-proxy.conf ${etc}/logwatch/conf/logfiles/
  • cp ${src_dir}/etc/logwatch/scripts/services/purple-proxy ${etc}/logwatch/scripts/services/ +fi cp ${src_dir}/etc/rsyslog.d/purple-proxy.conf ${etc}/rsyslog.d/

    cp and fixup /etc/init.d/purple-proxy

    cat ${src_dir}/etc/init.d/purple-proxy | sed "s%/home/purpleproxy%$target_dir%g" > /${etc}/init.d/purple-proxy +chmod 755 ${etc}/init.d/purple-proxy

    cp bin files

    cp ${src_dir}/home/purpleproxy/bin/server/init.py ${target_dir}/bin/server/ @@ -49,6 +52,7 @@

    copy and fix up the wrapper

    cat ${src_dir}/home/purpleproxy/bin/purpleproxy-wrapper.sh | sed "s%/home/purpleproxy%$target_dir%g" > ${target_dir}/bin/purpleproxy-wrapper.sh +chmod 755 ${target_dir}/bin/purpleproxy-wrapper.sh

    echo "# PurpleProxy configuration file" > ${target_dir}/purpleproxy.conf echo "debug = 0" >> ${target_dir}/purpleproxy.conf @@ -66,6 +70,6 @@ if [ "$etc" = "/etc" ]; then service rsyslog restart service logrotate restart

  • systemctl enable /etc/init.d/purple-proxy
  • systemctl enable purple-proxy /etc/init.d/purple-proxy start fi — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
sjthespian commented 4 years ago

No rush, it's up and running for me. I used the above patch to get a clean install, then cloned it and hand edited it for my 2nd purple air (indoor model).

Just an FYI, the purple-proxy link in the weewx-purple plugin README.md doesn't link to this repo, it's pointing to weewx-purple.

chaunceygardiner commented 4 years ago

Thanks.

BTW, I have an indoor also. With the fires at present in the SF Bay Area, the indoor and outdoor have been invaluable to decide when to close up and turn on the fans with filters.

On Sep 3, 2020, at 5:10 PM, Daniel Rich notifications@github.com wrote:

 No rush, it's up and running for me. I used the above patch to get a clean install, then cloned it and hand edited it for my 2nd purple air (indoor model).

Just an FYI, the purple-proxy link in the weewx-purple plugin README.md doesn't link to this repo, it's pointing to weewx-purple.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.