Skip to content
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

Debian/Ubuntu: use non-root evcc user #4901

Merged
merged 6 commits into from
Feb 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix copy/paste error, touch only after successful copy
  • Loading branch information
pauxus committed Jan 2, 2023
commit 6b6aadf67911c472d98fd0a719a67deb3fe39521
6 changes: 3 additions & 3 deletions packaging/scripts/preinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ EVCC_USER=evcc
EVCC_GROUP=evcc
EVCC_HOME="/var/lib/$EVCC_USER"
RESTART_FLAG_FILE=/var/lib/evcc/.restartOnUpgrade
COPIED_FLAG=/root/.evcc/.copiedToEvccUser

copyDbToUserDir() {
if [ -d /root/.evcc ] && [ ! -f /root/.evcc/.copiedToEvccUser ]; then
touch /var/lib/openhab2/.copiedToEvccUser

if [ -d /root/.evcc ] && [ ! -f $COPIED_FLAG ]; then
if [ -d /run/systemd/system ] && /bin/systemctl status evcc.service > /dev/null 2>&1; then
deb-systemd-invoke stop evcc.service >/dev/null || true
touch ${RESTART_FLAG_FILE}
fi
/bin/cp -Rp /root/.evcc/evcc.db "$EVCC_HOME"
pauxus marked this conversation as resolved.
Show resolved Hide resolved
chown "$EVCC_USER:$EVCC_GROUP" "$EVCC_HOME/evcc.db"
touch "$COPIED_FLAG"
fi
return 0
}
Expand Down