diff --git a/.gitignore b/.gitignore index 413672f..d410c10 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__ -__data__ \ No newline at end of file +__data__ +.vscode \ No newline at end of file diff --git a/scripts/conky_install.sh b/scripts/conky_install.sh new file mode 100644 index 0000000..68e33fe --- /dev/null +++ b/scripts/conky_install.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +SCRIPT=$(readlink -f "$0") +DIR=$(dirname "$SCRIPT") + +# Create dirrectory for systemd and conky scripts +mkdir -p $HOME/.config/conky + +# Copy conky config +cd $DIR +cp -r ../configs/* ~/.config/conky + +# Daemon launch +/usr/bin/systemctl --user daemon-reload + +/usr/bin/systemctl --user enable conkyconf.service + +echo "Done conky installer" \ No newline at end of file diff --git a/scripts/main.sh b/scripts/main.sh index 5ff15a9..6799eb3 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -5,4 +5,4 @@ DIR=$(dirname "$SCRIPT") cd $DIR mkdir -p ../__data__/ -curl localhost:8000 > ../__data__/data.out \ No newline at end of file +curl localhost:7841 > ../__data__/data.out \ No newline at end of file diff --git a/scripts/install.sh b/scripts/service_install.sh similarity index 66% rename from scripts/install.sh rename to scripts/service_install.sh index d442041..a4e2f72 100644 --- a/scripts/install.sh +++ b/scripts/service_install.sh @@ -6,22 +6,18 @@ DIR=$(dirname "$SCRIPT") # Create dirrectory for systemd and conky scripts cd $HOME/.config/ mkdir -p systemd -mkdir -p conky cd systemd/ mkdir -p user # Update daemon files cd "$DIR" -cp -ur ../services/* ~/.config/systemd/user +cp -r ../services/* ~/.config/systemd/user -# Copy conky config -cp -ur ../configs/* ~/.config/conky # Daemon launch /usr/bin/systemctl --user daemon-reload /usr/bin/systemctl --user enable wthrc.service /usr/bin/systemctl --user enable conky.service -/usr/bin/systemctl --user enable conkyconf.service echo "Done installer" \ No newline at end of file diff --git a/src/installer.py b/src/installer.py index 53c2270..1b23898 100644 --- a/src/installer.py +++ b/src/installer.py @@ -6,7 +6,8 @@ from pathlib import Path def install() -> None: - delivered = False + serviceDelivered = False + conkyDelivered = False projectDir = Path(__file__).resolve().parent.parent homeDir = Path(os.getenv("HOME")) @@ -48,12 +49,23 @@ def install() -> None: services, shallow=True, ) - if delivered[2] != [] or delivered[1] != []: - delivered = bool(False) + if delivered[2] == [] and delivered[1] == []: + serviceDelivered = True - if not delivered or not serviceDirExist: - os.environ["DIR"] = str(projectDir) - subprocess.call(["sh", os.path.join(projectDir, "scripts/install.sh")]) + conkyDirExist = os.path.isdir(os.path.join(homeDir, ".config/conly/")) + if conkyDirExist: + delivered = filecmp.cmp( + os.path.join(projectDir, "services/conky.conf"), + os.path.join(homeDir, ".config/systemd/user/conky.conf"), + shallow=True, + ) + if delivered: + conkyDelivered = True + + if not serviceDelivered or not serviceDirExist: + subprocess.call(["sh", os.path.join(projectDir, "scripts/service_install.sh")]) + if not conkyDelivered or not conkyDirExist: + subprocess.call(["sh", os.path.join(projectDir, "scripts/conky_install.sh")]) subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")]) sleep(5)