ide\u8f6cexe<\/a>\uff0cpkgIdentifier\u6307\u5b9a\u8f6f\u4ef6\u5305\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff0cpkgVersion\u6307\u5b9a\u8f6f\u4ef6\u5305\u7684\u7248\u672c\u53f7\uff0cpkgName\u6307\u5b9a\u8f6f\u4ef6\u5305\u7684\u540d\u79f0\uff0cpkgRoot\u6307\u5b9a\u8f6f\u4ef6\u5305\u5b89\u88c5\u65f6\u7684\u6839\u76ee\u5f55\uff0cpkgScripts\u6307\u5b9a\u5b89\u88c5\u548c\u5378\u8f7d\u811a\u672c\u6240\u5728\u7684\u6587\u4ef6\u5939\u8def\u5f84\u3002pkgbuild\u547d\u4ee4\u5c06\u6839\u636e\u8fd9\u4e9b\u53c2\u6570\u521b\u5efa\u4e00\u4e2a\u540d\u4e3aExampleApp.pkg\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\nStep 3: \u521b\u5efa\u5b89\u88c5\u811a\u672c<\/p>\n
\u5b89\u88c5\u811a\u672c\u662f\u7528\u4e8e\u5728\u5b89\u88c5\u8f6f\u4ef6\u5305\u65f6\u6267\u884c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u5b83\u53ef\u4ee5\u6267\u884c\u4e00\u4e9b\u5fc5\u8981\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982\u521b\u5efa\u76ee\u5f55\u3001\u8bbe\u7f6e\u6743\u9650\u3001\u6267\u884c\u547d\u4ee4\u7b49\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5b89\u88c5\u811a\u672c\u793a\u4f8b\uff1a<\/p>\n
“`<\/p>\n
#!\/bin\/bash<\/p>\n
# \u521b\u5efa\u5b89\u88c5\u76ee\u5f55<\/p>\n
mkdir -p \/Applications\/ExampleApp<\/p>\n
# \u590d\u5236\u6587\u4ef6<\/p>\n
cp -R “${PKG_INSTALL_PATH}\/ExampleApp.app” \/Applications\/ExampleApp\/<\/p>\n
# \u8bbe\u7f6e\u6743\u9650<\/p>\n
chmod -R 755 \/Applications\/ExampleApp\/ExampleApp.app<\/p>\n
# \u6267\u884c\u547d\u4ee4<\/p>\n
open \/Applications\/ExampleApp\/ExampleApp.app<\/p>\n
“`<\/p>\n
\u5728\u4e0a\u9762\u7684\u811a\u672c\u4e2d\uff0c\u9996\u5148\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3aExampleApp\u7684\u76ee\u5f55\uff0c\u7136\u540e\u5c06\u8f6f\u4ef6\u5305\u4e2d\u7684ExampleApp.app\u6587\u4ef6\u590d\u5236\u5230\u8be5\u76ee\u5f55\u4e0b\uff0c\u5e76\u8bbe\u7f6e\u4e86\u9002\u5f53\u7684\u6743\u9650\u3002\u6700\u540e\uff0c\u6267\u884c\u4e86open\u547d\u4ee4\uff0c\u4ee5\u542f\u52a8\u8f6f\u4ef6\u3002<\/p>\n
Step 4: \u521b\u5efa\u5378\u8f7d\u811a\u672c<\/p>\n
\u5378\u8f7d\u811a\u672c\u662f\u7528\u4e8e\u5728\u5378\u8f7d\u8f6f\u4ef6\u5305\u65f6\u6267\u884c\u7684\u811a\u672c\u6587\u4ef6\uff0c\u5b83\u53ef\u4ee5\u6267\u884c\u4e00\u4e9b\u5fc5\u8981\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982\u5220\u9664\u6587\u4ef6\u3001\u5220\u9664\u76ee\u5f55\u7b49\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5378\u8f7d\u811a\u672c\u793a\u4f8b\uff1a<\/p>\n
“`<\/p>\n
#!\/bin\/bash<\/p>\n
# \u5220\u9664\u5b89\u88c5\u76ee\u5f55<\/p>\n
rm -rf \/Applications\/ExampleApp<\/p>\n
# \u5220\u9664\u684c\u9762\u5feb\u6377\u65b9\u5f0f<\/p>\n
rm -f ~\/Desktop\/ExampleApp.app<\/p>\n
“`<\/p>\n
\u5728\u4e0a\u9762\u7684\u811a\u672c\u4e2d\uff0c\u9996\u5148\u5220\u9664\u4e86\u540d\u4e3aExampleApp\u7684\u76ee\u5f55\uff0c\u7136\u540e\u5220\u9664\u4e86\u684c\u9762\u4e0a\u7684\u5feb\u6377\u65b9\u5f0f\u3002<\/p>\n
Step 5: \u6253\u5305\u8f6f\u4ef6\u5305<\/p>\n
\u5b8c\u6210\u4ee5\u4e0a\u6b65\u9aa4\u540e\uff0c\u5373\u53ef\u4f7f\u7528pkgbuild\u547d\u4ee4\u6253\u5305\u8f6f\u4ef6\u5305\u3002\u5728\u7ec8\u7aef\u4e2d\u8fdb\u5165\u6253\u5305\u6240\u9700\u7684\u6587\u4ef6\u5939\uff0c\u7136\u540e\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n
“`<\/p>\n
pkgbuild –root .\/ –scripts .\/scripts –identifier com.example.app –version 1.0 ExampleApp.pkg<\/p>\n
“`<\/p>\n
\u5728\u4e0a\u9762\u7684\u547d\u4ee4\u4e2d\uff0c–root\u53c2\u6570\u6307\u5b9a\u8f6f\u4ef6\u5305\u7684\u6839\u76ee\u5f55\uff0c–scripts\u53c2\u6570\u6307\u5b9a\u5b89\u88c5\u548c\u5378\u8f7d\u811a\u672c\u6240\u5728\u7684\u6587\u4ef6\u5939\u8def\u5f84\uff0c–identifier\u53c2\u6570\u6307\u5b9a\u8f6f\u4ef6\u5305\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff0c–version\u53c2\u6570\u6307\u5b9a\u8f6f\u4ef6\u5305\u7684\u7248\u672c\u53f7\uff0c\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u6307\u5b9a\u6253\u5305\u540e\u7684\u8f6f\u4ef6\u5305\u540d\u79f0\u3002<\/p>\n
Step 6: \u521b\u5efa\u5b8c\u6574\u5b89\u88c5\u5305<\/p>\n
\u5982\u679c\u9700\u8981\u5c06\u591a\u4e2a\u8f6f\u4ef6\u5305\u6253\u5305\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u5b89\u88c5\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528productbuild\u547d\u4ee4\u3002\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n
“`<\/p>\n
productbuild –package ExampleApp.pkg –version 1.0 –identifier com.example.app ExampleAppmsu\u6587\u4ef6\u751f\u6210exe<\/a>Installer.pkg<\/p>\n“`<\/p>\n
\u5728\u4e0a\u9762\u7684\u547d\u4ee4\u4e2d\uff0c–package\u53c2\u6570\u6307\u5b9a\u9700\u8981\u6253\u5305\u7684\u8f6f\u4ef6\u5305\uff0c–version\u53c2\u6570\u6307\u5b9a\u5b8c\u6574\u5b89<\/p>\n","protected":false},"excerpt":{"rendered":"
pkg\u6253\u5305\u662f\u4e00\u79cd\u5728macOS\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5e38\u7528\u7684\u8f6f\u4ef6\u6253\u5305\u65b9\u5f0f\u3002\u5b83\u5c06\u8f6f\u4ef6\u53ca\u5176\u4f9d\u8d56\u9879\u6253\u5305\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u5b89\u88c5\u5305\uff0c\u65b9\u4fbf\u7528\u6237\u8fdb\u884c\u5b89\u88c5\u548c\u5378\u8f7d\u3002\u672c\u6587\u5c06\u4ecb\u7ecdpkg\u6253\u5305\u7684\u539f\u7406\u548c\u8be6\u7ec6\u6b65\u9aa4\u30021. \u539f\u7406pkg\u6253\u5305\u7684\u539f\u7406\u662f\u5c06\u8f6f\u4ef6\u53ca<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[16065,10549,832,408,416],"topic":[],"class_list":["post-9993","post","type-post","status-publish","format-standard","hentry","category-exekf","tag-deb","tag-htmlexe","tag-832","tag-408","tag-416"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/9993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=9993"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/9993\/revisions"}],"predecessor-version":[{"id":10039,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/9993\/revisions\/10039"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=9993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=9993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=9993"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=9993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}