-
-
Notifications
You must be signed in to change notification settings - Fork 713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer rollback option for interactive upgrading #11771
Changes from 1 commit
894bc9a
5f2fd7e
ae2e96c
87f42d6
ac0ecf0
ce620d4
23ab8fe
1b20af6
518d01f
0643027
8e65a13
f7d687e
17f583a
60fce98
151376e
9825043
9790c8b
02b00e7
b97771c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This reverts commit 0643027.
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,44 +24,45 @@ if [ -f /tmp/oldevcc ] && [ $INTERACTIVE -eq 1 ]; then | |
checkConfigOutput=$(/usr/bin/evcc checkconfig 2>&1 || true) | ||
oldevccversion=$(/tmp/oldevcc -v) | ||
newevccversion=$(/usr/bin/evcc -v) | ||
if echo "$checkConfigOutput" | grep -q "config valid"; then | ||
if [ "$oldevccversion" = "$newevccversion" ]; then | ||
echo "--------------------------------------------------------------------------------" | ||
echo "Old evcc version detected. To apply the new version, please reinstall evcc. (e.g. apt-get reinstall evcc)" | ||
echo "--------------------------------------------------------------------------------" | ||
else | ||
if echo "$checkConfigOutput" | grep -q "config valid"; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if [ "$checkConfigOutput" = "config valid" ] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Solche Änderungen kannst Du auch direkt inline zum applien vorschlagen ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes no sense at this point. If successful, the checkconfig command does not return exactly "config valid", but also dynamic information such as the version number. It should therefore be checked for contains and not for equals. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry about that. I checked what the command does, but apparently I did not look close enough. My bad. |
||
|
||
if [ "$oldevccversion" = "$newevccversion" ]; then | ||
echo "--------------------------------------------------------------------------------" | ||
echo "Old evcc version detected. To apply the new version, please reinstall evcc. (e.g. apt-get reinstall evcc)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is somewhat confusing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I understand that. To explain it: If the version in /tmp/oldevcc is the same as /usr/bin/evcc, then a rollback was done before and then the apt-get install command was used (again). In order to really get the latest binary after correcting the config, either a newer release must be installed with apt-get install, or the current release must be reinstalled with apt-get reinstall. Perhaps you have an idea for a more suitable feedback? Here is an example of dpkg -s evcc after a rollback: klein@NPC:~/evcc$ dpkg -s evcc
Package: evcc
Status: install ok half-configured
Priority: optional
Installed-Size: 78064
Maintainer: andig <cpuidle@gmx.de>
Architecture: amd64
Version: 0.123.9~next ----> But Binary is 0.123.8
Config-Version: 0.123.8
Description: EV Charge Controller
Homepage: https://evcc.io There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I'm even more confused. 😅 |
||
echo "--------------------------------------------------------------------------------" | ||
else | ||
rm -rf /tmp/oldevcc | ||
fi | ||
fi | ||
else | ||
if [ "$oldevccversion" = "$newevccversion" ]; then | ||
echo "--------------------------------------------------------------------------------" | ||
echo "Old evcc version detected. To apply the new version, please reinstall evcc. (e.g. apt-get reinstall evcc)" | ||
echo "--------------------------------------------------------------------------------" | ||
else | ||
echo "--------------------------------------------------------------------------------" | ||
echo "ERROR: your evcc configuration is not compatible with the new version. Please consider reading the release notes: https://github.com/evcc-io/evcc/releases" | ||
echo "checkconfig Output:" | ||
echo "$checkConfigOutput" | ||
echo "--------------------------------------------------------------------------------" | ||
|
||
while true; do | ||
echo "Do you want to keep your old (working) evcc version? [Y/n]: " | ||
read choice | ||
case "$choice" in | ||
n*|N*|"") | ||
echo "We will keep the new version. Your evcc configuration stays untouched!" | ||
break | ||
;; | ||
y*|Y*) | ||
echo "The old version will be restored. Your evcc configuration stays untouched! Consider reinstalling the new version after fixing your configuration. (e.g. apt-get reinstall evcc)" | ||
cp -r /tmp/oldevcc /usr/bin/evcc | ||
failInstallation=1 | ||
break | ||
;; | ||
*) | ||
;; | ||
esac | ||
done | ||
if [ "$oldevccversion" = "$newevccversion" ]; then | ||
echo "--------------------------------------------------------------------------------" | ||
echo "Old evcc version detected. To apply the new version, please reinstall evcc. (e.g. apt-get reinstall evcc)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
echo "--------------------------------------------------------------------------------" | ||
else | ||
echo "--------------------------------------------------------------------------------" | ||
echo "ERROR: your evcc configuration is not compatible with the new version. Please consider reading the release notes: https://github.com/evcc-io/evcc/releases" | ||
echo "checkconfig Output:" | ||
echo "$checkConfigOutput" | ||
echo "--------------------------------------------------------------------------------" | ||
while true; do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either this while-block is incorrectly indented, or it is accidentally added to the else branch above. (Or Github UI is messing up my view...) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The indentation issue has been resolved. However, I can confirm that the placement of the loop is correct. |
||
echo "Do you want to keep your old (working) evcc version? [Y/n]: " | ||
read choice | ||
case "$choice" in | ||
n*|N*|"") | ||
echo "We will keep the new version. Your evcc configuration stays untouched!" | ||
break | ||
;; | ||
y*|Y*) | ||
echo "The old version will be restored. Your evcc configuration stays untouched! Consider reinstalling the new version after fixing your configuration. (e.g. apt-get reinstall evcc)" | ||
cp -r /tmp/oldevcc /usr/bin/evcc | ||
failInstallation=1 | ||
break | ||
;; | ||
*) | ||
;; | ||
esac | ||
done | ||
fi | ||
fi | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of the OR with
true
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback. The modification to this line is intended to prevent the package manager from halting the script execution if the subcommand returns a non-zero exit code. By appending '|| true'.
I have run some tests on the behaviour of the package manager that we can discuss (as soon as I have more time). This may result in a few more changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK interesting - especially the part about the subcommand / subshell RC influencing postinstall.sh. I would fail to see how postinstall.sh can even know about any RC from the variable substitution as it does not capture it. But I'll take your word for it.
Feel free to mark this as resolved and to ping me again on this subject once you had the time to fiddle around more, and want to bounce around ideas.