2021-06-26 15:49:21 +00:00
|
|
|
#!/bin/sh
|
2022-02-12 14:28:17 +00:00
|
|
|
# Copyright (C) 2021 Fredrik Öhrström (gpl-3.0-or-later)
|
2021-06-26 15:49:21 +00:00
|
|
|
|
|
|
|
####################################################################
|
|
|
|
##
|
|
|
|
## 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
|
2022-04-30 08:41:45 +00:00
|
|
|
# Remember to change auto here to the device you are going to use in production.
|
2021-06-26 15:49:21 +00:00
|
|
|
device=auto:t1
|
|
|
|
logtelegrams=false
|
|
|
|
format=json
|
2022-04-30 08:41:45 +00:00
|
|
|
meterfiles=/var/lib/wmbusmeters/meter_readings
|
2021-06-26 15:49:21 +00:00
|
|
|
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
|