TomWhitwell / SlowMovie

MIT License
342 stars 67 forks source link

Dynamic Install Path #136

Closed robweber closed 1 year ago

robweber commented 1 year ago

With newer versions of the Raspberry Pi OS you can't count on the default pi user being the path for the home folder anymore. This PR attempts to modify the install procedure and the install script to insert the current user name in places where a full path is needed. For the install.sh script this is pretty simple. I just replaced any hardcoded paths from /home/pi to /home/$USER.

The one piece that was a little tricky was the slowmovie.service file. This needed to be updated on the fly rather than a static file with hardcoded paths. I utilized the envsubst shell function to generate the service file from a template and then move that file to the correct location.

Limitations

This is a 1:1 replacement for the current install procedure. It doesn't try and account for more dynamic path options like someone having a completely different path for the SlowMovie install other than as a subdirectory in the user's home folder (/home/$USER/SlowMovie). That could probably be added based on these modifications but that wasn't the intent here.

missionfloyd commented 1 year ago

/home/$USER can be shortened to $HOME or ~

robweber commented 1 year ago

Good thought - I was going for simplest solution (literally did a find replace) but using $HOME makes more sense.