Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

[Patchless] Fix Posix file permissions

Maximilian Paßd3395aee9506
diff --git a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcher.swift b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcher.swift
index a4c7592f..241190a6 100644
--- a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcher.swift
+++ b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcher.swift
@@ -144,6 +144,7 @@ public final class CryptexFilesystemPatcher: Patcher {
try FileManager.default.removeItem(at: finalDestination)
}
try FileManager.default.moveItem(at: finalFile, to: finalDestination)
+ try FileManager.default.setAttributes([.posixPermissions: 0o644], ofItemAtPath: finalDestination.path)
return (newDmgPath, finalDestination)
}
@@ -173,6 +174,7 @@ public final class CryptexFilesystemPatcher: Patcher {
let vphonedBin = vphonedSrc.appendingPathComponent("vphoned")
try buildVphoned(vphonedSrc: vphonedSrc, vphonedBin: vphonedBin)
+ defer { try? FileManager.default.removeItem(at: vphonedBin) }
// Sign
let targetBin = target.appending(path: "/usr/bin/vphoned")
@@ -185,12 +187,6 @@ public final class CryptexFilesystemPatcher: Patcher {
])
_ = try runProcess("/bin/chmod", ["0755", targetBin.path])
- let signedCopyPath = self.restoreDir.deletingLastPathComponent().appending(path: ".vphoned.signed")
- if FileManager.default.fileExists(atPath: signedCopyPath.path) {
- try FileManager.default.removeItem(at: signedCopyPath)
- }
- try FileManager.default.copyItem(at: targetBin, to: signedCopyPath)
-
// Register Launch Daemon
let vphonedLaunchdPlist = vphonedSrc.appending(path: "vphoned.plist")
try FileManager.default.copyItem(at: vphonedLaunchdPlist,