mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 07:46:28 +00:00
docs(install): fix typo and update indentation and whitespaces (#4941)
This commit is contained in:
parent
0c5b11da12
commit
000f5ed10d
@ -2,30 +2,30 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Envrionmental variables that need to be set. These are sane defaults
|
# Environmental variables that need to be set. These are sane defaults
|
||||||
# KEYCHAIN_ENTRY=AC_PASSWORD # Or whatever you picked for <AUTH_ITEM_NAME>
|
# KEYCHAIN_ENTRY=AC_PASSWORD # Or whatever you picked for <AUTH_ITEM_NAME>
|
||||||
# RUNNER_TEMP=~/Library/Keychains/
|
# RUNNER_TEMP=~/Library/Keychains/
|
||||||
# KEYCHAIN_FILENAME=login.keychain-db
|
# KEYCHAIN_FILENAME=login.keychain-db
|
||||||
#
|
#
|
||||||
# Environmental variables that can be set if needed. Else they will default to
|
# Environmental variables that can be set if needed. Else they will default to
|
||||||
# values selected for the CI
|
# values selected for the CI
|
||||||
#
|
#
|
||||||
# The identifier for the application signing key. Can be a name or a fingerprint
|
# The identifier for the application signing key. Can be a name or a fingerprint
|
||||||
# APPLICATION_KEY_IDENT=E03290CABE09E9E42341C8FC82608E91241FAD4A
|
# APPLICATION_KEY_IDENT=E03290CABE09E9E42341C8FC82608E91241FAD4A
|
||||||
# The identifier for the installer signing key. Can be a name or a fingerprint
|
# The identifier for the installer signing key. Can be a name or a fingerprint
|
||||||
# INSTALLATION_KEY_IDENT=E525359D0B5AE97B7B6F5BB465FEC872C117D681
|
# INSTALLATION_KEY_IDENT=E525359D0B5AE97B7B6F5BB465FEC872C117D681
|
||||||
|
|
||||||
usage(){
|
usage() {
|
||||||
echo "Builds, signs, and notarizes starship."
|
echo "Builds, signs, and notarizes starship."
|
||||||
echo "Read readme.md in the script directory to see the assumptions the script makes."
|
echo "Read readme.md in the script directory to see the assumptions the script makes."
|
||||||
echo "Usage: $0 <path-to-starship-binary> <path-to-docs-directory> <arch> [pkgname]"
|
echo "Usage: $0 <path-to-starship-binary> <path-to-docs-directory> <arch> [pkgname]"
|
||||||
echo " Example: $0 target/release/starship docs/ x64"
|
echo " Example: $0 target/release/starship docs/ x64"
|
||||||
echo " Example: $0 target/debug/starship docs/ arm64 starship-1.2.1-arm64.pkg"
|
echo " Example: $0 target/debug/starship docs/ arm64 starship-1.2.1-arm64.pkg"
|
||||||
echo ""
|
echo ""
|
||||||
echo "If no pkgname is provided, the package will be named starship-<version>-<arch>.pkg"
|
echo "If no pkgname is provided, the package will be named starship-<version>-<arch>.pkg"
|
||||||
}
|
}
|
||||||
|
|
||||||
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"
|
source "$script_dir/common.sh"
|
||||||
|
|
||||||
if [[ -z ${KEYCHAIN_ENTRY+x} ]]; then
|
if [[ -z ${KEYCHAIN_ENTRY+x} ]]; then
|
||||||
@ -56,8 +56,8 @@ if [[ -z ${INSTALLATION_KEY_IDENT+x} ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${3+x} ]]; then
|
if [[ -z ${3+x} ]]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
starship_binary="$1"
|
starship_binary="$1"
|
||||||
@ -112,4 +112,4 @@ if [ "$pkgname" = "" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo ">>>> Placing final output at $pkgname"
|
echo ">>>> Placing final output at $pkgname"
|
||||||
mv starship.pkg "$pkgname"
|
mv starship.pkg "$pkgname"
|
||||||
|
@ -8,7 +8,7 @@ set -euo pipefail
|
|||||||
# Usage: run this script, passing $1 to the repository path. The script assumes
|
# Usage: run this script, passing $1 to the repository path. The script assumes
|
||||||
# it is being run from within a starship repository if $1 is not provided.
|
# it is being run from within a starship repository if $1 is not provided.
|
||||||
|
|
||||||
usage(){
|
usage() {
|
||||||
echo "Builds a component package for macOS."
|
echo "Builds a component package for macOS."
|
||||||
echo "Assumes that the following items already exist:"
|
echo "Assumes that the following items already exist:"
|
||||||
echo " - A starship binary which has already been notarized"
|
echo " - A starship binary which has already been notarized"
|
||||||
@ -17,10 +17,10 @@ usage(){
|
|||||||
echo "Usage: $0 <path-to-starship-binary> <path-to-dist-directory>"
|
echo "Usage: $0 <path-to-starship-binary> <path-to-dist-directory>"
|
||||||
}
|
}
|
||||||
|
|
||||||
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"
|
source "$script_dir/common.sh"
|
||||||
|
|
||||||
cleanup_server(){
|
cleanup_server() {
|
||||||
if [[ -n "${server_pid-}" ]]; then
|
if [[ -n "${server_pid-}" ]]; then
|
||||||
echo "Killing HTTP server ($server_pid) to clean up."
|
echo "Killing HTTP server ($server_pid) to clean up."
|
||||||
kill "$server_pid"
|
kill "$server_pid"
|
||||||
@ -77,7 +77,7 @@ sleep 3
|
|||||||
# on MacOS by default, but lucky for us, it does exist on GHActions runners.
|
# on MacOS by default, but lucky for us, it does exist on GHActions runners.
|
||||||
# Wget may return nonzero exit codes even if things were mostly fine (e.g. 404 for
|
# Wget may return nonzero exit codes even if things were mostly fine (e.g. 404 for
|
||||||
# some links on translated pages) so we simply ignore if it has a failure
|
# some links on translated pages) so we simply ignore if it has a failure
|
||||||
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent 127.0.0.1:8000 &> wget.log || true
|
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent 127.0.0.1:8000 &>wget.log || true
|
||||||
mkdir -p "$pkgdir/usr/local/share/doc/"
|
mkdir -p "$pkgdir/usr/local/share/doc/"
|
||||||
mv 127.0.0.1:8000 "$pkgdir/usr/local/share/doc/starship"
|
mv 127.0.0.1:8000 "$pkgdir/usr/local/share/doc/starship"
|
||||||
|
|
||||||
@ -87,4 +87,4 @@ trap - INT
|
|||||||
|
|
||||||
# Build the component package
|
# Build the component package
|
||||||
version="$(starship_version "$starship_program_file")"
|
version="$(starship_version "$starship_program_file")"
|
||||||
pkgbuild --identifier com.starshipprompt.starship --version "$version" --root $pkgdir starship-component.pkg
|
pkgbuild --identifier com.starshipprompt.starship --version "$version" --root $pkgdir starship-component.pkg
|
||||||
|
@ -4,25 +4,25 @@ component_package="$1"
|
|||||||
resources="$2"
|
resources="$2"
|
||||||
arch="$3"
|
arch="$3"
|
||||||
|
|
||||||
usage(){
|
usage() {
|
||||||
echo "Builds a distribution package for macOS."
|
echo "Builds a distribution package for macOS."
|
||||||
echo "Assumes that the following items already exist:"
|
echo "Assumes that the following items already exist:"
|
||||||
echo " - A starship component package"
|
echo " - A starship component package"
|
||||||
echo " - Resources in a pkg_resources directory"
|
echo " - Resources in a pkg_resources directory"
|
||||||
echo "Usage: $0 <path-to-component-package> <path-to-pkg-resources> <arch>"
|
echo "Usage: $0 <path-to-component-package> <path-to-pkg-resources> <arch>"
|
||||||
echo " where arch is one of \"arm64\" or \"x86_64\""
|
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"
|
source "$script_dir/common.sh"
|
||||||
|
|
||||||
if [[ "$OSTYPE" != 'darwin'* ]]; then
|
if [[ "$OSTYPE" != 'darwin'* ]]; then
|
||||||
error "This script only works on MacOS"
|
error "This script only works on MacOS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${3-undefined}" = "undefined" ]]; then
|
if [[ "${3-undefined}" = "undefined" ]]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate a distribution file with the appropriate architecture plists
|
# 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
|
# 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
|
# Solution taken from https://www.theunixschool.com/2012/06/insert-line-before-or-after-pattern.html
|
||||||
|
|
||||||
while read -r line
|
while read -r line; do
|
||||||
do
|
|
||||||
echo "$line"
|
echo "$line"
|
||||||
if echo "$line" | grep -qF '<installer-gui-script '; then
|
if echo "$line" | grep -qF '<installer-gui-script '; then
|
||||||
echo '<welcome file="welcome.html" mime-type="text-html" />'
|
echo '<welcome file="welcome.html" mime-type="text-html" />'
|
||||||
@ -49,10 +48,10 @@ do
|
|||||||
echo '<conclusion file="conclusion.html" mime-type="text-html" />'
|
echo '<conclusion file="conclusion.html" mime-type="text-html" />'
|
||||||
echo '<background file="icon.png" scaling="proportional" alignment="bottomleft"/>'
|
echo '<background file="icon.png" scaling="proportional" alignment="bottomleft"/>'
|
||||||
fi
|
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.
|
# 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:"
|
echo "Creating distribution package with following distribution file:"
|
||||||
cat starship.dist
|
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
|
productbuild --distribution starship.dist --resources "$resources" --package-path "$component_package" starship-unsigned.pkg
|
||||||
|
|
||||||
# Clean up the distribution files
|
# Clean up the distribution files
|
||||||
rm -- *.dist
|
rm -- *.dist
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
error(){
|
error() {
|
||||||
echo "[ERROR]: $1"
|
echo "[ERROR]: $1"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
starship_version(){
|
starship_version() {
|
||||||
starship_program_file="$1"
|
starship_program_file="$1"
|
||||||
# Check if this is a relative path: if so, prepend './' to it
|
# Check if this is a relative path: if so, prepend './' to it
|
||||||
if [ "$1" = "${1#/}" ]; then
|
if [ "$1" = "${1#/}" ]; then
|
||||||
starship_program_file="./$starship_program_file"
|
starship_program_file="./$starship_program_file"
|
||||||
fi
|
fi
|
||||||
if "$starship_program_file" -V 2>&1 > /dev/null; then
|
if "$starship_program_file" -V 2>&1 >/dev/null; then
|
||||||
"$starship_program_file" -V | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
|
"$starship_program_file" -V | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
|
||||||
else
|
else
|
||||||
# try to get this information from Cargo.toml
|
# try to get this information from Cargo.toml
|
||||||
|
@ -138,7 +138,7 @@ attempts, run
|
|||||||
xcrun notarytool history --keychain-profile "AC_PASSWORD"
|
xcrun notarytool history --keychain-profile "AC_PASSWORD"
|
||||||
```
|
```
|
||||||
|
|
||||||
Find the `id` of the attempt you wish to view, then run one of these commmands:
|
Find the `id` of the attempt you wish to view, then run one of these commands:
|
||||||
|
|
||||||
```
|
```
|
||||||
xcrun notarytool info <run-id> --keychain-profile "AC_PASSWORD"
|
xcrun notarytool info <run-id> --keychain-profile "AC_PASSWORD"
|
||||||
|
Loading…
Reference in New Issue
Block a user