In my deb-package I add user to 'dialout' group in the postinst
script:
usermod -aG dialout $SUDO_USER
And I want the new settings to be applied without rebooting:
newgrp dialout
But there is the trouble: newgrp
logs in user to new session, so we hang while installing (you should enter exit
in console). So, such command is unsuitable for deb-postinstall.
Are there any other possibilities?
The install script can't change the group of an existing user without logging them out (which it cannot do either). But you can display an instruction to the installing user to suggest they (add themselves to the new group and) exec sg dialout
if they want to avoid logging out and back in.
Perhaps also notice that postinst
(or generally any packaging script) cannot invoke commands which require user interaction. The system should be able to install the package while running completely unattended.