简体   繁体   English

Mac OSx PKG预安装脚本问题

[英]Mac OSx PKG preinstall script issue

I have a problem with running preinstall script within PKG I created for Mac OS X on linux machine. 我在为Linux机器上的Mac OS X创建的PKG中运行预安装脚本时遇到问题。

My problem is, that preinstall script is not executed and installer finishes with sucess, even my script should cause the failure. 我的问题是,预安装脚本未执行,并且安装程序成功完成,即使我的脚本也应导致失败。

I have prepared following directory structure on the hard-drive: 我已经在硬盘上准备了以下目录结构:

./Applications
./Resources
./Scripts

by running of following commands: 通过运行以下命令:

mkdir -p Payload.pkg
chmod -R a+w Applications
chmod a+x Scripts/preinstall

mkbom -u 0 -g 0 Applications Payload.pkg/Bom

find Applications | cpio --owner 0:0 -H odc -o | gzip -c > Payload.pkg/Payload

pushd Scripts
find . | cpio --owner 0:0 -H odc -o | gzip -c > Payload.pkg/Scripts
popd

chmod a+x Payload.pkg/Scripts

xar --compress none -cf MyApp.pkg Distribution Resources Payload.pkg

I have created package with following structure: 我创建了具有以下结构的软件包:

My package.pkg
    +--Distribution
    +--Resources
        +--welcome.rtf
    +--Payload.pkg
        +--Scripts
        +--Bom
        +--PackageInfo
        +--Payload

my preinstall scripts has following content: 我的预安装脚本具有以下内容:

#!/bin/bash
##preinstall

pathToScript=$0
pathToPackage=$1
TargetLocation=$2
targetVolume=$3

exit 1

Which should be causing failure of the installer. 这应该导致安装程序失败。 However it does not. 但是事实并非如此。 It seems, that script is not invoked. 似乎没有调用该脚本。

Could somebody help me please? 有人可以帮我吗?

If you want a script to be called, it needs to be included in the <scripts> section of PackageInfo like so: 如果要调用脚本,则需要将其包含在PackageInfo<scripts>部分中,如下所示:

  <scripts>
      <preinstall file="./preinstall"/>
  </scripts>

Source: https://hogliux.github.io/bomutils/tutorial.html 资料来源: https : //hogliux.github.io/bomutils/tutorial.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM