我正在使用PackageMaker的新域功能(针对Mac OS 10.5引入)来定位用户主目录。我在PackageMaker.app中创建了一个.pmdoc文件,在我添加安装后脚本之前,一切都运行良好。然后,突然之间,我的包需要root权限,而不是之前。我尝试使用packagemaker --doc mypackage.pmdoc --info Dist/PackageInfo
从命令行构建,提供一个明确指定auth="none"
的调整后的PackageInfo文件,但这不起作用。当我通过使用xar -xf package.pkg
提取输出包来调查输出包时,似乎在package.pkg/Distribution
中指定了身份验证,这是packagemaker
为自己生成的XML文件。
由于对GUI的沮丧,我已经切换到在命令行上仅使用packagemaker
。但是,现在我的包不显示我的用户界面文件(尽管它们包含在.pkg存档中),但仍然需要root身份验证。生成的Distribution
文件中的违规行是(notice auth =“Root”):
<pkg-ref id="org.myUniqueID.pkg" installKBytes="12032" version="1.0" auth="Root">#grooveshark.pkg</pkg-ref>
这就是我运行packagemaker
:
packagemaker -r ./Grooveshark -f ./Dist/PackageInfo -s ./Dist/Scripts -e ./Dist/Resources -v --domain user --target 10.5 --no-relocate --discard-forks --no-recommend -o ./out.pkg
这是Dist
:
Dist/Distribution # this isn't used by packagemaker, it generates its own
Dist/PackageInfo
Dist/Resources/en.lproj/background
Dist/Resources/en.lproj/License
Dist/Resources/en.lproj/ReadMe
Dist/Resources/en.lproj/Welcome.rtfd
Dist/Resources/en.lproj/Welcome.rtfd/gsDesktopPreview-mini.png
Dist/Resources/en.lproj/Welcome.rtfd/gsDesktopPreview-searchSmall.png
Dist/Resources/en.lproj/Welcome.rtfd/TXT.rtf
Dist/Scripts/jsuuid # specified as a postinstall in Dist/PackageInfo
Dist/Scripts/postflight
如何配置我的软件包以便在不需要root身份验证的情况下运行postinstall脚本?我是否缺少通过命令行指定PackageInfo文件和Distribution安装脚本XML文件?
答案 0 :(得分:1)
我最终将文件移动到分布式布局中,然后我使用以下脚本首先构建传统的平面包,然后展开它,在允许每个用户安装的设置中复制,然后使用不同的进程在没有处理的情况下将其压缩到PKG中。
#!/usr/bin/bash
# Build Package for local install using witchcraft
PROJECT="some/filesystem/location/with/your/files"
BUILDDIR="$PROJECT/Dist/build"
PKGROOT="$PROJECT/Dist/Package_Root"
INFO="$PROJECT/Dist/PackageInfo"
DIST="$PROJECT/Dist/Distribution"
RESOURCES="$PROJECT/Dist/Resources"
SCRIPTS="$PROJECT/Dist/Scripts"
# Remove .DS_Store files
find "$PKGROOT" -name ".DS_Store" | sed 's/ /\\ /' | xargs rm
# make build dir
mkdir "$BUILDDIR"
# build flat package that needs root to install
packagemaker -r "$PKGROOT" -f "$INFO" -s "$SCRIPTS" $ARGS -o "$BUILDDIR/flat.pkg"
# Build distribution that installs into home dirs by unpacking the flat pkg
echo "Building Distribution"
echo " Copying filesystem"
cp -r "$RESOURCES" "$BUILDDIR/Resources"
cp "$DIST" "$BUILDDIR/Distribution"
echo " extracting flat package"
pkgutil --expand "$BUILDDIR/flat.pkg" "$BUILDDIR/grooveshark.pkg/"
rm "$BUILDDIR/flat.pkg"
echo " flattening distribution"
pkgutil --flatten "$BUILDDIR" "$PROJECT/$1.pkg"
echo "Finished!"