fix: conky config delivery

This commit is contained in:
Дмитрий Абдрахманов 2024-10-17 12:27:32 +03:00
parent 9e37b6d531
commit aa2bd4b5f8
5 changed files with 40 additions and 13 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
__pycache__ __pycache__
__data__ __data__
.vscode

18
scripts/conky_install.sh Normal file
View File

@ -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"

View File

@ -5,4 +5,4 @@ DIR=$(dirname "$SCRIPT")
cd $DIR cd $DIR
mkdir -p ../__data__/ mkdir -p ../__data__/
curl localhost:8000 > ../__data__/data.out curl localhost:7841 > ../__data__/data.out

View File

@ -6,22 +6,18 @@ DIR=$(dirname "$SCRIPT")
# Create dirrectory for systemd and conky scripts # Create dirrectory for systemd and conky scripts
cd $HOME/.config/ cd $HOME/.config/
mkdir -p systemd mkdir -p systemd
mkdir -p conky
cd systemd/ cd systemd/
mkdir -p user mkdir -p user
# Update daemon files # Update daemon files
cd "$DIR" cd "$DIR"
cp -ur ../services/* ~/.config/systemd/user cp -r ../services/* ~/.config/systemd/user
# Copy conky config
cp -ur ../configs/* ~/.config/conky
# Daemon launch # Daemon launch
/usr/bin/systemctl --user daemon-reload /usr/bin/systemctl --user daemon-reload
/usr/bin/systemctl --user enable wthrc.service /usr/bin/systemctl --user enable wthrc.service
/usr/bin/systemctl --user enable conky.service /usr/bin/systemctl --user enable conky.service
/usr/bin/systemctl --user enable conkyconf.service
echo "Done installer" echo "Done installer"

View File

@ -6,7 +6,8 @@ from pathlib import Path
def install() -> None: def install() -> None:
delivered = False serviceDelivered = False
conkyDelivered = False
projectDir = Path(__file__).resolve().parent.parent projectDir = Path(__file__).resolve().parent.parent
homeDir = Path(os.getenv("HOME")) homeDir = Path(os.getenv("HOME"))
@ -48,12 +49,23 @@ def install() -> None:
services, services,
shallow=True, shallow=True,
) )
if delivered[2] != [] or delivered[1] != []: if delivered[2] == [] and delivered[1] == []:
delivered = bool(False) serviceDelivered = True
if not delivered or not serviceDirExist: conkyDirExist = os.path.isdir(os.path.join(homeDir, ".config/conly/"))
os.environ["DIR"] = str(projectDir) if conkyDirExist:
subprocess.call(["sh", os.path.join(projectDir, "scripts/install.sh")]) 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")]) subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")])
sleep(5) sleep(5)