diff options
Diffstat (limited to 'install/macos_packages/build_distribution_package.sh')
-rw-r--r-- | install/macos_packages/build_distribution_package.sh | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/install/macos_packages/build_distribution_package.sh b/install/macos_packages/build_distribution_package.sh index 54b4ef89d..4d3368c66 100644 --- a/install/macos_packages/build_distribution_package.sh +++ b/install/macos_packages/build_distribution_package.sh @@ -4,25 +4,25 @@ component_package="$1" resources="$2" arch="$3" -usage(){ - echo "Builds a distribution package for macOS." - echo "Assumes that the following items already exist:" - echo " - A starship component package" - echo " - Resources in a pkg_resources directory" - echo "Usage: $0 <path-to-component-package> <path-to-pkg-resources> <arch>" - echo " where arch is one of \"arm64\" or \"x86_64\"" +usage() { + echo "Builds a distribution package for macOS." + echo "Assumes that the following items already exist:" + echo " - A starship component package" + echo " - Resources in a pkg_resources directory" + echo "Usage: $0 <path-to-component-package> <path-to-pkg-resources> <arch>" + echo " where arch is one of \"arm64\" or \"x86_64\"" } -script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" source "$script_dir/common.sh" if [[ "$OSTYPE" != 'darwin'* ]]; then - error "This script only works on MacOS" + error "This script only works on MacOS" fi if [[ "${3-undefined}" = "undefined" ]]; then - usage - exit 1 + usage + exit 1 fi # Generate a distribution file with the appropriate architecture plists @@ -40,8 +40,7 @@ productbuild --synthesize --package starship-component.pkg --product "$archplist # search for a line that matches our opening tag and insert our desired lines after it # Solution taken from https://www.theunixschool.com/2012/06/insert-line-before-or-after-pattern.html -while read -r line -do +while read -r line; do echo "$line" if echo "$line" | grep -qF '<installer-gui-script '; then echo '<welcome file="welcome.html" mime-type="text-html" />' @@ -49,10 +48,10 @@ do echo '<conclusion file="conclusion.html" mime-type="text-html" />' echo '<background file="icon.png" scaling="proportional" alignment="bottomleft"/>' fi -done < starship_raw.dist > starship.dist +done <starship_raw.dist >starship.dist # The above script does not correctly take care of the last line. Apply fixup. -echo '</installer-gui-script>' >> starship.dist +echo '</installer-gui-script>' >>starship.dist echo "Creating distribution package with following distribution file:" cat starship.dist @@ -64,4 +63,4 @@ echo "Component package is $component_package" productbuild --distribution starship.dist --resources "$resources" --package-path "$component_package" starship-unsigned.pkg # Clean up the distribution files -rm -- *.dist
\ No newline at end of file +rm -- *.dist |