2024-03-14 16:57:00 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
|
|
|
|
if [ -z ${1+x} ]; then
|
|
|
|
VERSION="0.0.0"
|
|
|
|
else
|
|
|
|
VERSION="$1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$SCRIPT_DIR/dist"
|
2024-03-17 20:49:49 -06:00
|
|
|
rm "$SCRIPT_DIR"/dist/crazyfs-* &> /dev/null
|
2024-03-14 16:57:00 -06:00
|
|
|
|
2024-03-17 20:42:07 -06:00
|
|
|
BUILDARGS="$(uname)-$(uname -p)"
|
2024-03-17 20:46:33 -06:00
|
|
|
OUTPUTFILE="$SCRIPT_DIR/dist/crazyfs-$VERSION-$BUILDARGS"
|
2024-03-17 20:42:07 -06:00
|
|
|
|
2024-03-14 16:57:00 -06:00
|
|
|
cd "$SCRIPT_DIR/src" || exit 1
|
2024-03-17 09:58:20 -06:00
|
|
|
go mod tidy
|
2024-03-17 20:42:07 -06:00
|
|
|
go build -v -trimpath -ldflags "-s -w -X main.VersionDate=$(date -u --iso-8601=minutes) -X main.Version=v$VERSION" -o "$OUTPUTFILE"
|
2024-03-14 16:57:00 -06:00
|
|
|
|
2024-03-15 19:29:00 -06:00
|
|
|
if [ $? -eq 0 ]; then
|
2024-03-17 20:42:07 -06:00
|
|
|
chmod +x "$OUTPUTFILE"
|
|
|
|
echo "Build Succeeded -> $OUTPUTFILE"
|
2024-03-17 09:58:20 -06:00
|
|
|
fi
|