From adc22877ba603eeaf8e5294061c6ad4b8bf130c2 Mon Sep 17 00:00:00 2001 From: kwindrem <58538395+kwindrem@users.noreply.github.com> Date: Mon, 9 Aug 2021 14:37:37 -0700 Subject: [PATCH] services bug fixes removing a service prevented reinstallation when /service was overlayed The directories got removed but installing the service again without rebooting was not successful --- .DS_Store | Bin 8196 -> 6148 bytes ServiceResources | 20 +++++++++----------- setup | 6 +++--- version | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.DS_Store b/.DS_Store index 2728af85ceabe1d10617c191383e37e5d7db27a0..89a4afafa87a47a7508572f5359dbc6a36d7458c 100644 GIT binary patch delta 207 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5sJ6q~50$jGrVU^g=($7CJ>sn~{UkPL$! zLpnnyLrHGFi%U{YeiBGmkFo!b*9nImQRP$c$`@o91}Ep|76A1yFff1E+$_MsxY89Gvk2lGW8FCPq36#zsc9Itta6W)?aMh6a|# zwY8ia;;M$Wo(Z{?Rn;}Mb+f=;Vqj#1&NMb}SDa8#g~lbeqcA=p$I0>d07UKk9pIH)YRC@&{JFC8ewxVeK>iE(o@ p&t_&W32vZ(D<~ap7UcNOJegm_bFx1V2L~`1KuL^Yb3D%+W&p(?m)ZaT diff --git a/ServiceResources b/ServiceResources index 5806aee..cd0c0e2 100755 --- a/ServiceResources +++ b/ServiceResources @@ -25,6 +25,7 @@ # so code here operates on both directories victronServicesDir="/opt/victronenergy/service" +overlayWorkDir="/run/overlays/service" if [ -d "$victronServicesDir" ]; then serviceDir="$victronServicesDir" serviceOverlay=true @@ -53,9 +54,6 @@ _startService () svc -u "/service/$pkg" if [ -e "$serviceDir/$pkg/log" ]; then rm -f "$serviceDir/$pkg/log/down" - if $serviceOverlay ; then - rm -f "/service/$pkg/log/down" - fi svc -u "/service/$pkg/log" fi } @@ -109,14 +107,14 @@ _removeService () { local pkg=$1 # stop the service - svc -d "/service/$pkg" + _stopService $pkg - # remove the active service directory + # remove the service directory # removing the service in the overlayed service directory doesn't remove it from /service - # so that needs to be removed FIRST - rm -rf "/service/$pkg" + # it needs to be removed from the overlay work directory also + rm -rf "$serviceDir/$pkg" if $serviceOverlay ; then - rm -rf "$serviceDir/$pkg" + rm -rf "$overlayWorkDir/$pkg" fi # kill related processes _killServiceProcesses $pkg @@ -162,12 +160,12 @@ installService () local serviceRestartNeeded=false if [ -L "$serviceDir/$pkg" ]; then - logMessage "$pkg removing old service (was symbolic link)" - _removeService $pkg + logMessage "removing old $pkg service (was symbolic link)" + rm -f "$serviceDir/$pkg" fi # service not yet installed, COPY service directory to the active locaiton if [ ! -e "$serviceDir/$pkg" ]; then - logMessage "$pkg installing service" + logMessage "installing $pkg service" cp -R "$scriptDir/service" "$serviceDir/$pkg" # service already installed - only copy changed files, then restart service else diff --git a/setup b/setup index eb15c0a..2ef68d1 100755 --- a/setup +++ b/setup @@ -18,9 +18,9 @@ if [ $scriptAction == 'NONE' ] ; then # NOTE: if new settings are added in the future, change test for that one # to avoid creating that new parameter !!!! - lastSetting=$(dbus-send --system --print-reply=literal --dest=com.victronenergy.settings /Settings/GuiModsCheckingPackage\ - com.victronenergy.BusItem.GetValue 2> /dev/null | awk '{print $3}') - if [ -z $lastSetting ]; then + dbus-send --system --print-reply=literal --dest=com.victronenergy.settings /Settings/GuiMods/CheckingPackage\ + com.victronenergy.BusItem.GetValue &> /dev/null + if (( $? != 0 )); then logMessage "creating SetupHelper Settings" dbus -y com.victronenergy.settings /Settings AddSettings\ '%[ {"path": "/GuiMods/GitHubAutoUpdate", "default":0},\ diff --git a/version b/version index b001f9f..92491a0 100644 --- a/version +++ b/version @@ -1 +1 @@ -v2.4 +v2.5