kopia lustrzana https://github.com/weetmuts/wmbusmeters
43 wiersze
1.1 KiB
Bash
Executable File
43 wiersze
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Copyright (C) 2021 Fredrik Öhrström (gpl-3.0-or-later)
|
|
|
|
####################################################################
|
|
##
|
|
## Install /etc/wmbusmeters.conf
|
|
##
|
|
|
|
if [ ! -f "$ROOT"/etc/wmbusmeters.conf ]
|
|
then
|
|
# Create default configuration
|
|
mkdir -p "$ROOT"/etc/
|
|
cat <<EOF > "$ROOT"/etc/wmbusmeters.conf
|
|
loglevel=normal
|
|
# Remember to change auto here to the device you are going to use in production.
|
|
device=auto:t1
|
|
logtelegrams=false
|
|
format=json
|
|
meterfiles=/var/lib/wmbusmeters/meter_readings
|
|
meterfilesaction=overwrite
|
|
logfile=/var/log/wmbusmeters/wmbusmeters.log
|
|
EOF
|
|
chmod 644 "$ROOT"/etc/wmbusmeters.conf
|
|
echo "conf file: created $ROOT/etc/wmbusmeters.conf"
|
|
else
|
|
echo "conf file: $ROOT/etc/wmbusmeters.conf unchanged"
|
|
fi
|
|
|
|
####################################################################
|
|
##
|
|
## Create /etc/wmbusmeters.d
|
|
##
|
|
|
|
if [ ! -d "$ROOT"/etc/wmbusmeters.d ]
|
|
then
|
|
# Create the configuration directory
|
|
mkdir -p "$ROOT"/etc/wmbusmeters.d
|
|
chmod -R 755 "$ROOT"/etc/wmbusmeters.d
|
|
echo "conf dir: created $ROOT/etc/wmbusmeters.d"
|
|
else
|
|
echo "conf dir: $ROOT/etc/wmbusmeters.d unchanged"
|
|
fi
|