From 15020ec20aa5d652271a319c71e35c7759d7349e Mon Sep 17 00:00:00 2001 From: Gerry Bagaskoro Putro Date: Wed, 12 Nov 2025 00:56:01 +0700 Subject: [PATCH 1/2] fix(nodataperm): prevent crash when uninstalling on Android 13 --- stuff/nodataperm.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/stuff/nodataperm.py b/stuff/nodataperm.py index 4f140db..7570076 100644 --- a/stuff/nodataperm.py +++ b/stuff/nodataperm.py @@ -10,19 +10,23 @@ from tools import container class Nodataperm(General): id = "nodataperm" dl_links = { - "11": - { + "11": { + "x86_64": [ + "https://github.com/ayasa520/hack_full_data_permission/archive/d4beab7780eb792059d33e77d865579c9ee41546.zip", + "b0e3908ffcf5df8ea62f4929aa680f1a" + ], + }, + "13": { "x86_64": [ "https://github.com/ayasa520/hack_full_data_permission/archive/d4beab7780eb792059d33e77d865579c9ee41546.zip", "b0e3908ffcf5df8ea62f4929aa680f1a" ], }, - "13": {} } dl_file_name = "nodataperm.zip" extract_to = "/tmp/nodataperm" - dl_link = ... - act_md5 = ... + dl_link = None + act_md5 = None partition = "system" files = [ "etc/nodataperm.sh", @@ -36,11 +40,15 @@ class Nodataperm(General): super().__init__() print("ok") arch = self.arch[0] + if android_version not in self.dl_links: + raise KeyError(f"No download links for Android version '{android_version}'") + if arch not in self.dl_links[android_version]: + raise KeyError(f"No download links for architecture '{arch}' in Android version '{android_version}'") self.dl_link = self.dl_links[android_version][arch][0] self.act_md5 = self.dl_links[android_version][arch][1] def copy(self): - name = re.findall("([a-zA-Z0-9]+)\.zip", self.dl_link)[0] + name = re.findall(r"([a-zA-Z0-9]+)\.zip", self.dl_link)[0] extract_path = os.path.join( self.extract_to, f"hack_full_data_permission-{name}") if not container.use_overlayfs(): From ddaa6b190f98b250e433c14946de7b69713a4b94 Mon Sep 17 00:00:00 2001 From: NullBite Date: Wed, 14 Feb 2024 22:57:05 +0100 Subject: [PATCH 2/2] Add Nix flake and improve derivation This adds a Nix flake to the repo as well as updates the derivation so that it includes `lzip` as a dependency --- default.nix | 26 ++++---------------------- flake.lock | 41 +++++++++++++++++++++++++++++++++++++++++ flake.nix | 21 +++++++++++++++++++++ package.nix | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 22 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 package.nix diff --git a/default.nix b/default.nix index 9ab2954..23423af 100644 --- a/default.nix +++ b/default.nix @@ -1,22 +1,4 @@ -with (import {}); - -stdenv.mkDerivation { - name = "waydroid_script"; - - buildInputs = [ - (python3.withPackages(ps: with ps; [ tqdm requests inquirerpy ])) - ]; - - src = ./.; - - postPatch = '' - patchShebangs main.py - ''; - - installPhase = '' - mkdir -p $out/libexec - cp -r . $out/libexec/waydroid_script - mkdir -p $out/bin - ln -s $out/libexec/waydroid_script/main.py $out/bin/waydroid_script - ''; -} +let + pkgs = import {}; +in + pkgs.callPackage ./package.nix { } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fb6d247 --- /dev/null +++ b/flake.lock @@ -0,0 +1,41 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1707650010, + "narHash": "sha256-dOhphIA4MGrH4ElNCy/OlwmN24MsnEqFjRR6+RY7jZw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "809cca784b9f72a5ad4b991e0e7bcf8890f9c3a6", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a0a7172 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "Waydroid Extras Script"; + inputs = { + systems.url = "github:nix-systems/default"; + }; + outputs = { self, nixpkgs, systems }: + let + inherit (nixpkgs) lib; + eachSystem = lib.genAttrs (import systems); + mkApp = program: { type = "app"; inherit program; }; + in { + packages = eachSystem (system: rec { + waydroid_script = nixpkgs.legacyPackages."${system}".callPackage ./package.nix { }; + default = waydroid_script; + }); + apps = eachSystem (system: rec { + waydroid_script = mkApp "${self.outputs.packages.${system}.waydroid_script}/bin/waydroid_script"; + default = waydroid_script; + }); + }; +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..07c5519 --- /dev/null +++ b/package.nix @@ -0,0 +1,32 @@ +{ lib, + stdenvNoCC, + lzip, + python3, + makeWrapper }: +let + wrappedPath = lib.makeBinPath [ lzip ]; +in stdenvNoCC.mkDerivation { + name = "waydroid_script"; + + buildInputs = [ + (python3.withPackages(ps: with ps; [ tqdm requests inquirerpy ])) + ]; + + nativeBuildInputs = [ + makeWrapper + ]; + + src = ./.; + + postPatch = '' + patchShebangs main.py + ''; + + installPhase = '' + mkdir -p $out/libexec + cp -r . $out/libexec/waydroid_script + mkdir -p $out/bin + makeShellWrapper $out/libexec/waydroid_script/main.py $out/bin/waydroid_script \ + --prefix PATH : "${wrappedPath}" + ''; +}