From 61319af6a41acf84583283dea2b63026e7dd3be8 Mon Sep 17 00:00:00 2001 From: Martin Rubli Date: Tue, 22 Apr 2025 09:30:48 +0200 Subject: [PATCH] stm32cubemx: fix broken software package database update For some reason, STM32CubeMX initially creates one of its database files with missing user-write permissions. When this happens, refreshing the package list in the Embedded Software Packages Manager seems to succeed but new packages don't become available. (As of the time of writing, this is the case with TouchGFX 4.25.0, which fails to appear, and 4.24.2 showing as the latest version.) To work around this problem, we run chmod u+w $HOME/.stm32cubemx/thirdparties/db/updaterThirdParties.xml when the startup wrapper script recognizes this problem. --- pkgs/by-name/st/stm32cubemx/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/st/stm32cubemx/package.nix b/pkgs/by-name/st/stm32cubemx/package.nix index d7966caec68e..bd0250accc8e 100644 --- a/pkgs/by-name/st/stm32cubemx/package.nix +++ b/pkgs/by-name/st/stm32cubemx/package.nix @@ -52,6 +52,11 @@ let cat << EOF > $out/bin/${pname} #!${stdenvNoCC.shell} + updater_xml="\$HOME/.stm32cubemx/thirdparties/db/updaterThirdParties.xml" + if [ -e "\$updater_xml" ] && [ ! -w "\$updater_xml" ]; then + echo "Warning: Unwritable \$updater_xml prevents CubeMX software packages from working correctly. Fixing that." + (set -x; chmod u+w "\$updater_xml") + fi ${jdk21}/bin/java -jar $out/opt/STM32CubeMX/STM32CubeMX "\$@" EOF chmod +x $out/bin/${pname}