Skip to content

Commit

Permalink
Fix error if some gids have no group names
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiefMaster committed Jan 27, 2020
1 parent b792011 commit 4e4bd5e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion myd0t.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,21 @@ def update_shell(primary_user):
do_update_shell(primary_user)


def get_group_names():
groups = set()
for g in os.getgroups():
try:
groups.add(grp.getgrgid(g).gr_name)
except KeyError:
continue
return groups


def get_install_mode():
uid = os.geteuid()
is_root = uid == 0
user = pwd.getpwuid(uid).pw_name
groups = {grp.getgrgid(g).gr_name for g in os.getgroups()}
groups = get_group_names()
msg = f'''
Welcome, {Fore.CYAN}{user}{Fore.RESET}!
Expand Down

0 comments on commit 4e4bd5e

Please sign in to comment.