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):
args = parsed.parse_args()
if args.install:
projectDir = "/home/citrullux/ModernOSLabs" 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: if not delivered:
os.environ["DIR"] = projectDir os.environ["DIR"] = projectDir
subprocess.call(["/usr/bin/sh", projectDir + "/scripts/install.sh"]) subprocess.call(["/usr/bin/sh", projectDir + "/scripts/install.sh"])
subprocess.call(["/usr/bin/sh", projectDir + "/scripts/runner.sh"]) subprocess.call(["/usr/bin/sh", projectDir + "/scripts/runner.sh"])
sleep(5) 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)