From 792b669a6d1bbda7fb4e7f6beae5c4fdbb1c1198 Mon Sep 17 00:00:00 2001 From: hensm Date: Thu, 13 Dec 2018 16:12:38 +0000 Subject: [PATCH] Better macOS postinstall script --- app/bin/build.js | 2 ++ app/packaging/mac/scripts/postinstall | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/bin/build.js b/app/bin/build.js index a4d4fd5..0fac496 100644 --- a/app/bin/build.js +++ b/app/bin/build.js @@ -168,6 +168,8 @@ function packageDarwin (platform) { , manifestName , componentName , packageId: `tf.matt.${applicationName}` + , executablePath: executablePath[platform] + , manifestPath: manifestPath[platform] }; // Template paths diff --git a/app/packaging/mac/scripts/postinstall b/app/packaging/mac/scripts/postinstall index c18e5dc..2eb4567 100755 --- a/app/packaging/mac/scripts/postinstall +++ b/app/packaging/mac/scripts/postinstall @@ -3,9 +3,9 @@ # If the target location isn't root, we need to rewrite # the manifest path to point to the user directory. if [ "$2" != "/" ]; then - manifestPath=$2"/Library/Application Support/Mozilla/NativeMessagingHosts/{{{manifestName}}}" - sed -i.bak 's,"path": "/Library,"path": "'$2'/Library,g' "$manifestPath" - rm "$manifestPath.bak" + installedManifestPath=$2"/{{{manifestPath}}}/{{{manifestName}}}" + sed -i.bak 's,{{{executablePath}}},'$2'{{{executablePath}}},g' "$installedManifestPath" + rm "$installedManifestPath.bak" fi exit 0