Fix rootful ifdefs

This commit is contained in:
Nick Chan committed 2024-04-06 00:21:40 +08:00
1 parent 0140f4c8df
commit 3a2c372325
3 files changed
+16 -2

No files matched your search

+3
View File
@@ -71,6 +71,9 @@ CFLAGS += -DBUILD_WHOAMI="\"$(BUILD_WHOAMI)\"" -DBUILD_TAG="\"$(BUILD_TAG)\""
CFLAGS += -DBUILD_NUMBER="\"$(BUILD_NUMBER)\"" -DBUILD_BRANCH="\"$(BUILD_BRANCH)\"" CFLAGS += -DBUILD_NUMBER="\"$(BUILD_NUMBER)\"" -DBUILD_BRANCH="\"$(BUILD_BRANCH)\""
CFLAGS += -DBUILD_COMMIT="\"$(BUILD_COMMIT)\"" 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 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 all: palera1n
+9 -2
View File
@@ -119,7 +119,7 @@ static int usage(int e, char* prog_name)
#ifdef TUI #ifdef TUI
"\t-t, --tui\t\t\t\tForce interactive TUI\n" "\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 #endif
"\nEnvironmental variables:\n" "\nEnvironmental variables:\n"
"\tTMPDIR\t\ttemporary diretory (path the built-in checkra1n will be extracted to)\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 #ifdef DEV_BUILD
"12" "12"
#endif #endif
#ifdef ROOTFUL
"fCcB" "fCcB"
#endif
,longopts, NULL)) != -1) ,longopts, NULL)) != -1)
{ {
switch (opt) { switch (opt) {
#ifdef ROOTFUL
case 'B': case 'B':
palerain_flags |= palerain_option_setup_partial_root; palerain_flags |= palerain_option_setup_partial_root;
palerain_flags |= palerain_option_setup_rootful; palerain_flags |= palerain_option_setup_rootful;
@@ -152,6 +155,7 @@ int optparse(int argc, char* argv[]) {
case 'C': case 'C':
palerain_flags |= palerain_option_clean_fakefs; palerain_flags |= palerain_option_clean_fakefs;
break; break;
#endif
case 'p': case 'p':
palerain_flags |= palerain_option_pongo_exit; palerain_flags |= palerain_option_pongo_exit;
break; break;
@@ -187,10 +191,12 @@ int optparse(int argc, char* argv[]) {
snprintf(tui_options_boot_args, sizeof(tui_options_boot_args), "%s", optarg); snprintf(tui_options_boot_args, sizeof(tui_options_boot_args), "%s", optarg);
#endif #endif
break; break;
#ifdef ROOTFUL
case 'f': case 'f':
palerain_flags |= palerain_option_rootful; palerain_flags |= palerain_option_rootful;
palerain_flags &= ~palerain_option_rootless; palerain_flags &= ~palerain_option_rootless;
break; break;
#endif
case 'l': case 'l':
palerain_flags &= ~palerain_option_rootful; palerain_flags &= ~palerain_option_rootful;
palerain_flags |= palerain_option_rootless; 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 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); 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_rootful)) {
if ((palerain_flags & palerain_option_setup_rootful)) { if ((palerain_flags & palerain_option_setup_rootful)) {
LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode."); LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");
return -1; return -1;
} }
} }
#endif
if (!( if (!(
(palerain_flags & palerain_option_dfuhelper_only) || (palerain_flags & palerain_option_dfuhelper_only) ||
(palerain_flags & palerain_option_enter_recovery) || (palerain_flags & palerain_option_enter_recovery) ||
+4
View File
@@ -36,9 +36,11 @@ void *pongo_usb_callback(stuff_t *arg) {
if (get_found_pongo()) if (get_found_pongo())
return NULL; return NULL;
set_found_pongo(1); set_found_pongo(1);
#ifdef ROOTFUL
if ((palerain_flags & palerain_option_setup_rootful)) { if ((palerain_flags & palerain_option_setup_rootful)) {
strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1); strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1);
} }
#endif
LOG(LOG_INFO, "Found PongoOS USB Device"); LOG(LOG_INFO, "Found PongoOS USB Device");
usb_device_handle_t handle = arg->handle; usb_device_handle_t handle = arg->handle;
#ifdef TUI #ifdef TUI
@@ -109,6 +111,7 @@ void *pongo_usb_callback(stuff_t *arg) {
#endif #endif
issue_pongo_command(handle, "bootx"); issue_pongo_command(handle, "bootx");
LOG(LOG_INFO, "Booting Kernel..."); LOG(LOG_INFO, "Booting Kernel...");
#ifdef ROOTFUL
if ((palerain_flags & palerain_option_setup_partial_root)) { 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, "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."); 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, "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."); 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) { if (dfuhelper_thr_running) {
pthread_cancel(dfuhelper_thread); pthread_cancel(dfuhelper_thread);
dfuhelper_thr_running = false; dfuhelper_thr_running = false;