Skip to content

Commit

Permalink
changed ble service name
Browse files Browse the repository at this point in the history
from `dbus-blebattery-$1` to `dbus-blebattery.$1` like the non ble service
  • Loading branch information
mr-manuel committed Apr 28, 2023
1 parent 3a62eed commit d882937
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
4 changes: 4 additions & 0 deletions etc/dbus-serialbattery/disabledriver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ sh /opt/victronenergy/swupdate-scripts/remount-rw.sh

# remove files
rm -f /data/conf/serial-starter.d/$DRIVERNAME.conf
rm -rf /service/dbus-blebattery.*

# remove old drivers before changing from dbus-blebattery-$1 to dbus-blebattery.$1
# can be removed on second release (>1.0.0)
rm -rf /service/dbus-blebattery-*

# kill if running
Expand Down
28 changes: 18 additions & 10 deletions etc/dbus-serialbattery/installble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,31 @@ if [ ! -f $filename ]; then
fi
grep -qxF "sh /data/etc/dbus-serialbattery/installble.sh" $filename || echo "sh /data/etc/dbus-serialbattery/installble.sh" >> $filename

# kill if running, needed when an adapter changes
pkill -f "python .*/dbus-serialbattery.py"

# remove old drivers before changing from dbus-blebattery-$1 to dbus-blebattery.$1
# can be removed on second release (>1.0.0)
rm -rf /service/dbus-blebattery-*

install_service() {
mkdir -p /service/dbus-blebattery-$1/log
echo "#!/bin/sh" > /service/dbus-blebattery-$1/log/run
echo "exec multilog t s25000 n4 /var/log/dbus-blebattery-$1" >> /service/dbus-blebattery-$1/log/run
chmod 755 /service/dbus-blebattery-$1/log/run

echo "#!/bin/sh" > /service/dbus-blebattery-$1/run
echo "exec 2>&1" >> /service/dbus-blebattery-$1/run
echo "bluetoothctl disconnect $3" >> /service/dbus-blebattery-$1/run
echo "python /opt/victronenergy/dbus-serialbattery/dbus-serialbattery.py $2 $3" >> /service/dbus-blebattery-$1/run
chmod 755 /service/dbus-blebattery-$1/run
mkdir -p /service/dbus-blebattery.$1/log
echo "#!/bin/sh" > /service/dbus-blebattery.$1/log/run
echo "exec multilog t s25000 n4 /var/log/dbus-blebattery.$1" >> /service/dbus-blebattery.$1/log/run
chmod 755 /service/dbus-blebattery.$1/log/run

echo "#!/bin/sh" > /service/dbus-blebattery.$1/run
echo "exec 2>&1" >> /service/dbus-blebattery.$1/run
echo "bluetoothctl disconnect $3" >> /service/dbus-blebattery.$1/run
echo "python /opt/victronenergy/dbus-serialbattery/dbus-serialbattery.py $2 $3" >> /service/dbus-blebattery.$1/run
chmod 755 /service/dbus-blebattery.$1/run
}


## CONFIG AREA

## Uncomment for each adapter here, increase the number for each adapter/service

install_service 0 Jkbms_Ble C8:47:8C:E8:12:04
# install_service 0 Jkbms_Ble C8:47:8C:12:34:56
# install_service 1 Jkbms_Ble C8:47:8C:78:9A:BC
4 changes: 4 additions & 0 deletions etc/dbus-serialbattery/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ rm -f /data/conf/serial-starter.d/dbus-serialbattery.conf
rm -rf /opt/victronenergy/service/dbus-serialbattery
rm -rf /opt/victronenergy/service-templates/dbus-serialbattery
rm -rf /opt/victronenergy/dbus-serialbattery
rm -rf /service/dbus-blebattery.*

# remove old drivers before changing from dbus-blebattery-$1 to dbus-blebattery.$1
# can be removed on second release (>1.0.0)
rm -rf /service/dbus-blebattery-*

# kill if running
Expand Down

0 comments on commit d882937

Please sign in to comment.