请考虑以下sh代码段-它生成PAK文件,该文件总是安装在/Applications的根下,并且在Mojave上启动失败,除非
sudo -R `whoami` /Applications/MyApp.app被发布..。
(this建议并不能为我解决这个问题.)
提前感谢!
#!/bin/bash
NAME="MyApp"
APP_NAME="${NAME}.app"
INSTALL_LOCATION="/Applications"
COMP_PLIST="./${NAME}-comp.plist"
SIGNING_IDENTITY="Videv Milko"
VERSION=`grep "<string>" ${APP_NAME}/Contents/Info.plist | tail -1 | sed -n 's/.*>\(.*\)<.*/\1/p'`
PKG_NAME="$NAME-macos-x64-$VERSION.pkg"
# Chnage ownership
chown -R `whoami` "./${APP_NAME}"
# Build componenet plist
pkgbuild --root "./${APP_NAME}" --analyze "$COMP_PLIST"
# Update component plist to disable relocation of the instalation
plutil -replace BundleIsRelocatable -bool false "$COMP_PLIST"
# build the plugin
pkgbuild \
--version "$VERSION" \
--root "./${APP_NAME}" \
--install-location "$INSTALL_LOCATION" \
--sign "$SIGNING_IDENTITY" \
--component-plist "$COMP_PLIST" \
"tmp-${PKG_NAME}"
# Generate Distribution.xml
productbuild --synthesize \
--package "tmp-${PKG_NAME}" ./Distribution.xml
# Change Distribution.xml (image, license, ...)
# TODO
# Finally, build the installer package
productbuild --distribution ./Distribution.xml \
--package-path . "$PKG_NAME" 发布于 2022-03-29 14:59:01
我认为这将有助于回答您的问题,即为什么pkgbuild总是将内容安装为根拥有的:https://keith.github.io/xcode-man-pages/pkgbuild.1.html#-ownership。
https://stackoverflow.com/questions/68502711
复制相似问题