From 9f6739b8555e35317c69f8a5024aa4e41e067a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=B1?= =?UTF-8?q?=D0=B4=D1=80=D0=B0=D1=85=D0=BC=D0=B0=D0=BD=D0=BE=D0=B2?= <565963@gmail.com> Date: Mon, 7 Oct 2024 10:57:04 +0300 Subject: [PATCH] fix: absolute path deleted --- scripts/install.sh | 6 +++++- scripts/main.sh | 7 ++++++- src/installer.py | 8 +++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 693a447..2f5aa26 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,7 +1,11 @@ #!/bin/bash +SCRIPT=$(readlink -f "$0") +DIR=$(dirname "$SCRIPT") + # Update daemon files -/usr/bin/cp -ur $DIR/services/* ~/.config/systemd/user +cd $DIR +cp -ur ../services/* ~/.config/systemd/user # Daemon launch /usr/bin/systemctl --user daemon-reload diff --git a/scripts/main.sh b/scripts/main.sh index 27291ad..5ff15a9 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -1,3 +1,8 @@ #!/bin/bash -/usr/bin/curl localhost:8000 > ./__data__/data.out \ No newline at end of file +SCRIPT=$(readlink -f "$0") +DIR=$(dirname "$SCRIPT") + +cd $DIR +mkdir -p ../__data__/ +curl localhost:8000 > ../__data__/data.out \ No newline at end of file diff --git a/src/installer.py b/src/installer.py index 97fceb1..1ecb16b 100644 --- a/src/installer.py +++ b/src/installer.py @@ -3,15 +3,17 @@ import subprocess import os from time import sleep from server import weather_run +from pathlib import Path -def install(parsed): +def install(parsed) -> None: args = parsed.parse_args() if args.install: - projectDir = "/home/citrullux/ModernOSLabs" + projectDir = str(Path(__file__).resolve().parent.parent) + homeDir = os.getenv("HOME") delivered = filecmp.cmp( projectDir + "/services/wthrc.service", - "/home/citrullux/.config/systemd/user/wthrc.service", + homeDir + "/.config/systemd/user/wthrc.service", shallow=True, ) if not delivered: