Skip to content

Commit

Permalink
services bug fixes
Browse files Browse the repository at this point in the history
removing a service prevented reinstallation when /service was overlayed

The directories got removed but installing the service again without rebooting was not successful
  • Loading branch information
kwindrem committed Aug 9, 2021
1 parent 31596dc commit adc2287
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
Binary file modified .DS_Store
Binary file not shown.
20 changes: 9 additions & 11 deletions ServiceResources
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -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},\
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.4
v2.5

0 comments on commit adc2287

Please sign in to comment.