fix: add args input use --install from now onward

This commit is contained in:
Дмитрий Абдрахманов 2024-10-07 10:03:55 +03:00
parent 20f139fc76
commit 4f97e1efc3
2 changed files with 21 additions and 11 deletions

View File

@ -2,13 +2,21 @@ import filecmp
import subprocess
import os
from time import sleep
from server import weather_run
def install():
def install(parsed):
args = parsed.parse_args()
if args.install:
projectDir = "/home/citrullux/ModernOSLabs"
delivered=filecmp.cmp(projectDir+"/services/wthrc.service", "/home/citrullux/.config/systemd/user/wthrc.service", shallow=True)
delivered = filecmp.cmp(
projectDir + "/services/wthrc.service",
"/home/citrullux/.config/systemd/user/wthrc.service",
shallow=True,
)
if not delivered:
os.environ["DIR"] = projectDir
subprocess.call(["/usr/bin/sh", projectDir + "/scripts/install.sh"])
subprocess.call(["/usr/bin/sh", projectDir + "/scripts/runner.sh"])
sleep(5)
weather_run()

View File

@ -1,5 +1,7 @@
from server import weather_run
from installer import install
import argparse
install()
weather_run()
parsed = argparse.ArgumentParser()
parsed.add_argument("--install", "-i", action="store_true")
install(parsed)