-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprerm.c
More file actions
35 lines (31 loc) · 1.39 KB
/
prerm.c
File metadata and controls
35 lines (31 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <CoreFoundation/CoreFoundation.h>
#include "utils.h"
int main(const int argc, const char *argv[]) {
if (getuid() != 0) {
printf("Run this as root!\n");
return 1;
}
run_system("launchctl unload /Library/LaunchDaemons/com.michael.TimeMachine.plist");
if (argc > 1) {
if (strcmp(argv[1], "upgrade") == 0) {
return 0;
}
}
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_11_0) {
printf("iOS11 or higher version detected, now checking orig snapshot...\n");
if (snapshot_check("/", "com.apple.TimeMachine.orig-fs")) {
printf("Will rename snapshot \"com.apple.TimeMachine.orig-fs\" on fs / to \"orig-fs\"...\n");
snapshot_rename("/", "com.apple.TimeMachine.orig-fs", "orig-fs");
}
if (snapshot_check("/", "com.apple.TimeMachine.electra-prejailbreak")) {
printf("Will rename snapshot \"com.apple.TimeMachine.electra-prejailbreak\" on fs / to \"electra-prejailbreak\"...\n");
snapshot_rename("/", "com.apple.TimeMachine.electra-prejailbreak", "electra-prejailbreak");
}
} else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_10_3) {
printf("iOS10 detected, skip orig snapshot check.\n");
} else {
printf("Wrong iOS version detected, now exit.\n");
return 1;
}
return 0;
}