forked from public/mirror-checker
Created GNU mirror status checker
This commit is contained in:
parent
bae3d74f00
commit
4b3f85374e
|
@ -0,0 +1,21 @@
|
||||||
|
"""
|
||||||
|
Contains GNU class
|
||||||
|
"""
|
||||||
|
|
||||||
|
from distro import Distro
|
||||||
|
from shared import CSC_MIRROR, get_sec
|
||||||
|
|
||||||
|
class GNU(Distro):
|
||||||
|
"""GNU class"""
|
||||||
|
@staticmethod
|
||||||
|
def name():
|
||||||
|
"""Get name of GNU"""
|
||||||
|
return "GNU"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check():
|
||||||
|
"""Check if GNU packages are up-to-date"""
|
||||||
|
official_sec = get_sec("https://mirrors.kernel.org/gnu/mirror-updated-timestamp.txt")
|
||||||
|
csc_sec = get_sec(f"{CSC_MIRROR}gnu/mirror-updated-timestamp.txt")
|
||||||
|
# Out-of-sync by 1 day maximum
|
||||||
|
return official_sec < csc_sec + 86400
|
3
main.py
3
main.py
|
@ -8,11 +8,12 @@ import requests
|
||||||
from arch import Arch
|
from arch import Arch
|
||||||
from debian import Debian
|
from debian import Debian
|
||||||
from eclipse import Eclipse
|
from eclipse import Eclipse
|
||||||
|
from gnu import GNU
|
||||||
from kernel import Kernel
|
from kernel import Kernel
|
||||||
from openbsd import OpenBSD
|
from openbsd import OpenBSD
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
for distro in [Arch, Debian, Eclipse, Kernel, OpenBSD]:
|
for distro in [Arch, Debian, Eclipse, GNU, Kernel, OpenBSD]:
|
||||||
try:
|
try:
|
||||||
distro.print_output(distro.check())
|
distro.print_output(distro.check())
|
||||||
except requests.exceptions.RequestException as err:
|
except requests.exceptions.RequestException as err:
|
||||||
|
|
Loading…
Reference in New Issue