From fd2a2746684801ee47a3fb286b901da22b284d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Wed, 27 Jan 2021 16:38:00 +0100 Subject: [PATCH] Add workaround for old ubuntu systemd --- autostart/services/discord.service | 2 +- autostart/services/keepassx.service | 2 +- autostart/services/laptop-lid.service | 3 +-- autostart/services/nextcloud.service | 2 +- autostart/services/restic.service | 2 +- autostart/services/steam.service | 2 +- autostart/services/touchpad.service | 2 +- zsh/zprofile.j2 | 12 ++++++++++++ 8 files changed, 19 insertions(+), 8 deletions(-) diff --git a/autostart/services/discord.service b/autostart/services/discord.service index 35cd383..1c481a8 100644 --- a/autostart/services/discord.service +++ b/autostart/services/discord.service @@ -2,7 +2,7 @@ BindsTo=autostart.target After=windowmanager.target -ConditionEnvironment=MACHINE_HAS_DISCORD=true +ConditionPathExists=%h/.var/run/features/discord [Service] ExecStart=/usr/bin/env discord diff --git a/autostart/services/keepassx.service b/autostart/services/keepassx.service index 26206e7..77dfa17 100644 --- a/autostart/services/keepassx.service +++ b/autostart/services/keepassx.service @@ -1,7 +1,7 @@ [Unit] BindsTo=autostart.target After=windowmanager.target -ConditionEnvironment=MACHINE_HAS_KEEPASSX=true +ConditionPathExists=%h/.var/run/features/keepassx [Service] ExecStart=/usr/bin/env keepassx --keyfile %h/.secret/main.key %h/.secret/main.kdbx diff --git a/autostart/services/laptop-lid.service b/autostart/services/laptop-lid.service index 40eaaa8..f012320 100644 --- a/autostart/services/laptop-lid.service +++ b/autostart/services/laptop-lid.service @@ -1,8 +1,7 @@ [Unit] BindsTo=autostart.target After=windowmanager.target - -ConditionEnvironment=MACHINE_TYPE=laptop +ConditionPathExists=%h/.var/run/features/machine_is_laptop [Service] ExecStart=/usr/bin/env bash -c 'grep "^${ACPI_LID_NAME}.*enabled" /proc/acpi/wakeup && echo " ${ACPI_LID_NAME}" | sudo tee /proc/acpi/wakeup' diff --git a/autostart/services/nextcloud.service b/autostart/services/nextcloud.service index baea4dc..dd19541 100644 --- a/autostart/services/nextcloud.service +++ b/autostart/services/nextcloud.service @@ -3,7 +3,7 @@ BindsTo=autostart.target After=windowmanager.target After=gnome-keyring.service -ConditionEnvironment=MACHINE_HAS_NEXTCLOUD=true +ConditionPathExists=%h/.var/run/features/nextcloud [Service] ExecStart=/usr/bin/env nextcloud --background diff --git a/autostart/services/restic.service b/autostart/services/restic.service index 7413c58..5c3b529 100644 --- a/autostart/services/restic.service +++ b/autostart/services/restic.service @@ -1,5 +1,5 @@ [Unit] -ConditionEnvironment=MACHINE_HAS_RESTIC_BACKUP=true +ConditionPathExists=%h/.var/run/features/restic_backup [Service] Type=oneshot diff --git a/autostart/services/steam.service b/autostart/services/steam.service index ac94d6f..49ab289 100644 --- a/autostart/services/steam.service +++ b/autostart/services/steam.service @@ -3,7 +3,7 @@ BindsTo=autostart.target After=windowmanager.target After=i3.service -ConditionEnvironment=MACHINE_HAS_STEAM=true +ConditionPathExists=%h/.var/run/features/steam [Service] ExecStart=/usr/bin/env steam diff --git a/autostart/services/touchpad.service b/autostart/services/touchpad.service index 5e6f0b2..171016f 100644 --- a/autostart/services/touchpad.service +++ b/autostart/services/touchpad.service @@ -1,7 +1,7 @@ [Unit] BindsTo=autostart.target After=windowmanager.target -ConditionEnvironment=MACHINE_TYPE=laptop +ConditionPathExists=%h/.var/run/features/machine_is_laptop [Service] Type=oneshot diff --git a/zsh/zprofile.j2 b/zsh/zprofile.j2 index 293d6d2..55d9433 100644 --- a/zsh/zprofile.j2 +++ b/zsh/zprofile.j2 @@ -54,6 +54,18 @@ umask 0022 export {{ k }}="{{ v }}" {% endfor %} +export FEATURE_DIR="${RUNDIR}/features/" +rm -rf "${FEATURE_DIR}"/ +mkdir -p "${FEATURE_DIR}" + +[[ $MACHINE_HAS_NEXTCLOUD == "true" ]] && touch "${FEATURE_DIR}"/nextcloud +[[ $MACHINE_HAS_KEEPASSX == "true" ]] && touch "${FEATURE_DIR}"/keepassx +[[ $MACHINE_HAS_STEAM == "true" ]] && touch "${FEATURE_DIR}"/steam +[[ $MACHINE_HAS_DISCORD == "true" ]] && touch "${FEATURE_DIR}"/discord +[[ $MACHINE_HAS_RESTIC_BACKUP == "true" ]] && touch "${FEATURE_DIR}"/restic_backup + +[[ $MACHINE_TYPE == "laptop" ]] && touch "${FEATURE_DIR}"/matchine_is_laptop + # Make all environment variables also usable in the systemd user instancee systemctl --user import-environment