mirror of
https://github.com/pwndbg/linux-exploit-dev-env.git
synced 2026-11-13 18:59:53 -10:00
29 lines
574 B
Bash
Executable File
29 lines
574 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -o errexit
|
|
|
|
VERSION="$1"
|
|
LINUX_SRC="${2:-linux}"
|
|
|
|
if [ -z "$VERSION" ]; then
|
|
echo "usage: $0 VERSION"
|
|
exit 1
|
|
fi
|
|
|
|
function check_version_and_checkout {
|
|
local REF="$1"
|
|
if git -C "$LINUX_SRC" show-ref "$REF" > /dev/null; then
|
|
git -C "$LINUX_SRC" checkout $REF
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
check_version_and_checkout "$VERSION" && exit 0
|
|
check_version_and_checkout "v$VERSION" && exit 0
|
|
check_version_and_checkout "linux-$VERSION" && exit 0
|
|
|
|
echo "No tag or branch corresponding to version $VERSION found"
|
|
exit 1
|