gnirehtet: 2.4 -> 2.5
the patch is not necessary anymore, as paths to adb and the apk can be set with environment variables
This commit is contained in:
parent
c59ea8b8a0
commit
da41eaeb46
2 changed files with 12 additions and 61 deletions
|
@ -1,12 +1,12 @@
|
|||
{stdenv, rustPlatform, fetchFromGitHub, fetchzip, androidenv, substituteAll}:
|
||||
{ stdenv, rustPlatform, fetchFromGitHub, fetchzip, androidenv, makeWrapper }:
|
||||
let
|
||||
version = "2.4";
|
||||
version = "2.5";
|
||||
apk = stdenv.mkDerivation {
|
||||
pname = "gnirehtet.apk";
|
||||
inherit version;
|
||||
src = fetchzip {
|
||||
url = "https://github.com/Genymobile/gnirehtet/releases/download/v${version}/gnirehtet-rust-linux64-v${version}.zip";
|
||||
sha256 = "13gsh5982v961j86j5y71pgas94g2d1v1fgnbslbqw4h69fbf48g";
|
||||
sha256 = "1db0gkg5z8lighhkyqfsr9jiacrck89zmfnmp74vj865hhxgjzgq";
|
||||
};
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
|
@ -22,19 +22,18 @@ rustPlatform.buildRustPackage {
|
|||
owner = "Genymobile";
|
||||
repo = "gnirehtet";
|
||||
rev = "v${version}";
|
||||
sha256 = "1c99d6zpjxa8xlrg0n1825am20d2pjiicfcjwv8iay9ylfdnvygl";
|
||||
sha256 = "0wk6n082gnj9xk46n542h1012h8gyhldca23bs7vl73g0534g878";
|
||||
};
|
||||
sourceRoot = "source/relay-rust";
|
||||
cargoSha256 = "0rb5xcqg5ikgrxpmzrql5n298j50aqgkkp45znbfv2x2n40dywad";
|
||||
cargoSha256 = "0i7f52r697gjw30m8k60hd3y6wsn5lpz419r083a1rhpbinzd26q";
|
||||
|
||||
patchFlags = [ "-p2" ];
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./paths.patch;
|
||||
adb = "${androidenv.androidPkgs_9_0.platform-tools}/bin/adb";
|
||||
inherit apk;
|
||||
})
|
||||
];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/gnirehtet \
|
||||
--set GNIREHTET_APK ${apk}/gnirehtet.apk \
|
||||
--set ADB ${androidenv.androidPkgs_9_0.platform-tools}/bin/adb
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Reverse tethering over adb for Android";
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
Index: gnirehtet/relay-rust/src/main.rs
|
||||
===================================================================
|
||||
--- gnirehtet.orig/relay-rust/src/main.rs
|
||||
+++ gnirehtet/relay-rust/src/main.rs
|
||||
@@ -299,7 +299,7 @@ impl Command for RelayCommand {
|
||||
|
||||
fn cmd_install(serial: Option<&String>) -> Result<(), CommandExecutionError> {
|
||||
info!(target: TAG, "Installing gnirehtet client...");
|
||||
- exec_adb(serial, vec!["install", "-r", "gnirehtet.apk"])
|
||||
+ exec_adb(serial, vec!["install", "-r", "@apk@/gnirehtet.apk"])
|
||||
}
|
||||
|
||||
fn cmd_uninstall(serial: Option<&String>) -> Result<(), CommandExecutionError> {
|
||||
@@ -464,8 +464,8 @@ fn exec_adb<S: Into<String>>(
|
||||
args: Vec<S>,
|
||||
) -> Result<(), CommandExecutionError> {
|
||||
let adb_args = create_adb_args(serial, args);
|
||||
- debug!(target: TAG, "Execute: adb {:?}", adb_args);
|
||||
- match process::Command::new("adb").args(&adb_args[..]).status() {
|
||||
+ debug!(target: TAG, "Execute: @adb@ {:?}", adb_args);
|
||||
+ match process::Command::new("@adb@").args(&adb_args[..]).status() {
|
||||
Ok(exit_status) => {
|
||||
if exit_status.success() {
|
||||
Ok(())
|
||||
@@ -487,8 +487,8 @@ fn must_install_client(serial: Option<&S
|
||||
serial,
|
||||
vec!["shell", "dumpsys", "package", "com.genymobile.gnirehtet"],
|
||||
);
|
||||
- debug!(target: TAG, "Execute: adb {:?}", args);
|
||||
- match process::Command::new("adb").args(&args[..]).output() {
|
||||
+ debug!(target: TAG, "Execute: @adb@ {:?}", args);
|
||||
+ match process::Command::new("@adb@").args(&args[..]).output() {
|
||||
Ok(output) => {
|
||||
if output.status.success() {
|
||||
// the "regex" crate makes the binary far bigger, so just parse the versionCode
|
||||
Index: gnirehtet/relay-rust/src/adb_monitor.rs
|
||||
===================================================================
|
||||
--- gnirehtet.orig/relay-rust/src/adb_monitor.rs
|
||||
+++ gnirehtet/relay-rust/src/adb_monitor.rs
|
||||
@@ -206,7 +206,7 @@ impl AdbMonitor {
|
||||
|
||||
fn start_adb_daemon() -> bool {
|
||||
info!(target: TAG, "Restarting adb daemon");
|
||||
- match process::Command::new("adb")
|
||||
+ match process::Command::new("@adb@")
|
||||
.args(&["start-server"])
|
||||
.status() {
|
||||
Ok(exit_status) => {
|
Loading…
Reference in a new issue