0

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

#!/bin/bash

APP_PATH=$1
DSYM_PATH=$2
PKG_PATH=$3
IDENTIFIER=$4
VERSION=$5
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大小。

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

4

1 回答 1

0

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

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

chmod -R 755 $TARGET_DIR

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

#!/bin/bash

APP_PATH=$1
DSYM_PATH=$2
PKG_PATH=$3
IDENTIFIER=$4
VERSION=$5
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"
于 2019-11-28T22:11:09.277 回答