-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update prompt-install to detect and handle prompt installation for apple silicon (arm64e) architecture * install homebrew used to manage rosetta 2 installations (x86_64) in /usr/local * install homebrew used to manage native installations (arm64e) in /opt/homebrew * introduce `brew-intel` and `brew-arm` aliases to enable management of both installations regardless of the architecture of the current shell * update `use-shell` to detect arm64e native shells * fix an issue where the PATH variable is reordered by invalid path_helper invocations * normalise and fix areas where the PATH variable is modified * normalise eval invocations (such as completions) * remove completion check for gulp and grunt, which are largely obsolete * fix an issue where it was assumed that gpg was available * add end-to-end tests for Windows 2019 under WSL 1 * add end-to-end tests for all validated linux distributions - create a non-root user - add user to sudoers - install gosu - use gosu to invoke installs and tests under non-root user * update VERSION logic in prompt-install / update to support the `next` branch and any future branches - this should be improved in the future to correctly recommend updates based on semver tags (or the branch/channel used to install prompt) Closes: #66, #69 NOTE: Homebrew, which we rely heavily on, does not yet officially support apple silicon. In addition, very few formulae include bottles (pre-compiled) binaries for the SoC. As a result, most formulae must be compiled from source. Many formulae do not yet successfully compile for apple silicon and so we must gracefully fallback to their x86_64 counterparts. The following methodology is used to support prompt on apple silicon macs: 1. install homebrew instance for intel/rosetta (x86_64) under /usr/local 2. detect apple silicon (arm64e) and install homebrew instance in /opt/homebrew 3. attempt to install all tools included with prompt natively in /opt/homebrew 4. install all tools included with prompt under rosetta in /usr/local 5. ensure /opt/homebrew is prioritised in the PATH variable The above methodology will enable native tools if and when they are available and working with apple silicon. Tools that are not available and/or fail will fallback to the rosetta versions. This enables a seamless experience for apple silicon users.
- Loading branch information
1 parent
57ff672
commit 6bcfa25
Showing
41 changed files
with
517 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
b420dd99ffaa647cd1d8e97ad4b1e6914b03a811 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#! /usr/bin/env sh | ||
|
||
set -e | ||
|
||
SCRIPT_DIR=$(mktemp -d) | ||
|
||
cat <<- 'EOT' > $SCRIPT_DIR.e2e.sh | ||
#! /usr/bin/env sh | ||
set -e | ||
./hack/pre.apt.sh | ||
./hack/install.sh bash | ||
./hack/install.sh zsh | ||
./hack/test.sh | ||
EOT | ||
|
||
chmod +x $SCRIPT_DIR/e2e.sh | ||
|
||
docker run \ | ||
--volume $PWD:/home/build | ||
--volume $SCRIPT_DIR:/build \ | ||
debian --tty 'sh -c /build/e2e.sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /usr/bin/env sh | ||
|
||
set -e | ||
|
||
./hack/install.sh bash | ||
./hack/install.sh zsh | ||
./hack/test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#! /usr/bin/env sh | ||
|
||
set -e | ||
|
||
SCRIPT_DIR=$(mktemp -d) | ||
|
||
cat <<- 'EOT' > $SCRIPT_DIR.e2e.sh | ||
#! /usr/bin/env sh | ||
set -e | ||
./hack/pre.apt.sh | ||
./hack/install.sh bash | ||
./hack/install.sh zsh | ||
./hack/test.sh | ||
EOT | ||
|
||
chmod +x $SCRIPT_DIR/e2e.sh | ||
|
||
docker run \ | ||
--volume $PWD:/home/build | ||
--volume $SCRIPT_DIR:/build \ | ||
centos --tty 'sh -c /build/e2e.sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#! /usr/bin/env sh | ||
|
||
set -e | ||
|
||
SHELL_NAME=${1:-'bash'} | ||
|
||
./install.sh $SHELL_NAME | ||
|
||
SHELL=$SHELL_NAME | ||
|
||
if [ -f /opt/homebrew/bin/$SHELL_NAME ]; then | ||
SHELL=/opt/homebrew/bin/$SHELL_NAME | ||
elif [ -f /usr/local/bin/$SHELL_NAME ]; then | ||
SHELL=/usr/local/bin/${SHELL_NAME} | ||
elif [ -f /home/linuxbrew/.linuxbrew/bin/$SHELL_NAME ]; then | ||
SHELL=/home/linuxbrew/.linuxbrew/bin/${SHELL_NAME} | ||
fi | ||
|
||
$SHELL -lc 'cat $AM_PROMPT/.sha' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#! /usr/bin/env sh | ||
|
||
set -e | ||
|
||
apt-get update && apt-get install -y gosu sudo git | ||
gosu nobody true | ||
|
||
useradd --uid 1000 --user-group --system --create-home --no-log-init --groups tty --shell /bin/bash build | ||
echo 'build ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers | ||
chown -R build:build /home/build | ||
chmod u=rwx,g=rx,o= /home/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#! /usr/bin/env sh | ||
|
||
set -e | ||
|
||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 | ||
curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64" | ||
curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64.asc" | ||
gpg --verify /usr/local/bin/gosu.asc | ||
chmod +x /usr/local/bin/gosu | ||
gosu nobody true | ||
|
||
yum update -y && yum install -y sudo | ||
|
||
useradd --uid 1000 --user-group --system --create-home --no-log-init \--groups tty --shell /bin/bash build | ||
echo 'build ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers | ||
chown -R build:build /home/build | ||
chmod u=rwx,g=rx,o= /home/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env sh | ||
|
||
final=0 | ||
|
||
SHELL_NAME=${1:-'bash'} | ||
SHELL=$SHELL_NAME | ||
|
||
if [ -f /opt/homebrew/bin/$SHELL_NAME ]; then | ||
SHELL=/opt/homebrew/bin/$SHELL_NAME | ||
elif [ -f /usr/local/bin/$SHELL_NAME ]; then | ||
SHELL=/usr/local/bin/${SHELL_NAME} | ||
elif [ -f /home/linuxbrew/.linuxbrew/bin/$SHELL_NAME ]; then | ||
SHELL=/home/linuxbrew/.linuxbrew/bin/${SHELL_NAME} | ||
fi | ||
|
||
for test in ./test/sh/scripts/*.test.sh; do | ||
TERM=dumb $SHELL -lc "$test" | ||
exit_code=$? | ||
|
||
if [ $exit_code -ne 0 ]; then | ||
name=$(basename $test) | ||
echo "test ($name) failed: $exit_code" | ||
final=1 | ||
fi | ||
done | ||
|
||
exit $final |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.