File: update_uc_ref.sh

package info (click to toggle)
aflplusplus 4.21c-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,496 kB
  • sloc: ansic: 110,361; cpp: 16,725; sh: 4,855; python: 3,793; makefile: 963; javascript: 515; java: 43; sql: 3; xml: 1
file content (46 lines) | stat: -rwxr-xr-x 1,157 bytes parent folder | download | duplicates (2)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#/bin/sh

##################################################
# AFL++ internal tool to update unicornafl ref.
# Usage: ./update_uc_ref.sh <new commit hash>
# If no commit hash was provided, it'll take HEAD.
##################################################

UC_VERSION_FILE='./UNICORNAFL_VERSION'

NEW_VERSION="$1"

if [ "$NEW_VERSION" = "-h" ]; then
  echo "Internal script to update bound unicornafl version."
  echo
  echo "Usage: ./update_uc_ref.sh <new commit hash>"
  echo "If no commit hash is provided, will use HEAD."
  echo "-h to show this help screen."
  exit 1
fi

git submodule init && git submodule update unicornafl || exit 1
cd ./unicornafl || exit 1
git fetch origin uc1 1>/dev/null || exit 1
git stash 1>/dev/null 2>/dev/null
git stash drop 1>/dev/null 2>/dev/null
git checkout main

if [ -z "$NEW_VERSION" ]; then
  # No version provided, take HEAD.
  NEW_VERSION=$(git rev-parse --short HEAD)
fi

if [ -z "$NEW_VERSION" ]; then
  echo "Error getting version."
  exit 1
fi

git checkout "$NEW_VERSION" || exit 1

cd ..

rm "$UC_VERSION_FILE"
echo "$NEW_VERSION" > "$UC_VERSION_FILE"

echo "Done. New unicornafl version is $NEW_VERSION."