diff --git a/scripts/post-install.sh b/scripts/post-install.sh index 25cbb2717..4e096e597 100644 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -2,4 +2,17 @@ # Author: hustcer # Created: 2025/02/25 18:55:20 +set -e + +# 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" +fi + nu /usr/libexec/nushell/post-install.nu diff --git a/scripts/pre-remove.sh b/scripts/pre-remove.sh index 1fe186a7a..a4ac6261c 100644 --- a/scripts/pre-remove.sh +++ b/scripts/pre-remove.sh @@ -2,4 +2,17 @@ # Author: hustcer # Created: 2025/03/10 08:35:20 +set -e + +# 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" +fi + nu /usr/libexec/nushell/pre-remove.nu