initial commit

This commit is contained in:
2026-04-27 11:35:05 +02:00
parent b8e85624b9
commit feda943270
19 changed files with 2381 additions and 2 deletions

46
mon_pkg_update.py Normal file
View File

@@ -0,0 +1,46 @@
import subprocess
def pullTags():
result = subprocess.run(['git', 'fetch', '--tags'], stdout=subprocess.PIPE)
def getCurrentTag():
result = subprocess.run(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE)
result = result.stdout.decode('utf-8')[:-1]
result = subprocess.run(['git', 'name-rev', '--tags', '--name-only', result], stdout=subprocess.PIPE)
result = result.stdout.decode('utf-8')[:-1]
return result
def checkTag():
pullTags()
result = subprocess.run(['git', 'tag'], stdout=subprocess.PIPE)
result = result.stdout.decode('utf-8')[:-1].split('\n')
latest_tag = getCurrentTag()
for tag in result:
if float(tag[1:]) > float(latest_tag[1:]):
latest_tag = tag
return latest_tag
def update(recursive=False):
current_tag = getCurrentTag()
latest_tag = checkTag()
if recursive:
print(current_tag, latest_tag)
if current_tag != latest_tag:
print("update")
result = subprocess.run(['git', 'checkout', latest_tag], stdout=subprocess.PIPE)
update(recursive=True)
else:
print("no update nessesary")
result = subprocess.run(['systemctl', 'restart', 'hardware-monitor.service'], stdout=subprocess.PIPE)
if __name__ == "__main__":
update()