mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-13 05:37:47 +02:00
Reboot to recovery when running as recovery
This commit is contained in:
@ -728,7 +728,10 @@ void late_start(int client) {
|
|||||||
if (access(SECURE_DIR, F_OK) != 0)
|
if (access(SECURE_DIR, F_OK) != 0)
|
||||||
xmkdir(SECURE_DIR, 0700);
|
xmkdir(SECURE_DIR, 0700);
|
||||||
// And reboot to make proper setup possible
|
// And reboot to make proper setup possible
|
||||||
exec_command_sync("/system/bin/reboot");
|
if (RECOVERY_MODE)
|
||||||
|
exec_command_sync("/system/bin/reboot", "recovery");
|
||||||
|
else
|
||||||
|
exec_command_sync("/system/bin/reboot");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto_start_magiskhide();
|
auto_start_magiskhide();
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
#include <flags.h>
|
#include <flags.h>
|
||||||
|
|
||||||
int SDK_INT = -1;
|
int SDK_INT = -1;
|
||||||
struct stat SERVER_STAT;
|
bool RECOVERY_MODE = false;
|
||||||
|
static struct stat SERVER_STAT;
|
||||||
|
|
||||||
static void verify_client(int client, pid_t pid) {
|
static void verify_client(int client, pid_t pid) {
|
||||||
// Verify caller is the same as server
|
// Verify caller is the same as server
|
||||||
@ -123,6 +124,13 @@ static void main_daemon() {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Load config status
|
||||||
|
parse_prop_file(MAGISKTMP "/config", [](auto key, auto val) -> bool {
|
||||||
|
if (key == "RECOVERYMODE" && val == "true")
|
||||||
|
RECOVERY_MODE = true;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
struct sockaddr_un sun;
|
struct sockaddr_un sun;
|
||||||
socklen_t len = setup_sockaddr(&sun, MAIN_SOCKET);
|
socklen_t len = setup_sockaddr(&sun, MAIN_SOCKET);
|
||||||
fd = xsocket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
fd = xsocket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
/* daemon.h - Utility functions for daemon-client communication
|
#pragma once
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _DAEMON_H_
|
|
||||||
#define _DAEMON_H_
|
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
@ -87,4 +83,5 @@ void magiskhide_handler(int client);
|
|||||||
|
|
||||||
void su_daemon_handler(int client, struct ucred *credential);
|
void su_daemon_handler(int client, struct ucred *credential);
|
||||||
|
|
||||||
#endif
|
extern int SDK_INT;
|
||||||
|
extern bool RECOVERY_MODE;
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
// Legacy crap
|
// Legacy crap
|
||||||
#define LEGACYCORE MODULEROOT "/.core"
|
#define LEGACYCORE MODULEROOT "/.core"
|
||||||
|
|
||||||
extern int SDK_INT;
|
|
||||||
|
|
||||||
constexpr const char *applet_names[] = { "magisk", "su", "resetprop", "magiskhide", nullptr };
|
constexpr const char *applet_names[] = { "magisk", "su", "resetprop", "magiskhide", nullptr };
|
||||||
|
|
||||||
// Multi-call entrypoints
|
// Multi-call entrypoints
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "daemon.h"
|
#include <daemon.h>
|
||||||
|
|
||||||
#define SIGTERMTHRD SIGUSR1
|
#define SIGTERMTHRD SIGUSR1
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user