change format from executable gophermap to include user script

This commit is contained in:
Ben Harris 2020-05-14 10:19:17 -04:00
parent e7936d9f8b
commit 9064bb4e57
2 changed files with 32 additions and 29 deletions

44
gophermap Executable file → Normal file
View File

@ -1,37 +1,23 @@
#!/usr/bin/env python3
import filecmp
import os
def users():
return sorted(os.listdir("/home"), key=lambda x: x.lower())
HEADER = """
!tilde.team
=/usr/bin/figlet -f slant tilde.team
ia digital community for socializing, learning, and making cool stuff null.host 1
iwelcome to tilde.team! null.host 1
i null.host 1
itilde.team is a free pubnix: a shared system that provides an inclusive, null.host 1
inon-commercial space for teaching, learning, and socializing null.host 1
i null.host 1
itilde.team is a founding member of the null.host 1
a digital community for socializing, learning, and making cool stuff
welcome to tilde.team!
tilde.team is a free pubnix: a shared system that provides an inclusive,
non-commercial space for teaching, learning, and socializing
tilde.team is a founding member of the
1tildeverse / tildeverse.org 70
iwhich is a collaborative effort among several tilde servers null.host 1
i null.host 1
which is a collaborative effort among several tilde servers
1wiki /wiki tilde.team 70
i null.host 1
ijoin the team today! null.host 1
join the team today!
hsignup for a tilde.team account URL:https://tilde.team/signup/ tilde.team 70
i null.host 1
ihere's a list of our esteemed users: null.host 1
iif you aren't appearing on this list, change your base gophermap null.host 1
"""
LINK = "1~{0} /~{0} tilde.team 70"
here's a list of our esteemed users:
iif you aren't appearing on this list, change your base gophermap
print(HEADER)
for user in users():
if os.path.exists("/home/{}/public_gopher/gophermap".format(user)):
if not filecmp.cmp("/etc/skel/public_gopher/gophermap", "/home/{}/public_gopher/gophermap".format(user), shallow=False):
print(LINK.format(user))
=./users.py

17
users.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
import filecmp
import os
def users():
return sorted(os.listdir("/home"), key=lambda x: x.lower())
LINK = "1~{0} /~{0} tilde.team 70"
for user in users():
if os.path.exists(f"/home/{user}/public_gopher/gophermap"):
if not filecmp.cmp(
"/etc/skel/public_gopher/gophermap",
f"/home/{user}/public_gopher/gophermap",
shallow=False):
print(LINK.format(user))