【问题标题】:Pkgbuild and Productbuild PKG installs always under ROOT. Why?Pkgbuild 和 Productbuild PKG 总是在 ROOT 下安装。为什么?
【发布时间】:2021-07-23 16:56:56
【问题描述】:

请考虑以下 sh sn-p - 它生成的 PAK 文件始终安装在 /Applications 中的 ROOT 下并且无法在 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" 

【问题讨论】:

    标签: macos pkgbuild productbuild


    【解决方案1】:

    我认为这将有助于回答您关于为什么 pkgbuild 始终将内容安装为 root 拥有的问题:https://keith.github.io/xcode-man-pages/pkgbuild.1.html#-ownership

    【讨论】:

    • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
    猜你喜欢
    • 2023-02-17
    • 2013-03-17
    • 1970-01-01
    • 2013-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多