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 subprocess
import os import os
from time import sleep from time import sleep
from server import weather_run
def install(): def install(parsed):
projectDir="/home/citrullux/ModernOSLabs" args = parsed.parse_args()
delivered=filecmp.cmp(projectDir+"/services/wthrc.service", "/home/citrullux/.config/systemd/user/wthrc.service", shallow=True) if args.install:
if not delivered: projectDir = "/home/citrullux/ModernOSLabs"
os.environ["DIR"]=projectDir delivered = filecmp.cmp(
subprocess.call(["/usr/bin/sh", projectDir+"/scripts/install.sh"]) projectDir + "/services/wthrc.service",
subprocess.call(["/usr/bin/sh", projectDir+"/scripts/runner.sh"]) "/home/citrullux/.config/systemd/user/wthrc.service",
sleep(5) 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 from installer import install
import argparse
install() parsed = argparse.ArgumentParser()
weather_run() parsed.add_argument("--install", "-i", action="store_true")
install(parsed)