diff --git a/modules/release.nix b/modules/release.nix index 782677cb..0ba28f26 100644 --- a/modules/release.nix +++ b/modules/release.nix @@ -60,7 +60,40 @@ let ${lib.optionalString (prevTargetFiles != null) "-i ${prevTargetFiles}"} \ ${targetFiles} ${out} ''; - imgScript = { targetFiles, out }: ''img_from_target_files ${targetFiles} ${out}''; + imgScript = { targetFiles, out }: '' + targetFiles="$(pwd)/targetFiles.zip" + cp ${targetFiles} $targetFiles + chmod +w $targetFiles + + ( + mkdir magisk/ + pushd magisk/ + + # TODO + unzip ${/var/tmp/magisk-test/app-release.apk} + + ln -sr assets/*.sh . + ln -sr assets/stub.apk . + + # Take everything from host arch and magiskboot from build arch + # TODO actually take the arches from the buildPlatform and the device platform + for file in lib/arm64-v8a/lib*.so lib/x86_64/libmagiskboot.so ; do + name="$(basename "$file")" + dest="''${name:3:-3}" + ln -srfn "$file" "$dest" && chmod +x "$file" + done + + unzip $targetFiles IMAGES/boot.img + + export BOOTMODE=true + PATH="$(pwd):${pkgs.writeShellScriptBin "getprop" "echo \"$@\""}/bin/:$PATH" bash boot_patch.sh IMAGES/boot.img + mv new-boot.img IMAGES/boot.img + + zip $targetFiles IMAGES/boot.img + ) + + img_from_target_files $targetFiles ${out} + ''; factoryImgScript = { targetFiles, img, out }: '' ln -s ${targetFiles} ${config.device}-target_files-${config.buildNumber}.zip || true ln -s ${img} ${config.device}-img-${config.buildNumber}.zip || true