diff options
author | Sam Bingner <sam@bingner.com> | 2021-06-30 00:25:50 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2021-06-30 00:25:50 -1000 |
commit | 5bb752bf866b92145704c1dc7a3c9249cc4c76b8 (patch) | |
tree | a3a8b8aca5e10cc4c0d76ef32f43ed036519907a | |
parent | 573311e2cea8491a1054940a1580b5f4a20cc8d7 (diff) |
Don't require su for postinst
-rw-r--r-- | postinst.mm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/postinst.mm b/postinst.mm index d437508..f9d380a 100644 --- a/postinst.mm +++ b/postinst.mm @@ -243,8 +243,16 @@ int main(int argc, const char *argv[]) { if (access(OldCache_, F_OK) == 0) system("rm -rf " OldCache_); + NSDictionary<NSFileAttributeKey, id> *attributes = @{ + NSFileOwnerAccountID: @501, + NSFileGroupOwnerAccountID: @501 + }; #define NewCache_ "/var/mobile/Library/Caches/com.saurik.Cydia" - system("cd /; su -c 'mkdir -p " NewCache_ "' mobile"); + [[NSFileManager defaultManager] createDirectoryAtPath:@NewCache_ + withIntermediateDirectories:YES + attributes:attributes + error:nil + ]; if (access(NewCache_ "/lists", F_OK) != 0 && errno == ENOENT) system("cp -at " NewCache_ " /var/lib/apt/lists"); system("chown -R 501.501 " NewCache_); @@ -252,7 +260,11 @@ int main(int argc, const char *argv[]) { #define OldLibrary_ "/var/lib/cydia" #define NewLibrary_ "/var/mobile/Library/Cydia" - system("cd /; su -c 'mkdir -p " NewLibrary_ "' mobile"); + [[NSFileManager defaultManager] createDirectoryAtPath:@NewLibrary_ + withIntermediateDirectories:YES + attributes:attributes + error:nil + ]; #define Cytore_ "/metadata.cb0" |