Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion loader/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
val verCode: Int by rootProject.extra
val verName: String by rootProject.extra
val commitHash: String by rootProject.extra
val workDirectory: String by rootProject.extra

fun Project.findInPath(executable: String, property: String): String? {
val pathEnv = System.getenv("PATH")
Expand All @@ -29,7 +30,8 @@ val defaultCFlags = arrayOf(
"-Wall", "-Wextra",
"-fno-rtti", "-fno-exceptions",
"-fno-stack-protector", "-fomit-frame-pointer",
"-Wno-builtin-macro-redefined", "-D__FILE__=__FILE_NAME__"
"-Wno-builtin-macro-redefined", "-D__FILE__=__FILE_NAME__",
"-DWORK_DIRECTORY='\"${workDirectory}\"'"
)

val releaseFlags = arrayOf(
Expand Down
5 changes: 4 additions & 1 deletion loader/src/common/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
namespace zygiskd {
static std::string TMP_PATH;

void Init(const char *path) { TMP_PATH = path; }
void Init(const char *path) {
TMP_PATH = path;
setenv("TMP_PATH", TMP_PATH.data(), 0);
}

std::string GetTmpPath() { return TMP_PATH; }

Expand Down
4 changes: 3 additions & 1 deletion loader/src/ptracer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// Use string_view literals for efficient, allocation-free string comparisons.
using namespace std::string_view_literals;

const char *const kWorkDirectory = WORK_DIRECTORY;

// The main entry point for the monitoring process.
void init_monitor() {
LOGI("NeoZygisk %s", ZKSU_VERSION);
Expand Down Expand Up @@ -72,7 +74,7 @@ static int handle_version();
*/
int main(int argc, char **argv) {
// This initialization is for the daemon's internal logic, not for CLI output.
zygiskd::Init(getenv("TMP_PATH"));
zygiskd::Init(kWorkDirectory);

if (argc < 2) {
print_usage(argv[0]);
Expand Down
2 changes: 0 additions & 2 deletions module/src/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,11 @@ extract "$ZIPFILE" 'module.prop' "$MODPATH"
extract "$ZIPFILE" 'post-fs-data.sh' "$MODPATH"
extract "$ZIPFILE" 'service.sh' "$MODPATH"
extract "$ZIPFILE" 'uninstall.sh' "$MODPATH"
extract "$ZIPFILE" 'zygisk-ctl.sh' "$MODPATH"
mv "$TMPDIR/sepolicy.rule" "$MODPATH"

mkdir "$MODPATH/bin"
mkdir "$MODPATH/lib"
mkdir "$MODPATH/lib64"
mv "$MODPATH/zygisk-ctl.sh" "$MODPATH/bin/zygisk-ctl"

if [ "$ARCH" = "x86" ]; then
ui_print "- Extracting x86 libraries"
Expand Down
2 changes: 1 addition & 1 deletion module/src/post-fs-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ create_sys_perm() {
chcon u:object_r:system_file:s0 $1
}

export TMP_PATH=@WORK_DIRECTORY@
TMP_PATH=@WORK_DIRECTORY@

if [ -d $TMP_PATH ]; then
rm -rf $TMP_PATH
Expand Down
5 changes: 0 additions & 5 deletions module/src/zygisk-ctl.sh

This file was deleted.

Loading