From 3e343bea24d2b09d72633d5ab3b45f00b0537181 Mon Sep 17 00:00:00 2001 From: Taylor Richberger Date: Tue, 25 Aug 2026 11:04:48 -0600 Subject: [PATCH 1/2] fix: fix post-install.sh for install by non-user UIDs --- scripts/post-install.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/post-install.sh b/scripts/post-install.sh index 4e096e597..3d5fd0bb2 100644 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -4,15 +4,18 @@ set -e +# Even with XDG_CONFIG_HOME, nu fails without a HOME variable set and UID +# without a user account. +# See https://github.com/nushell/nushell/issues/18902 +if [ -z "${HOME+x}" ]; then + export HOME="$PWD" +fi + # Running nu in the rpm-ostree script environment fails if the config directory # doesn't exist, preventing the post-install.nu script from being run. -if [ -n "${XDG_CONFIG_HOME+x}" ]; then - mkdir -p "$XDG_CONFIG_HOME" -elif [ -n "${HOME+x}" ]; then - mkdir -p "$HOME/.config" -else - export XDG_CONFIG_HOME="$PWD/.config" - mkdir -p "$XDG_CONFIG_HOME" +if [ -z "${XDG_CONFIG_HOME+x}" ]; then + export XDG_CONFIG_HOME="$HOME/.config" fi +mkdir -p "$XDG_CONFIG_HOME" nu /usr/libexec/nushell/post-install.nu From 15123d60e0d11426a5241a3a367c2e31e009be27 Mon Sep 17 00:00:00 2001 From: Taylor Richberger Date: Tue, 25 Aug 2026 21:30:45 -0600 Subject: [PATCH 2/2] fix: fix pre-remove.sh for removal by non-user UIDs --- scripts/pre-remove.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/pre-remove.sh b/scripts/pre-remove.sh index a4ac6261c..97f63a987 100644 --- a/scripts/pre-remove.sh +++ b/scripts/pre-remove.sh @@ -4,15 +4,18 @@ set -e +# Even with XDG_CONFIG_HOME, nu fails without a HOME variable set and UID +# without a user account. +# See https://github.com/nushell/nushell/issues/18902 +if [ -z "${HOME+x}" ]; then + export HOME="$PWD" +fi + # Running nu in the rpm-ostree script environment fails if the config directory # doesn't exist, preventing the pre-remove.nu script from being run. -if [ -n "${XDG_CONFIG_HOME+x}" ]; then - mkdir -p "$XDG_CONFIG_HOME" -elif [ -n "${HOME+x}" ]; then - mkdir -p "$HOME/.config" -else - export XDG_CONFIG_HOME="$PWD/.config" - mkdir -p "$XDG_CONFIG_HOME" +if [ -z "${XDG_CONFIG_HOME+x}" ]; then + export XDG_CONFIG_HOME="$HOME/.config" fi +mkdir -p "$XDG_CONFIG_HOME" nu /usr/libexec/nushell/pre-remove.nu