From 3a2c372325138080555c8b3140437dbab6b372c3 Mon Sep 17 00:00:00 2001 From: Nick Chan Date: Sat, 6 Apr 2024 00:21:40 +0800 Subject: [PATCH] Fix rootful ifdefs --- Makefile | 3 +++ src/optparse.c | 11 +++++++++-- src/pongo_helper.c | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 27a2f26..1207f78 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,9 @@ CFLAGS += -DBUILD_WHOAMI="\"$(BUILD_WHOAMI)\"" -DBUILD_TAG="\"$(BUILD_TAG)\"" CFLAGS += -DBUILD_NUMBER="\"$(BUILD_NUMBER)\"" -DBUILD_BRANCH="\"$(BUILD_BRANCH)\"" CFLAGS += -DBUILD_COMMIT="\"$(BUILD_COMMIT)\"" +CPATH = +LIBRARY_PATH = + export SRC DEP UNAME CC CFLAGS LDFLAGS LIBS SHELL TARGET_OS DEV_BUILD BUILD_DATE BUILD_TAG BUILD_WHOAMI BUILD_STYLE BUILD_NUMBER BUILD_BRANCH all: palera1n diff --git a/src/optparse.c b/src/optparse.c index 91b8d46..3869e13 100644 --- a/src/optparse.c +++ b/src/optparse.c @@ -119,7 +119,7 @@ static int usage(int e, char* prog_name) #ifdef TUI "\t-t, --tui\t\t\t\tForce interactive TUI\n" - "\t--cli\t\t\t\tForce cli mode\n" + "\t--cli\t\t\t\t\tForce cli mode\n" #endif "\nEnvironmental variables:\n" "\tTMPDIR\t\ttemporary diretory (path the built-in checkra1n will be extracted to)\n" @@ -136,10 +136,13 @@ int optparse(int argc, char* argv[]) { #ifdef DEV_BUILD "12" #endif +#ifdef ROOTFUL "fCcB" +#endif ,longopts, NULL)) != -1) { switch (opt) { +#ifdef ROOTFUL case 'B': palerain_flags |= palerain_option_setup_partial_root; palerain_flags |= palerain_option_setup_rootful; @@ -152,6 +155,7 @@ int optparse(int argc, char* argv[]) { case 'C': palerain_flags |= palerain_option_clean_fakefs; break; +#endif case 'p': palerain_flags |= palerain_option_pongo_exit; break; @@ -187,10 +191,12 @@ int optparse(int argc, char* argv[]) { snprintf(tui_options_boot_args, sizeof(tui_options_boot_args), "%s", optarg); #endif break; +#ifdef ROOTFUL case 'f': palerain_flags |= palerain_option_rootful; palerain_flags &= ~palerain_option_rootless; break; +#endif case 'l': palerain_flags &= ~palerain_option_rootful; palerain_flags |= palerain_option_rootless; @@ -391,13 +397,14 @@ int optparse(int argc, char* argv[]) { LOG(LOG_VERBOSE4, "overlay override length %" PRIu32 " -> %" PRIu32, override_overlay.orig_len, binpack_dmg_len); LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload); } - +#ifdef ROOTFUL if (!(palerain_flags & palerain_option_rootful)) { if ((palerain_flags & palerain_option_setup_rootful)) { LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode."); return -1; } } +#endif if (!( (palerain_flags & palerain_option_dfuhelper_only) || (palerain_flags & palerain_option_enter_recovery) || diff --git a/src/pongo_helper.c b/src/pongo_helper.c index e597ed5..2c838f2 100644 --- a/src/pongo_helper.c +++ b/src/pongo_helper.c @@ -36,9 +36,11 @@ void *pongo_usb_callback(stuff_t *arg) { if (get_found_pongo()) return NULL; set_found_pongo(1); +#ifdef ROOTFUL if ((palerain_flags & palerain_option_setup_rootful)) { strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1); } +#endif LOG(LOG_INFO, "Found PongoOS USB Device"); usb_device_handle_t handle = arg->handle; #ifdef TUI @@ -109,6 +111,7 @@ void *pongo_usb_callback(stuff_t *arg) { #endif issue_pongo_command(handle, "bootx"); LOG(LOG_INFO, "Booting Kernel..."); +#ifdef ROOTFUL if ((palerain_flags & palerain_option_setup_partial_root)) { LOG(LOG_INFO, "Please wait up to 5 minutes for the bindfs to be created."); LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak."); @@ -116,6 +119,7 @@ void *pongo_usb_callback(stuff_t *arg) { LOG(LOG_INFO, "Please wait up to 10 minutes for the fakefs to be created."); LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -c (Create FakeFS) option to jailbreak."); } +#endif if (dfuhelper_thr_running) { pthread_cancel(dfuhelper_thread); dfuhelper_thr_running = false;