fix: check for service directory existing.

This commit is contained in:
Дмитрий Абдрахманов 2024-10-09 15:54:41 +03:00
parent 7685ca2330
commit 7bd485ffe6
2 changed files with 14 additions and 8 deletions

View File

@ -5,9 +5,9 @@ DIR=$(dirname "$SCRIPT")
# Create dirrectory for systemd scripts
cd $HOME/.config/
mkdir systemd
mkdir -p systemd
cd systemd/
mkdir user
mkdir -p user
# Update daemon files
cd "$DIR"

View File

@ -11,15 +11,21 @@ def install(parsed) -> None:
if args.install:
projectDir = str(Path(__file__).resolve().parent.parent)
homeDir = os.getenv("HOME")
serviceDirExist = os.path.isdir(homeDir + "/.config/systemd/user/")
delivered = False
if serviceDirExist:
delivered = filecmp.cmp(
projectDir + "/services/wthrc.service",
homeDir + "/.config/systemd/user/wthrc.service",
shallow=True,
)
if not delivered:
if not delivered or not serviceDirExist:
os.environ["DIR"] = projectDir
subprocess.call(["sh", projectDir + "/scripts/install.sh"])
subprocess.call(["sh", projectDir + "/scripts/runner.sh"])
sleep(5)
else:
weather_run()