fix home dir searching
This commit is contained in:
parent
d5d5376e47
commit
83c5127414
1 changed files with 5 additions and 1 deletions
|
@ -206,11 +206,15 @@ class LoginPart(Part):
|
||||||
self.fragments.append(style_reset())
|
self.fragments.append(style_reset())
|
||||||
|
|
||||||
def list_homes():
|
def list_homes():
|
||||||
|
already_listed = set()
|
||||||
|
|
||||||
with open("/etc/passwd") as f:
|
with open("/etc/passwd") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
tokens = line.split(":")
|
tokens = line.split(":")
|
||||||
|
|
||||||
if tokens[5] != "/dev/null":
|
if tokens[5] != "/dev/null":
|
||||||
|
if tokens[5] not in already_listed:
|
||||||
|
already_listed.add(tokens[5])
|
||||||
yield (tokens[5], tokens[0])
|
yield (tokens[5], tokens[0])
|
||||||
|
|
||||||
class Dir:
|
class Dir:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue