Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup legacy constructs in pleasew wrapper script #1828

Merged
merged 2 commits into from
May 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Replace legacy backticks with $() notation in pleasew wrapper script
  • Loading branch information
hyperupcall committed May 27, 2021
commit 62ac45723086c6e8213b518fb443e39b09478714
12 changes: 6 additions & 6 deletions pleasew
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RESET="\x1B[0m"

DEFAULT_URL_BASE="https://get.please.build"
# We might already have it downloaded...
LOCATION=`grep -i "^location" .plzconfig 2>/dev/null | cut -d '=' -f 2 | tr -d ' '`
LOCATION=$(grep -i "^location" .plzconfig 2>/dev/null | cut -d '=' -f 2 | tr -d ' ')
if [ -z "$LOCATION" ]; then
if [ -z "$HOME" ]; then
echo -e >&2 "${RED}\$HOME not set, not sure where to look for Please.${RESET}"
Expand All @@ -25,24 +25,24 @@ if [ -f "$TARGET" ]; then
exec "$TARGET" ${PLZ_ARGS:-} "$@"
fi

URL_BASE="`grep -i "^downloadlocation" .plzconfig | cut -d '=' -f 2 | tr -d ' '`"
URL_BASE="$(grep -i "^downloadlocation" .plzconfig | cut -d '=' -f 2 | tr -d ' ')"
if [ -z "$URL_BASE" ]; then
URL_BASE=$DEFAULT_URL_BASE
fi
URL_BASE="${URL_BASE%/}"

VERSION="`grep -i "^version[^a-z]" .plzconfig`"
VERSION="$(grep -i "^version[^a-z]" .plzconfig)"
VERSION="${VERSION#*=}" # Strip until after first =
VERSION="${VERSION/ /}" # Remove all spaces
VERSION="${VERSION#>=}" # Strip any initial >=
if [ -z "$VERSION" ]; then
echo -e >&2 "${YELLOW}Can't determine version, will use latest.${RESET}"
VERSION=`curl -fsSL ${URL_BASE}/latest_version`
VERSION=$(curl -fsSL ${URL_BASE}/latest_version)
fi

# Find the os / arch to download. You can do this quite nicely with go env
# but we use this script on machines that don't necessarily have Go itself.
OS=`uname`
OS=$(uname)
if [ "$OS" = "Linux" ]; then
GOOS="linux"
elif [ "$OS" = "Darwin" ]; then
Expand All @@ -64,7 +64,7 @@ echo -e >&2 "${GREEN}Downloading Please ${VERSION} to ${DIR}...${RESET}"
mkdir -p "$DIR"
curl -fsSL "${PLEASE_URL}" | tar -xJpf- --strip-components=1 -C "$DIR"
# Link it all back up a dir
for x in `ls "$DIR"`; do
for x in $(ls "$DIR"); do
ln -sf "${DIR}/${x}" "$LOCATION"
done
echo -e >&2 "${GREEN}Should be good to go now, running plz...${RESET}"
Expand Down