-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
sonota: init at 2018-10-07 #50257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sonota: init at 2018-10-07 #50257
Conversation
Success on x86_64-linux (full log) Attempted: sonota Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: sonota Partial log (click to expand)
|
pkgs/tools/misc/sonota/default.nix
Outdated
sha256 = "0jd9xrhcyk8d2plbjnrlpn87536zr6n708797n0k5blf109q3c1z"; | ||
}; | ||
|
||
patches = [ ./set_resource_path.patch ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this and the 'postPatch' be simplified with substituteAll
?
patches = [
(substituteAll {
src = ./set_resource_path.patch;
out = "$out";
})
];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost, we need out = placeholder "out";
. Thanks for the tip!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Darn, forgot that placeholder doesn't work for substituteAll
NixOS/nix#1846
So instead you'll have to do
postPatch = ''
substituteInPlace sonota.py --subst-var out
'';
with the plain patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it works though. This is the output:
def resource_path(relative_path):
return os.path.join("/nix/store/9x9ahhb32yg2i4izxz9f250yi9vsc61n-set_resource_path.patch/share/sonota", relative_path)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But see that out
is the patch /nix/store/9x9ahhb32yg2i4izxz9f250yi9vsc61n-set_resource_path.patch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh crap. You're right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
The date should also be the same as the one in the derivation name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and executes, though I can't test the function.
Thanks @worldofpeace |
Motivation for this change
This is super useful for doing what is essentially a MITM attack on Sonoff devices in order to do OTA upgrades to open source firmware.
Tried it out successfully on a few different devices (S20, T1-1, T1-3). Doesn't work with the B1 though.
Cc: @fpletz
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)