-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpi-remote.sh
More file actions
executable file
·30 lines (30 loc) · 890 Bytes
/
Copy pathpi-remote.sh
File metadata and controls
executable file
·30 lines (30 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env sh
set -eu
PATH="$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
export PATH
PI_REMOTE_INVOKED_AS=${PI_REMOTE_INVOKED_AS:-$(basename -- "$0")}
export PI_REMOTE_INVOKED_AS
SOURCE=$0
while [ -L "$SOURCE" ]; do
DIR=$(CDPATH='' cd -P -- "$(dirname -- "$SOURCE")" && pwd)
TARGET=$(readlink "$SOURCE")
case $TARGET in
/*) SOURCE=$TARGET ;;
*) SOURCE=$DIR/$TARGET ;;
esac
done
DIR=$(CDPATH='' cd -P -- "$(dirname -- "$SOURCE")" && pwd)
if [ -x "$DIR/pi-remote" ] && [ "$DIR/pi-remote" != "$SOURCE" ]; then
exec "$DIR/pi-remote" "$@"
fi
export PI_REMOTE_PACKAGE_ROOT="${PI_REMOTE_PACKAGE_ROOT:-$DIR}"
JS="$DIR/dist/pi-remote.js"
if command -v node >/dev/null 2>&1 && [ -r "$JS" ]; then
exec node "$JS" "$@"
fi
cat >&2 <<EOF
pi-remote: Node.js is required; no slow shell fallback is available.
Install Node.js, then run:
pi-remote --update
EOF
exit 127