-
-
Notifications
You must be signed in to change notification settings - Fork 26
fix(package): detect current user when installing DEB through a GUI #757
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
base: main
Are you sure you want to change the base?
Conversation
resources-linux/postinst
Outdated
| fi | ||
|
|
||
| # Method 2: Check loginctl for latest session | ||
| username=$(loginctl list-users --no-legend | awk '$1 >= 1000 {print $2; exit}') |
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 don't think this is correct on a multi-user environment
| SESSION_ID=$(loginctl show-seat seat0 -p ActiveSession --value) | ||
| username=$(loginctl show-session "$SESSION_ID" -p Name --value) |
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'm not sure if it's correct to rely on seat0 being the one running the installation, but I don't know much about multi-seat environments so I could be wrong. Maybe it's better to do something like loginctl show-session $(cat /proc/self/sessionid) -p Name --value?
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'm also not very familiar with multi-seat setups, but my understanding is that in typical workstation situation it's always the default seat0 since each seat corresponds to a set of hardware (keyboard, mouse etc).
There would be more than one in for example some thin-client setup, which we don't explicitly support.
I did run some tests on Ubuntu 22/24, Debian 12/13 and Fedora and this approach seems to work.
Add a fallback method for checking current user in the DEB & RPM package postinst script. This should enable the package to determine current user when being installed from a GUI frontend (Ubuntu App Center etc).
Closes #755