diff install.sh @ 0:57ffb39f29d4

First commit of new carousel page to allow battery charging current to be adjusted.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 13 Dec 2021 23:05:38 +1030
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/install.sh	Mon Dec 13 23:05:38 2021 +1030
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+root=$(cd $(dirname $0); pwd)
+qmldir=/opt/victronenergy/gui/qml
+
+cp -f $root/OverviewJD.qml $qmldir
+if ! grep -lq "OverviewJD sentinel" $qmldir/main.qml; then
+  cp -f $qmldir/main.qml /tmp
+  (cd /tmp ; patch >/dev/null 2>&1 ) <$root/main.qml.diff
+  if [ $? -ne 0 ]; then
+    echo "Patching main.qml failed"
+  else
+    echo "Updating main.qml"
+    mv -f $qmldir/main.qml $qmldir/main.qml.orig
+    mv /tmp/main.qml $qmldir/
+  fi
+else
+  echo "main.qml already patched, skipping"
+fi
+# Create rc.local hooks for reinstallation
+mkdir /data/rc.local.d /data/rcS.local.d >/dev/null 2>&1
+cat >/data/rc.local.d/overviewjd <<EOF
+#!/bin/sh
+sh $root/install.sh
+EOF
+
+cat >/data/rc.local <<EOF
+#!/bin/sh
+for s in /data/rc.local.d/*; do
+  \$s
+done
+EOF
+
+cat >/data/rcS.local <<EOF
+#!/bin/sh
+for s in /data/rcS.local.d/*; do
+  \$s
+done
+EOF
+
+chmod 755 /data/rc.local.d/overviewjd /data/rc.local /data/rcS.local