From baf2ae72955c87e73f02b092d18f5dec98fab6c0 Mon Sep 17 00:00:00 2001 From: nzbr Date: Wed, 14 Dec 2022 04:30:10 +0100 Subject: fix: don't fail system activation if no application launchers or icons exist --- modules/wsl-distro.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/wsl-distro.nix b/modules/wsl-distro.nix index bcc6f08..0547bf9 100644 --- a/modules/wsl-distro.nix +++ b/modules/wsl-distro.nix @@ -88,9 +88,13 @@ with lib; { copy-launchers = mkIf cfg.startMenuLaunchers ( stringAfter [ ] '' for x in applications icons; do - echo "Copying /usr/share/$x" - mkdir -p /usr/share/$x - ${pkgs.rsync}/bin/rsync -ar --delete $systemConfig/sw/share/$x/. /usr/share/$x + echo "setting up /usr/share/''${x}..." + if [[ -d $systemConfig/sw/share/$x ]]; then + mkdir -p /usr/share/$x + ${pkgs.rsync}/bin/rsync -ar --delete $systemConfig/sw/share/$x/. /usr/share/$x + else + rm -rf /usr/share/$x + fi done '' ); -- cgit v1.2.3 From 86455818e51488863a0dbbb5d48952fd49202af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 9 Jan 2023 11:49:56 +0100 Subject: Don't add an extra :, make robust against grep aliases grep adds a final newline which the second tr turns into an extra : By using a null byte and telling grep to treat it as text we can avoid this. Also guard the grep against the alias in my shell :) --- modules/wsl-distro.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/wsl-distro.nix b/modules/wsl-distro.nix index da3cd42..917e52a 100644 --- a/modules/wsl-distro.nix +++ b/modules/wsl-distro.nix @@ -175,9 +175,9 @@ with lib; { # preserve $PATH from parent variables.PATH = [ "$PATH" ]; extraInit = '' - export WSLPATH=$(echo "$PATH" | tr ':' '\n' | grep -E "^${cfg.wslConf.automount.root}" | tr '\n' ':') + export WSLPATH=$(echo "$PATH" | tr ':' '\0' | command grep -a "^${cfg.wslConf.automount.root}" | tr '\0' ':') ${if cfg.interop.includePath then "" else '' - export PATH=$(echo "$PATH" | tr ':' '\n' | grep -vE "^${cfg.wslConf.automount.root}" | tr '\n' ':') + export PATH=$(echo "$PATH" | tr ':' '\0' | command grep -av "^${cfg.wslConf.automount.root}" | tr '\0' ':') ''} ''; }; -- cgit v1.2.3