sss
This commit is contained in:
parent
0c7c27fa51
commit
dec19983af
@ -159,6 +159,27 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ProcessBuilder 실행 보조 함수 (로그 출력용)
|
||||||
|
fun runCommand(vararg command: String) {
|
||||||
|
try {
|
||||||
|
val process = ProcessBuilder(*command)
|
||||||
|
.redirectErrorStream(true)
|
||||||
|
.start()
|
||||||
|
|
||||||
|
// 명령어 실행 결과 출력 (에러 디버깅용)
|
||||||
|
val output = process.inputStream.bufferedReader().readText()
|
||||||
|
val exitCode = process.waitFor()
|
||||||
|
|
||||||
|
if (exitCode != 0) {
|
||||||
|
println("⚠️ [명령어 경고] ${command.joinToString(" ")} -> 반환 코드: $exitCode, 메시지: $output")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println("❌ [명령어 에러] ${command.joinToString(" ")} 실행 중 에러: ${e.message}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mac OS 전용: '확인되지 않은 개발자' 보안(Gatekeeper) 해제 및 실행 권한 부여
|
* Mac OS 전용: '확인되지 않은 개발자' 보안(Gatekeeper) 해제 및 실행 권한 부여
|
||||||
* @param targetPath 권한을 풀 파일 또는 폴더의 절대 경로
|
* @param targetPath 권한을 풀 파일 또는 폴더의 절대 경로
|
||||||
@ -167,30 +188,30 @@ fun main() = application {
|
|||||||
val os = System.getProperty("os.name").lowercase()
|
val os = System.getProperty("os.name").lowercase()
|
||||||
if (!os.contains("mac")) return // Mac 환경이 아니면 조용히 패스
|
if (!os.contains("mac")) return // Mac 환경이 아니면 조용히 패스
|
||||||
|
|
||||||
val targetFile = File(targetPath)
|
val targetFile = File(targetPath).parentFile
|
||||||
if (!targetFile.exists()) {
|
if (!targetFile.exists()) {
|
||||||
println("⚠️ [System] 권한을 부여할 경로를 찾을 수 없습니다: $targetPath")
|
println("⚠️ [System] 권한을 부여할 경로를 찾을 수 없습니다: $targetPath")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
println("🔓 [System] Mac 보안 권한 해제 시도 중... ($targetPath)")
|
println("🔓 [System] Mac 보안 권한 영구 해제 시도 중... ($targetPath)")
|
||||||
|
|
||||||
// 1. Apple Quarantine(격리) 속성 제거 (가장 중요!)
|
// 1단계: Apple Quarantine(격리) 속성 제거 (웹에서 다운받았다는 꼬리표 떼기)
|
||||||
// 악성코드 방지 시스템(Gatekeeper)이 dylib 파일들을 차단하는 것을 막습니다.
|
runCommand("xattr", "-cr", targetPath)
|
||||||
val xattrProcess = ProcessBuilder("xattr", "-cr", targetPath)
|
|
||||||
.redirectErrorStream(true)
|
|
||||||
.start()
|
|
||||||
xattrProcess.waitFor()
|
|
||||||
|
|
||||||
// 2. 실행 권한 부여 (chmod -R 777)
|
// 2단계: 파일 읽기/쓰기/실행 권한 부여
|
||||||
// -R 옵션으로 하위의 모든 라이브러리 파일까지 권한을 엽니다.
|
runCommand("chmod", "-R", "777", targetPath)
|
||||||
val chmodProcess = ProcessBuilder("chmod", "-R", "777", targetPath)
|
|
||||||
.redirectErrorStream(true)
|
|
||||||
.start()
|
|
||||||
chmodProcess.waitFor()
|
|
||||||
|
|
||||||
println("✅ [System] Mac 권한 해제 및 실행 권한 부여 완료!")
|
// 💡 3단계 [핵심]: 임시 서명 (Ad-hoc Signing) 강제 부여
|
||||||
|
// Apple Silicon (M1/M2/M3)은 서명 없는 바이너리를 실행 차단하므로, 임시 서명을 박아버립니다.
|
||||||
|
runCommand("codesign", "--force", "--deep", "--sign", "-", targetPath)
|
||||||
|
|
||||||
|
// 💡 4단계 [핵심]: Gatekeeper (spctl) 화이트리스트에 명시적으로 추가
|
||||||
|
// "확인되지 않은 개발자" 경고창을 영구적으로 우회합니다.
|
||||||
|
runCommand("spctl", "--add", targetPath)
|
||||||
|
|
||||||
|
println("✅ [System] Mac 강력 권한 해제 및 임시 서명 완료! 이제 경고창이 뜨지 않습니다.")
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
println("❌ [System] Mac 권한 부여 실패: ${e.message}")
|
println("❌ [System] Mac 권한 부여 실패: ${e.message}")
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user