aboutsummaryrefslogtreecommitdiff
path: root/pkgs/firmware
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2024-09-10 11:21:08 -0500
committerChris Wells <chris@mathematicaster.org>2024-09-10 11:21:08 -0500
commit8eae39e8e670f228e9675fb3bc432ce512560396 (patch)
treed3736c2f236f0878c2d199b042deb6b4d25e9c6c /pkgs/firmware
parent373d5246eb53ef1a13166b066248526f33f935db (diff)
downloadkobo-manager-8eae39e8e670f228e9675fb3bc432ce512560396.tar
kobo-manager-8eae39e8e670f228e9675fb3bc432ce512560396.tar.gz
kobo-manager-8eae39e8e670f228e9675fb3bc432ce512560396.tar.bz2
kobo-manager-8eae39e8e670f228e9675fb3bc432ce512560396.tar.lz
kobo-manager-8eae39e8e670f228e9675fb3bc432ce512560396.tar.xz
kobo-manager-8eae39e8e670f228e9675fb3bc432ce512560396.tar.zst
kobo-manager-8eae39e8e670f228e9675fb3bc432ce512560396.zip
Created a merge function which will probably be better than symlinkJoin. Also started writing the cli manager in haskell
Diffstat (limited to 'pkgs/firmware')
-rw-r--r--pkgs/firmware/default.nix24
1 files changed, 22 insertions, 2 deletions
diff --git a/pkgs/firmware/default.nix b/pkgs/firmware/default.nix
index 932ecf1..9c70eb1 100644
--- a/pkgs/firmware/default.nix
+++ b/pkgs/firmware/default.nix
@@ -1,4 +1,4 @@
-{ stdenvNoCC, fetchzip, lib, ... }:
+{ stdenvNoCC, fetchzip, lib, kobo-utils, gawk, ... }:
{ hardware, date, version, hash ? "", ... }:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "kobo-firmware";
@@ -6,15 +6,35 @@ stdenvNoCC.mkDerivation (finalAttrs: {
src = fetchzip {
url = "https://ereaderfiles.kobo.com/firmwares/${finalAttrs.hardware}/${finalAttrs.date}/kobo-update-${finalAttrs.version}.zip";
+ stripRoot = false;
inherit hash;
};
+ nativeBuildInputs = [
+ kobo-utils
+ gawk
+ ];
+
outputs = [
"out"
"KoboRoot"
];
- phases = "installPhase";
+ phases = [
+ "checkPhase"
+ "installPhase"
+ ];
+
+ doCheck = true;
+
+ checkPhase = ''
+ KOBOVERSION="$(kobo-versionextract "$src/KoboRoot.tgz" | awk '{if ($1 == "Version:") print $2}')"
+
+ if [[ ! "$KOBOVERSION" == "${finalAttrs.version}" ]]; then
+ >&2 echo "Expected version ${finalAttrs.version}, but actual firmware is version $KOBOVERSION"
+ exit 1
+ fi
+ '';
installPhase = ''
runHook preInstall