Embed libcrypto.1.0.0.dylib which been depand by ss-local.

This commit is contained in:
Charlie Qiu
2016-06-11 00:44:52 +08:00
parent 197e5eb47e
commit 98689a83aa
5 changed files with 17 additions and 4 deletions

View File

@ -125,6 +125,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
ProxyConfHelper.install()
applyConfig()
SyncSSLocal()
}
func applicationWillTerminate(aNotification: NSNotification) {

View File

@ -21,7 +21,8 @@ func getFileSHA1Sum(filepath: String) -> String {
return ""
}
// Ref: https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html
// Genarate the mac launch agent service plist
func generateSSLocalLauchAgentPlist() -> Bool {
let sslocalPath = NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local"
let logFilePath = NSHomeDirectory() + "/Library/Logs/ss-local.log"
@ -42,13 +43,15 @@ func generateSSLocalLauchAgentPlist() -> Bool {
}
}
// For a complete listing of the keys, see the launchd.plist manual page.
let dict: NSMutableDictionary = [
"Label": "com.qiuyuzhou.shadowsocksX-NE.local",
"WorkingDirectory": NSHomeDirectory() + APP_SUPPORT_DIR,
"KeepAlive": true,
"StandardOutPath": logFilePath,
"StandardErrorPath": logFilePath,
"ProgramArguments": arguments
"ProgramArguments": arguments,
"EnvironmentVariables": ["DYLD_LIBRARY_PATH": NSHomeDirectory() + APP_SUPPORT_DIR]
]
dict.writeToFile(plistFilepath, atomically: true)
let Sha1Sum = getFileSHA1Sum(plistFilepath)
@ -98,7 +101,9 @@ func StopSSLocal() {
func InstallSSLocal() {
let fileMgr = NSFileManager.defaultManager()
let homeDir = NSHomeDirectory()
if !fileMgr.fileExistsAtPath(homeDir+APP_SUPPORT_DIR+SS_LOCAL_VERSION+"/ss-local") {
let appSupportDir = homeDir+APP_SUPPORT_DIR
if !fileMgr.fileExistsAtPath(appSupportDir + SS_LOCAL_VERSION + "/ss-local")
|| !fileMgr.fileExistsAtPath(appSupportDir + "libcrypto.1.0.0.dylib") {
let bundle = NSBundle.mainBundle()
let installerPath = bundle.pathForResource("install_ss_local.sh", ofType: nil)
let task = NSTask.launchedTaskWithLaunchPath(installerPath!, arguments: [""])

View File

@ -12,6 +12,7 @@ mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local-2.4.6"
cp -f ss-local "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local-2.4.6/"
rm -f "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local"
ln -s "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local-2.4.6/ss-local" "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local"
#cp -f "com.qiuyuzhou.shadowsocksX-NE.local.plist" "$HOME/Library/LaunchAgents/"
cp -f libcrypto.1.0.0.dylib "$HOME/Library/Application Support/ShadowsocksX-NE/"
echo done

Binary file not shown.