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 # Create dirrectory for systemd scripts
cd $HOME/.config/ cd $HOME/.config/
mkdir systemd mkdir -p systemd
cd systemd/ cd systemd/
mkdir user mkdir -p user
# Update daemon files # Update daemon files
cd "$DIR" cd "$DIR"

View File

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