From 0dfa1eef25a8c1090ff1e38f7a73123626605da0 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 11 Sep 2019 20:11:16 +0200 Subject: [PATCH] xsession: remove bashisms in start scripts Fixes #836 --- modules/xsession.nix | 6 +++--- tests/modules/misc/xsession/basic-xprofile-expected.txt | 2 +- tests/modules/misc/xsession/basic-xsession-expected.txt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/xsession.nix b/modules/xsession.nix index 7a1642cc9..e1cf9942e 100644 --- a/modules/xsession.nix +++ b/modules/xsession.nix @@ -130,7 +130,7 @@ in home.file.".xprofile".text = '' . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" - if [[ -e "$HOME/.profile" ]]; then + if [ -e "$HOME/.profile" ]; then . "$HOME/.profile" fi @@ -152,7 +152,7 @@ in home.file.${cfg.scriptPath} = { executable = true; text = '' - if [[ ! -v HM_XPROFILE_SOURCED ]]; then + if [ -z "$HM_XPROFILE_SOURCED" ]; then . ~/.xprofile fi unset HM_XPROFILE_SOURCED @@ -167,7 +167,7 @@ in systemctl --user stop graphical-session-pre.target # Wait until the units actually stop. - while [[ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]]; do + while [ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]; do sleep 0.5 done ''; diff --git a/tests/modules/misc/xsession/basic-xprofile-expected.txt b/tests/modules/misc/xsession/basic-xprofile-expected.txt index 4fa93f97e..05733a974 100644 --- a/tests/modules/misc/xsession/basic-xprofile-expected.txt +++ b/tests/modules/misc/xsession/basic-xprofile-expected.txt @@ -1,6 +1,6 @@ . "/test-home/.nix-profile/etc/profile.d/hm-session-vars.sh" -if [[ -e "$HOME/.profile" ]]; then +if [ -e "$HOME/.profile" ]; then . "$HOME/.profile" fi diff --git a/tests/modules/misc/xsession/basic-xsession-expected.txt b/tests/modules/misc/xsession/basic-xsession-expected.txt index 20d7c4998..c11b7c330 100644 --- a/tests/modules/misc/xsession/basic-xsession-expected.txt +++ b/tests/modules/misc/xsession/basic-xsession-expected.txt @@ -1,4 +1,4 @@ -if [[ ! -v HM_XPROFILE_SOURCED ]]; then +if [ -z "$HM_XPROFILE_SOURCED" ]; then . ~/.xprofile fi unset HM_XPROFILE_SOURCED @@ -13,6 +13,6 @@ systemctl --user stop graphical-session.target systemctl --user stop graphical-session-pre.target # Wait until the units actually stop. -while [[ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]]; do +while [ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]; do sleep 0.5 done