Skip to content

Commit

Permalink
fixed bug in blind installation
Browse files Browse the repository at this point in the history
Sometimes, the dbus Settings that controlles the auto updates aren't created. A delay was added in blindInstall and I check to make sure both settings are present before proceeding with SetupHelper setup
  • Loading branch information
kwindrem committed Nov 19, 2021
1 parent 8726ab2 commit db2341a
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion CommonResources
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ endScript ()
mv "$oldPackageListFile" "$packageListFile"
fi

if [ ! -f "$packageListFile" ] || [ $(grep -c "$packageName\s" "$packageListFile") == 0 ]; then
if [ ! -f "$packageListFile" ] || [ $(grep -c "^$packageName\s" "$packageListFile") == 0 ]; then
logMessage "adding $packageName to SetupHelper package list"
echo "$packageName $packageGitHubUser $packageGitHubBranch" >> "$packageListFile"
fi
Expand Down
8 changes: 3 additions & 5 deletions DbusSettingsResources
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ source "/data/SetupHelper/LogHandler"

updateDbusStringSetting ()
{
local oldValue

oldValue=$(dbus-send --system --print-reply=literal --dest=com.victronenergy.settings "$1"\
com.victronenergy.BusItem.GetValue 2> /dev/null | awk '{print $2}')
if [ -z $oldValue ]; then
dbus-send --system --print-reply=literal --dest=com.victronenergy.settings "$1"\
com.victronenergy.BusItem.GetValue 2> /dev/null | awk '{print $2}'
if (( $? != 0 )); then
logMessage "creating dbus Setting $1"
dbus -y com.victronenergy.settings / AddSettings "%[ {\"path\":\"$1\", \"default\":\"\"} ]" &> /dev/null
fi
Expand Down
2 changes: 2 additions & 0 deletions blindInstall
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ while [ $(dbus -y | grep -c "com.victronenergy.settings") == 0 ]; do
sleep 1
done

sleep 2

logMessage "starting up"

# a package setup script normally prompts for user input
Expand Down
19 changes: 16 additions & 3 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,30 @@ if [ $scriptAction == 'INSTALL' ] ; then
cp "$scriptDir/defaultPackageList" "$packageListFile"
fi

# check both parameters to insure they are both created
dbus-send --system --print-reply=literal --dest=com.victronenergy.settings /Settings/PackageVersion/CheckingPackage\
com.victronenergy.BusItem.GetValue &> /dev/null
com.victronenergy.BusItem.GetValue &> /dev/null
if (( $? != 0 )); then
settingsInstalled=false
# first setting exists, check the second
else
dbus-send --system --print-reply=literal --dest=com.victronenergy.settings /Settings/PackageVersion/GitHubAutoUpdate\
com.victronenergy.BusItem.GetValue &> /dev/null
if (( $? != 0 )); then
settingsInstalled=false
else
settingsInstalled=true
fi
fi
if ! $settingsInstalled ; then
logMessage "creating SetupHelper Settings"
dbus -y com.victronenergy.settings /Settings AddSettings\
'%[ {"path": "/PackageVersion/GitHubAutoUpdate", "default":0},\
{"path": "/PackageVersion/CheckingPackage", "default":""},]' > /dev/null
# relocate options and current values
moveSetting "$setupOptionsDir/autoGitHubUpdate" "/Settings/GuiMods/GitHubAutoUpdate" "/PackageVersion/GitHubAutoUpdate"
moveSetting "$setupOptionsDir/autoGitHubUpdate" "/Settings/GuiMods/GitHubAutoUpdate" "/Settings/PackageVersion/GitHubAutoUpdate"
rm -f "$setupOptionsDir/autoGitHubUpdate"
moveSetting "" "/Settings/GuiMods/CheckingPackage" "/PackageVersion/CheckingPackage"
moveSetting "" "/Settings/GuiMods/CheckingPackage" "/Settings/PackageVersion/CheckingPackage"
fi


Expand Down
Binary file modified venus-data.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.10
v3.11

0 comments on commit db2341a

Please sign in to comment.