@@ -16,20 +16,36 @@ export MAS_DO_NOT_PRINT_NOTICE=
1616Scripts/build " ${1:- } " -c release " ${@: 2} "
1717unset MAS_DO_NOT_PRINT_NOTICE
1818
19- build_dir=.build
20- destination_dir=" ${build_dir} /destination"
21- mas_executable=" ${destination_dir} /mas"
19+ build_folder=.build
20+ destination_folder=" ${build_folder} /destination"
21+ installation_folder=/usr/local/opt/mas
22+ installation_staging_folder=" ${destination_folder}${installation_folder} "
23+ usr_local_bin_staging_folder=" ${destination_folder} /usr/local/bin"
2224version=" $( Scripts/version) "
2325
24- mkdir -p " ${destination_dir} "
25- ln -f " $( swift build -c release --show-bin-path " ${@: 2} " ) /mas" " ${mas_executable} "
26+ swift package generate-manual
27+
28+ mkdir -p " ${installation_staging_folder} /bin"
29+ mkdir -p " ${installation_staging_folder} /etc/bash_completion.d"
30+ mkdir -p " ${installation_staging_folder} /share/fish/vendor_completions.d"
31+ mkdir -p " ${installation_staging_folder} /share/man/man1"
32+ mkdir -p " ${usr_local_bin_staging_folder} "
33+
34+ cp LICENSE README.md " ${installation_staging_folder} "
35+ cp Scripts/mas " ${installation_staging_folder} /bin/mas"
36+ cp contrib/completion/mas-completion.bash " ${installation_staging_folder} /etc/bash_completion.d/mas"
37+ cp contrib/completion/mas.fish " ${installation_staging_folder} /share/fish/vendor_completions.d/mas.fish"
38+ ln -f " $( swift build -c release --show-bin-path " ${@: 2} " ) /mas" " ${installation_staging_folder} /bin/mas-bin"
39+ ln -f .build/plugins/GenerateManual/outputs/mas/mas.1 " ${installation_staging_folder} /share/man/man1/mas.1"
40+
41+ ln -fs " ${installation_folder} /bin/mas" " ${usr_local_bin_staging_folder} /mas"
2642
2743pkgbuild\
2844 --identifier io.github.mas-cli.mas\
29- --install-location /usr/local/bin \
45+ --install-location /\
3046 --version " ${version} " \
31- --root " ${destination_dir } " \
32- " ${build_dir } /mas_components.pkg"
47+ --root " ${destination_folder } " \
48+ " ${build_folder } /mas_components.pkg"
3349
3450# shellcheck disable=SC1036
3551productbuild\
@@ -60,5 +76,5 @@ productbuild\
6076</installer-gui-script>
6177END
6278)\
63- --package-path " ${build_dir } " \
64- " ${build_dir } /mas-${version} -${${(s: : o)$(lipo -archs " ${mas_executable} " )} // / -} .pkg"
79+ --package-path " ${build_folder } " \
80+ " ${build_folder } /mas-${version} -${${(s: : o)$(lipo -archs " ${installation_staging_folder} /bin/mas-bin " )} // / -} .pkg"
0 commit comments