Better macOS postinstall script

This commit is contained in:
hensm
2018-12-13 16:12:38 +00:00
parent aed6f12e1b
commit 792b669a6d
2 changed files with 5 additions and 3 deletions

View File

@@ -168,6 +168,8 @@ function packageDarwin (platform) {
, manifestName
, componentName
, packageId: `tf.matt.${applicationName}`
, executablePath: executablePath[platform]
, manifestPath: manifestPath[platform]
};
// Template paths

View File

@@ -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