Adding snap readme and badge
Some typo fixes and additional status checks
pull/162/head
BIBOLV 2020-09-07 22:52:50 +03:00
rodzic a048982f8b
commit 1ca95adbca
5 zmienionych plików z 74 dodań i 2 usunięć

Wyświetl plik

@ -12,6 +12,13 @@ else
echo "This is release - $GIT_VER" echo "This is release - $GIT_VER"
fi fi
if $(timeout 5 snapcraft status wmbusmeters-test2 >/dev/null); then
echo "snapcraft login sucessfull, continuing"
else
echo "Looks like snapcraft login is not sucessfull, exiting...."
exit 1
fi
for arch in $ARCH_LIST for arch in $ARCH_LIST
do do
snap_build_version="$(snapcraft status --arch $arch $SNAP_NAME | grep edge | awk '{print $2}')" snap_build_version="$(snapcraft status --arch $arch $SNAP_NAME | grep edge | awk '{print $2}')"

Wyświetl plik

@ -23,4 +23,4 @@ jobs:
with: with:
snapcraft_token: ${{ secrets.snapcraft_token }} snapcraft_token: ${{ secrets.snapcraft_token }}
- name: Run promote script - name: Run promote script
run: bash snap/promote_snap.sh run: bash .github/workflows/promote_snap.sh

Wyświetl plik

@ -13,6 +13,7 @@ The program runs on GNU/Linux, MacOSX, FreeBSD, and Raspberry Pi.
| ------------ |:-------------:| | ------------ |:-------------:|
|GNU/Linux & MacOSX| [![Build Status](https://travis-ci.org/weetmuts/wmbusmeters.svg?branch=master)](https://travis-ci.org/weetmuts/wmbusmeters) | |GNU/Linux & MacOSX| [![Build Status](https://travis-ci.org/weetmuts/wmbusmeters.svg?branch=master)](https://travis-ci.org/weetmuts/wmbusmeters) |
|Docker build status|[![CircleCI>](https://circleci.com/gh/weetmuts/wmbusmeters.svg?style=shield)](https://circleci.com/gh/weetmuts/wmbusmeters)| |Docker build status|[![CircleCI>](https://circleci.com/gh/weetmuts/wmbusmeters.svg?style=shield)](https://circleci.com/gh/weetmuts/wmbusmeters)|
|Snap status|[![wmbusmeters](https://snapcraft.io//wmbusmeters/badge.svg)](https://snapcraft.io/wmbusmeters)|
| Static Scan | Status | | Static Scan | Status |

64
snap/README.md 100644
Wyświetl plik

@ -0,0 +1,64 @@
Installation of snapd
===============================
Please refer to official documentation for snapd installation - https://snapcraft.io/docs/installing-snapd
Installation of wmbusmeters Snap
===============================
Installing a snap is straightforward:
sudo snap install wmbusmeters
The stable channel is used by default, but opting to install from a edge channel is easily accomplished:
sudo snap install --channel=edge wmbusmeters
In stable channel latest releases of wmbusmeters will be available, but in edge channel wmbusmeters snap will contain all latest code changes.
Using the wmbusmeters Snap
===============================
After installing the Snap, the privileged access to USB interfaces need to be configured:
sudo snap connect wmbusmeters:raw-usb core:raw-usb
Using wmbusmeters Daemon
-------------------------------------------
For all actions with wmbusmeters daemon, like enable/disable/start/stop/restart/status
systemctl commands should be used
For example:
systemctl start snap.wmbusmeters.wmbusmeters.service
systemctl status snap.wmbusmeters.wmbusmeters.service
Configuration for wmbusmeters
-----------------------------
Configuration of wmbusmeters is located in
`/var/snap/wmbusmeters/common/etc/`
Logs are in
`/var/snap/wmbusmeters/common/logs/`
When changes are made to configuration, service must be restarted.
Those directories are persistent across updates - files will not be deleted or changed when updating snap.
Files and directories are being deleted only when snap is removed.
When using rtlwmbus, rtl433 or shell commands then LD_LIBRARY_PATH and full path to binary inside snap should be used.
In case of rtlwmbus following configuration should be used:
device=rtlwmbus:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | /snap/wmbusmeters/current/usr/bin/rtl_wmbus
or rtl433
device=rtl433:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_433 -F csv -f 868.95M
or when shell command is being used
shell=LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/mosquitto_pub -h localhost -t water -m '$METER_JSON'

Wyświetl plik

@ -10,7 +10,7 @@ then
sed -i "s|^meterfiles=.*|meterfiles=$SNAP_COMMON/logs/meter_readings|g" "$SNAP_COMMON/etc/wmbusmeters.conf" sed -i "s|^meterfiles=.*|meterfiles=$SNAP_COMMON/logs/meter_readings|g" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "s|^logfile=.*|logfile=$SNAP_COMMON/logs/wmbusmeters.log|g" "$SNAP_COMMON/etc/wmbusmeters.conf" sed -i "s|^logfile=.*|logfile=$SNAP_COMMON/logs/wmbusmeters.log|g" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a listento=t1" "$SNAP_COMMON/etc/wmbusmeters.conf" sed -i "/^device=.*/a listento=t1" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a # To use rtl_433 uncomment following line \n#device=rtlwmbus:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_433 -F csv -f 868.95M" "$SNAP_COMMON/etc/wmbusmeters.conf" sed -i "/^device=.*/a # To use rtl_433 uncomment following line \n#device=rtl_433:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_433 -F csv -f 868.95M" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a # To use rtl_wmbus uncomment following line \n#device=rtlwmbus:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | /snap/wmbusmeters/current/usr/bin/rtl_wmbus" "$SNAP_COMMON/etc/wmbusmeters.conf" sed -i "/^device=.*/a # To use rtl_wmbus uncomment following line \n#device=rtlwmbus:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | /snap/wmbusmeters/current/usr/bin/rtl_wmbus" "$SNAP_COMMON/etc/wmbusmeters.conf"
fi fi