Skip to content

Commit

Permalink
[Installers] Use latest tag, not main (#1007)
Browse files Browse the repository at this point in the history
Make install scripts use the latest tag for scripted installation, not `main` by default. Even though it should always be stable, `main` may be broken between releases, especially with its extras integration. It's safer to always point new users only to the latest known stable point.
  • Loading branch information
hugsy authored Nov 28, 2023
1 parent 788f56b commit 0f6255e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions scripts/gef-extras.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#
set -e

usage() { echo "Usage: $0 [-b <main|OtherBranchName>] [-p <path_to_install>]" 1>&2; exit 1; }
usage() { echo "Usage: $0 [-b <OtherBranchName|tag>] [-p <path_to_install>]" 1>&2; exit 1; }

branch="main"
latest_tag=$(curl -s "https://api.github.com/repos/hugsy/gef/tags" | grep "name" | head -1 | sed -e 's/"name": "\([^"]*\)",/\1/' -e 's/ *//')

branch=${latest_tag}
while getopts ":b:p:" o; do
case "${o}" in
b)
Expand Down
7 changes: 6 additions & 1 deletion scripts/gef.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -e

branch="main"
curl_found=0
wget_found=0

Expand All @@ -22,13 +21,19 @@ if [ -f "${HOME}/.gdbinit" ]; then
fi

if [ $wget_found -eq 1 ]; then
latest_tag=$(wget -q -O- "https://api.github.com/repos/hugsy/gef/tags" | grep "name" | head -1 | sed -e 's/"name": "\([^"]*\)",/\1/' -e 's/ *//')

# Get the hash of the commit
branch="${latest_tag}"
ref=$(wget -q -O- https://api.github.com/repos/hugsy/gef/git/ref/heads/${branch} | grep '"sha"' | tr -s ' ' | cut -d ' ' -f 3 | tr -d "," | tr -d '"')

# Download the file
wget -q "https://github.com/hugsy/gef/raw/${branch}/gef.py" -O "${HOME}/.gef-${ref}.py"
elif [ $curl_found -eq 1 ]; then
latest_tag=$(curl -s "https://api.github.com/repos/hugsy/gef/tags" | grep "name" | head -1 | sed -e 's/"name": "\([^"]*\)",/\1/' -e 's/ *//')

# Get the hash of the commit
branch="${latest_tag}"
ref=$(curl --silent https://api.github.com/repos/hugsy/gef/git/ref/heads/${branch} | grep '"sha"' | tr -s ' ' | cut -d ' ' -f 3 | tr -d "," | tr -d '"')

# Download the file
Expand Down

0 comments on commit 0f6255e

Please sign in to comment.