从 pkgbuild 生成的 .pkg 安装程序安装的零字节应用程序

Zero-byte Application being installed from pkgbuild generated .pkg installer

这是我用来生成 .pkg 安装程序的 shell 脚本。

#!/bin/bash

APP_PATH=
DSYM_PATH=
PKG_PATH=
IDENTIFIER=
VERSION=
TARGET_DIR=$(dirname "$APP_PATH")/temp

echo "Deleting old Pkg File."
rm -rf $PKG_PATH
rm -rf $TARGET_DIR
mkdir $TARGET_DIR
echo "Done."

echo "Copying APP \"$APP_PATH\" and dSYM \"$DSYM_PATH \" to temp folder."

cp -a $APP_PATH $TARGET_DIR
cp -a $DSYM_PATH $TARGET_DIR

echo "Done."


echo "Generating .Pkg file with dSYM folder"

/usr/bin/pkgbuild \
  --root "$TARGET_DIR" \
  --install-location "/Applications" \
  --identifier "$IDENTIFIER" \
  --version "$VERSION" \
  "$PKG_PATH"

echo "Done Generating \"$APP_PATH\" with dSYM folder"

.pkg 安装到 /Applications 文件夹,但大小为 zero byte

我试过更改文件的权限,但没有用。

为了解决这个问题,我不得不更改文件的权限。

我在脚本中添加了以下行。

chmod -R 755 $TARGET_DIR

权限错误的文件将导致 zero-bytes 安装。

#!/bin/bash

APP_PATH=
DSYM_PATH=
PKG_PATH=
IDENTIFIER=
VERSION=
TARGET_DIR=$(dirname "$APP_PATH")/temp

echo "Deleting old Pkg File."
rm -rf $PKG_PATH
rm -rf $TARGET_DIR
mkdir $TARGET_DIR
echo "Done."

echo "Copying APP \"$APP_PATH\" and dSYM \"$DSYM_PATH \" to temp folder."

cp -a $APP_PATH $TARGET_DIR
cp -a $DSYM_PATH $TARGET_DIR

echo "Done."

chmod -R 755 $TARGET_DIR

echo "Generating .Pkg file with dSYM folder"

/usr/bin/pkgbuild \
  --root "$TARGET_DIR" \
  --install-location "/Applications" \
  --identifier "$IDENTIFIER" \
  --version "$VERSION" \
  "$PKG_PATH"

echo "Done Generating \"$APP_PATH\" with dSYM folder"