Iotools: fix werror + add psb_status package (#401975)

authored by Yohann Boniface and committed by GitHub f3789ddd e41b506a

+78 -5
+27
pkgs/by-name/io/iotools/001-fix-werror-in-sprintf.patch
··· 1 + diff --git a/commands.c b/commands.c 2 + index a28e6da..0f76ac7 100644 3 + --- a/commands.c 4 + +++ b/commands.c 5 + @@ -20,6 +20,7 @@ 6 + #include <stdlib.h> 7 + #include <string.h> 8 + #include <unistd.h> 9 + +#include <limits.h> 10 + #include <errno.h> 11 + #include "commands.h" 12 + #include "platform.h" 13 + @@ -150,7 +151,13 @@ build_symlink_name(const char *path_to_bin, const struct cmd_info *cmd) 14 + { 15 + static char link_name[FILENAME_MAX]; 16 + 17 + - snprintf(link_name, FILENAME_MAX, "%s/%s", path_to_bin, cmd->name); 18 + + int result = snprintf(link_name, PATH_MAX, "%s/%s", path_to_bin, cmd->name); 19 + + 20 + + if (result >= PATH_MAX) { 21 + + link_name[PATH_MAX - 1] = '\0'; 22 + + } else if (result < 0) { 23 + + link_name[0] = '\0'; 24 + + } 25 + 26 + return link_name; 27 + }
+7 -5
pkgs/by-name/io/iotools/package.nix
··· 4 4 fetchFromGitHub, 5 5 }: 6 6 7 - stdenv.mkDerivation { 7 + stdenv.mkDerivation (finalAttrs: { 8 8 pname = "iotools"; 9 9 version = "unstable-2017-12-11"; 10 10 ··· 15 15 hash = "sha256-tlGXJn3n27mQDupMIVYDd86YaWazVwel/qs0QqCy1W8="; 16 16 }; 17 17 18 + patches = [ ./001-fix-werror-in-sprintf.patch ]; 19 + 18 20 makeFlags = [ 19 21 "DEBUG=0" 20 22 "STATIC=0" ··· 24 26 install -Dm755 iotools -t $out/bin 25 27 ''; 26 28 27 - meta = with lib; { 29 + meta = { 28 30 description = "Set of simple command line tools which allow access to 29 31 hardware device registers"; 30 32 longDescription = '' ··· 35 37 operations. 36 38 ''; 37 39 homepage = "https://github.com/adurbin/iotools"; 38 - license = licenses.gpl2Only; 39 - maintainers = with maintainers; [ felixsinger ]; 40 + license = lib.licenses.gpl2Only; 41 + maintainers = with lib.maintainers; [ felixsinger ]; 40 42 platforms = [ 41 43 "x86_64-linux" 42 44 "i686-linux" 43 45 ]; 44 46 mainProgram = "iotools"; 45 47 }; 46 - } 48 + })
+44
pkgs/by-name/ps/psb_status/package.nix
··· 1 + { 2 + lib, 3 + stdenvNoCC, 4 + fetchFromGitHub, 5 + bash, 6 + iotools, 7 + makeWrapper, 8 + }: 9 + 10 + stdenvNoCC.mkDerivation (finalAttrs: { 11 + pname = "psb_status"; 12 + version = "0-unstable-2024-10-10"; 13 + 14 + src = fetchFromGitHub { 15 + owner = "mkopec"; 16 + repo = "psb_status"; 17 + rev = "be896832c53d6b0b70cf8a87f7ee46ad33deefc2"; 18 + hash = "sha256-4anPyjO8y3FgnYWa4bGFxI8Glk9srw/XF552tnixc8I="; 19 + }; 20 + 21 + dontBuild = true; 22 + 23 + nativeBuildInputs = [ makeWrapper ]; 24 + 25 + installPhase = '' 26 + runHook preInstall 27 + 28 + mkdir -p $out/bin 29 + install -m755 psb_status.sh $out/bin/psb_status 30 + wrapProgram $out/bin/psb_status \ 31 + --prefix PATH : ${lib.makeBinPath [ iotools ]} 32 + 33 + runHook postInstall 34 + ''; 35 + 36 + meta = { 37 + description = "Script to check Platform Secure Boot enablement on Zen based AMD CPUs"; 38 + homepage = "https://github.com/mkopec/psb_status"; 39 + license = lib.licenses.mit; 40 + maintainers = with lib.maintainers; [ phodina ]; 41 + platforms = [ "x86_64-linux" ]; 42 + mainProgram = "psb_status"; 43 + }; 44 + })