From 0efce70b8babf15d603c939f80aa033bcd02209e Mon Sep 17 00:00:00 2001 From: Stephan Pauxberger Date: Sat, 25 Feb 2023 20:49:25 +0100 Subject: [PATCH] Make preinstall warnings more visible (#6447) Add some additional explanations/hints --- packaging/scripts/preinstall.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/packaging/scripts/preinstall.sh b/packaging/scripts/preinstall.sh index 30aab2317..2a2fd67f1 100644 --- a/packaging/scripts/preinstall.sh +++ b/packaging/scripts/preinstall.sh @@ -21,9 +21,14 @@ copyDbToUserDir() { COPIED_FLAG="$CURRENT_HOME/.evcc/.copiedToEvccUser" if [ -f "$CURRENT_HOME/.evcc/evcc.db" ] && [ ! -f "$COPIED_FLAG" ]; then if [ -f "$EVCC_HOME/evcc.db" ]; then - echo "Not copying $CURRENT_HOME/.evcc/evcc.db to $EVCC_HOME/evcc.db, since there is already a database there" - echo "Either delete one of the databases or run 'touch $COPIED_FLAG' to keep both." + echo "--------------------------------------------------------------------------------" + echo "Not copying $CURRENT_HOME/.evcc/evcc.db to $EVCC_HOME/evcc.db, since there is" + echo "already a database there." + echo "Either delete one of the databases or run 'touch $COPIED_FLAG' to keep both," echo "then restart installation." + echo "Hint: usually the larger one is the one to keep." + ls -la "$CURRENT_HOME/.evcc/evcc.db" "$EVCC_HOME/evcc.db" + echo "--------------------------------------------------------------------------------" exit 1 else cp -Rp "$CURRENT_HOME"/.evcc/evcc.db "$EVCC_HOME" @@ -31,15 +36,20 @@ copyDbToUserDir() { chown "$EVCC_USER:$EVCC_GROUP" "$EVCC_HOME/evcc.db" touch "$COPIED_FLAG" if [ -n "$(ls -A /etc/systemd/system/evcc.service.d 2>/dev/null)" ]; then + echo "--------------------------------------------------------------------------------" echo "You have overrides defined in /etc/systemd/system/evcc.service.d." - echo "This update changes the evcc user to 'evcc' (from root) and the database file to '/var/lib/evcc/evcc.db" + echo "This update changes the evcc user to 'evcc' (from root) and the database file" + echo "to '/var/lib/evcc/evcc.db" echo "Make sure that you neither override 'User' nor 'ExecStart'" echo "Hint: you can delete all overrides with 'systemctl revert evcc'" echo "As a precaution, evcc is not started even if it was previously started." + echo "--------------------------------------------------------------------------------" rm -f "$RESTART_FLAG_FILE" else + echo "--------------------------------------------------------------------------------" echo "NOTE: evcc user has changed from $CURRENT_USER to $EVCC_USER, db has been copied to new" echo "directory $EVCC_HOME/evcc.db, old db in $CURRENT_USER/.evcc has been retained." + echo "--------------------------------------------------------------------------------" fi fi return 0 @@ -72,9 +82,14 @@ if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then cp "$homedir/.evcc/evcc.db" "$EVCC_HOME" && touch "$homedir/.evcc/.copiedToEvccUser" fi else + echo "--------------------------------------------------------------------------------" echo "Warning: evcc's home directory is incorrect ($homedir)" echo "but can't be changed because another process ($process) is using it." echo "Stop offending process(es), then restart installation" + echo "Note that you should NOT use the evcc user as login user, since that will" + echo "inevitably lead to this error." + echo "in that case, please create a different user as login user." + echo "--------------------------------------------------------------------------------" exit 1 fi fi