-
Notifications
You must be signed in to change notification settings - Fork 402
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
future3 - allow custom username #2132
future3 - allow custom username #2132
Conversation
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. Looks good so far. I had a few minor comments
CONTRIBUTING.md
Outdated
@@ -63,7 +63,7 @@ For bug fixes and improvements just open an issue or PR as described below. If y | |||
* By default this will get you to the `future3/main` branch. You will move to the `future3/develop` branch, do this: | |||
|
|||
~~~bash | |||
cd /home/pi/RPi-Jukebox-RFID | |||
cd /home/$USER/RPi-Jukebox-RFID |
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.
Could we also use cd ~/RPi-Jukebox-RFID
?
I wonder if this is sufficient. It seems we have avoided this notation in the past...
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.
There are a few places in the docs and comments that state to not use '~' .
In fact i dont know the problems that led to this statements.
Here it should be not a problem, but dont know for the config files.
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.
I remember in an old project we had the problem that ~ wouldn't resolve to the correct path under some circumstances, but unfortunately I don't remember the details anymore.
But if we tested it and it works I see no problem using it.
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.
Maybe its a problem, if a service is run as root and not as user?
Do we still have those?
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.
Not really, I'd say. We do everything within the user, even in Docker. Should be ok. But must be tested of course.
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.
I think we should check this and if it makes definition easier, but in another PR.
What do you think?
@@ -8,6 +8,6 @@ browser for now. | |||
## Configuration | |||
|
|||
In `jukebox.yaml` (and all other config files): do not use relative paths with `~/some/dir`. | |||
Always use entire explicit path, e.g. `/home/pi/some/dir`. | |||
Always use relativ path from settingsfile '../../' |
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.
My comment here would be similar to the one above. There is a also a context flaw here:
- In line 10, we say: "do not use relative paths"
- In line 11, we say: "Always use relativ path from" -> there is also a typo ;-)
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.
See above.
- is says dont use relative paths with '~'. But it can be misleading. i rephrased it.
installation/install-jukebox.sh
Outdated
# currently the user 'pi' is mandatory | ||
# https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1785 | ||
_check_user() { | ||
if [ "${CURRENT_USER}" != "pi" ]; then | ||
echo | ||
echo "ERROR: User must be 'pi'!" | ||
echo " Other usernames are currently not supported." | ||
echo " Please check the wiki for further information" | ||
exit 2 | ||
fi | ||
|
||
if [ "${HOME_PATH}" != "/home/pi" ]; then | ||
echo | ||
echo "ERROR: HomeDir must be '/home/pi'!" | ||
echo " Other usernames are currently not supported." | ||
echo " Please check the wiki for further information" | ||
exit 2 | ||
fi | ||
|
||
if [ ! -d "${HOME_PATH}" ]; then | ||
echo | ||
echo "ERROR: HomeDir ${HOME_PATH} does not exist." |
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.
Do we need this at all now? We can expect that there is a home directory available.
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.
It should be present, but doesn't harm to make sure ^^
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.
I think we should remove it. It's a default expectation that a home directory exists. You also don't check if a kernel exists :-) We can anticipate this now and we only had this because we wanted to avoid people using custom usernames. since this is now resolved, we should remove the check. In 1 year from now, if we only look at this code we don't know anymore why this was added
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.
Less code is always better ;-)
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.
removed.
The installation will already abort in the next step if the home_path is not present ^^
cd "${HOME_PATH}" || exit_on_error "ERROR: Changing to home dir failed." |
@@ -1,5 +1,5 @@ | |||
# IMPORTANT: | |||
# Do not use paths with '~/some/dir' - always use '/home/pi/some/dir' | |||
# Do not use paths with '~/some/dir' - always use relativ path from settingsfile '../../' |
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.
Typo: "relative"
TEST_USER_NAME: hans | ||
TEST_USER_GROUP: wurst | ||
TEST_USER_NAME: testuser | ||
TEST_USER_GROUP: testusergroup |
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.
That's a sad change 😄
* removed hardcoded references to user "pi" * removed check userNotPi * change testuser in workflow and container * updated docs * updated comments and docs * updated comments and docs * remove extra home_path check * changes testuser name and group
Allow custom usernames others then 'pi'
The docker setup has still some hardcoded references to the pi home. I didnt changes that so far.