netbrain / zwift

Easily zwift on linux
The Unlicense
230 stars 27 forks source link

chown step regarding ZWIFT_UID and ZWIFT_GID is run regardless of equality within container in docker. #116

Closed netbrain closed 2 months ago

netbrain commented 2 months ago

Describe the bug Zwift startup hangs on chown of /home/user within container

To Reproduce Steps to reproduce the behavior:

  1. Use docker
  2. Execute ZWIFT_UID=1000 ZWIFT_GID=1000 zwift.sh
  3. Execute docker logs zwift-$USERNAME
  4. See that the last log line within a few seconds is the chown instruction
+ [[ -f /.dockerenv ]]
+ CONTAINER=docker
+ [[ docker == \d\o\c\k\e\r ]]
++ getent passwd user
++ cut -d: -f6
+ ZWIFT_USER_HOME=/home/user
+ ZWIFT_HOME='/home/user/.wine/drive_c/Program Files (x86)/Zwift'
+ mkdir -p '/home/user/.wine/drive_c/Program Files (x86)/Zwift'
+ cd '/home/user/.wine/drive_c/Program Files (x86)/Zwift'
++ id -u user
+ USER_UID=1000
++ id -g user
+ USER_GID=1000
+ '[' -n 1000 ']'
+ '[' 1000 -eq 1000 ']'
+ USER_UID=1000
+ '[' -n 1000 ']'
+ '[' 1000 -eq 1000 ']'
+ USER_GID=1000
+ usermod -o -u 1000 user
usermod: no changes
+ groupmod -o -g 1000 user
+ chown -R 1000:1000 /home/user

Expected behavior If 1000 eq 1000 on both ZWIFT_UID and ZWIFT_GID it should not run the chown instruction

This is a bug because it causes zwift to take quite some time to start the ui due to this chown business. I think it only is an issue for docker however. so podman should still be fast.

netbrain commented 2 months ago

@sHedC :point_up: is this something you would like to look into?

Also found another issue with config files not being sourced early enough. but fixed it in 4613282

sHedC commented 2 months ago

@netbrain - Yes sure I did think of chaning that :)

sHedC commented 2 months ago

@netbrain - do you want to push directly or thought branch and pull request?

netbrain commented 2 months ago

Preferably PR like before. I'll try to do the same with any changes I have.