Iotools: fix werror + add psb_status package (#401975)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
diff --git a/commands.c b/commands.c
|
||||
index a28e6da..0f76ac7 100644
|
||||
--- a/commands.c
|
||||
+++ b/commands.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include "commands.h"
|
||||
#include "platform.h"
|
||||
@@ -150,7 +151,13 @@ build_symlink_name(const char *path_to_bin, const struct cmd_info *cmd)
|
||||
{
|
||||
static char link_name[FILENAME_MAX];
|
||||
|
||||
- snprintf(link_name, FILENAME_MAX, "%s/%s", path_to_bin, cmd->name);
|
||||
+ int result = snprintf(link_name, PATH_MAX, "%s/%s", path_to_bin, cmd->name);
|
||||
+
|
||||
+ if (result >= PATH_MAX) {
|
||||
+ link_name[PATH_MAX - 1] = '\0';
|
||||
+ } else if (result < 0) {
|
||||
+ link_name[0] = '\0';
|
||||
+ }
|
||||
|
||||
return link_name;
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "iotools";
|
||||
version = "unstable-2017-12-11";
|
||||
|
||||
@@ -15,6 +15,8 @@ stdenv.mkDerivation {
|
||||
hash = "sha256-tlGXJn3n27mQDupMIVYDd86YaWazVwel/qs0QqCy1W8=";
|
||||
};
|
||||
|
||||
patches = [ ./001-fix-werror-in-sprintf.patch ];
|
||||
|
||||
makeFlags = [
|
||||
"DEBUG=0"
|
||||
"STATIC=0"
|
||||
@@ -24,7 +26,7 @@ stdenv.mkDerivation {
|
||||
install -Dm755 iotools -t $out/bin
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
description = "Set of simple command line tools which allow access to
|
||||
hardware device registers";
|
||||
longDescription = ''
|
||||
@@ -35,12 +37,12 @@ stdenv.mkDerivation {
|
||||
operations.
|
||||
'';
|
||||
homepage = "https://github.com/adurbin/iotools";
|
||||
license = licenses.gpl2Only;
|
||||
maintainers = with maintainers; [ felixsinger ];
|
||||
license = lib.licenses.gpl2Only;
|
||||
maintainers = with lib.maintainers; [ felixsinger ];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"i686-linux"
|
||||
];
|
||||
mainProgram = "iotools";
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchFromGitHub,
|
||||
bash,
|
||||
iotools,
|
||||
makeWrapper,
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "psb_status";
|
||||
version = "0-unstable-2024-10-10";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mkopec";
|
||||
repo = "psb_status";
|
||||
rev = "be896832c53d6b0b70cf8a87f7ee46ad33deefc2";
|
||||
hash = "sha256-4anPyjO8y3FgnYWa4bGFxI8Glk9srw/XF552tnixc8I=";
|
||||
};
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
install -m755 psb_status.sh $out/bin/psb_status
|
||||
wrapProgram $out/bin/psb_status \
|
||||
--prefix PATH : ${lib.makeBinPath [ iotools ]}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Script to check Platform Secure Boot enablement on Zen based AMD CPUs";
|
||||
homepage = "https://github.com/mkopec/psb_status";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ phodina ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "psb_status";
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user