[英]Zero-byte Application being installed from pkgbuild generated .pkg installer
this is the shell script that I use to generate the .pkg
installer.这是我用来生成
.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"
This .pkg
is installed to /Applications
folder but it's zero byte
in size.此
.pkg
安装到/Applications
文件夹,但它的大小zero byte
。
I've tried to change the permission of the files but it's no use.我试图更改文件的权限,但没有用。
To solve this issue, I had to change the permissions for files.为了解决这个问题,我不得不更改文件的权限。
I've added the following line in the script.我在脚本中添加了以下行。
chmod -R 755 $TARGET_DIR
The file with wrong permission will result a zero-bytes
installation.具有错误权限的文件将导致
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"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.