0.0.1
This commit is contained in:
@@ -18,6 +18,7 @@ exactly what's missing.
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import getpass
|
||||||
import grp
|
import grp
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
@@ -127,11 +128,29 @@ fix: echo 'KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=
|
|||||||
| sudo tee /etc/udev/rules.d/99-uinput.rules
|
| sudo tee /etc/udev/rules.d/99-uinput.rules
|
||||||
sudo udevadm control --reload-rules && sudo udevadm trigger""")
|
sudo udevadm control --reload-rules && sudo udevadm trigger""")
|
||||||
|
|
||||||
|
# Two distinct failures here, with completely different fixes:
|
||||||
|
# (a) not in the group at all -> usermod
|
||||||
|
# (b) in the group, but this login -> log out / newgrp
|
||||||
|
# session predates the change
|
||||||
|
user = getpass.getuser()
|
||||||
try:
|
try:
|
||||||
in_input = grp.getgrnam("input").gr_gid in os.getgroups()
|
group = grp.getgrnam("input")
|
||||||
|
in_db = user in group.gr_mem
|
||||||
|
in_session = group.gr_gid in os.getgroups()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
in_input = False
|
in_db = in_session = False
|
||||||
check("you are in the 'input' group", in_input, """
|
|
||||||
|
if in_session:
|
||||||
|
check("you are in the 'input' group", True)
|
||||||
|
elif in_db:
|
||||||
|
check("'input' group active in this session", False, """
|
||||||
|
You ARE in the group, but this login session started before that
|
||||||
|
happened, so your processes never got it.
|
||||||
|
|
||||||
|
fix: log out and back in (or reboot)
|
||||||
|
to test right now without logging out: newgrp input""")
|
||||||
|
else:
|
||||||
|
check("you are in the 'input' group", False, """
|
||||||
fix: sudo usermod -aG input $USER
|
fix: sudo usermod -aG input $USER
|
||||||
then LOG OUT and back in — group changes need a new session""")
|
then LOG OUT and back in — group changes need a new session""")
|
||||||
|
|
||||||
@@ -503,4 +522,4 @@ def main() -> None:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
Reference in New Issue
Block a user