github.com/noironetworks/cilium-net@v1.6.12/contrib/scripts/bindata.sh (about)

     1  #!/bin/bash
     2  
     3  arg1=$1
     4  
     5  BINDATA_FILE=bindata.go
     6  
     7  if [[ "$arg1" == "apply" ]]; then
     8    NEW_SHA1SUM=`sha1sum ${BINDATA_FILE} | awk '{ print $1}'`
     9    GO_VERSION_USED=`go version | awk '{ print $3 }'`
    10    BPF_FILES=`git ls-files ../bpf/ | grep -v .gitignore | tr "\n" ' '`
    11    sed -i "s/GO_BINDATA_SHA1SUM=.*/GO_BINDATA_SHA1SUM=${NEW_SHA1SUM}/g" bpf.sha
    12    sed -i "s/GO_VERSION_USED=.*/GO_VERSION_USED=${GO_VERSION_USED}/g" bpf.sha
    13    sed -i "s#BPF_FILES=.*#BPF_FILES=${BPF_FILES}#g" bpf.sha
    14    exit 0
    15  fi
    16  
    17  GO_BINDATA_SHA1SUM=$arg1
    18  
    19  if [[ $GO_BINDATA_SHA1SUM == "" ]]; then
    20    echo "please provide a sha1sum for the expected bindata."
    21    exit 1
    22  fi
    23  
    24  if echo "$GO_BINDATA_SHA1SUM bindata.go" | sha1sum -c --quiet; then
    25    exit 0
    26  fi
    27  
    28  echo "########################################################################"
    29  echo ""
    30  echo "                  ERROR: bindata.go is out of date."
    31  echo ""
    32  echo " This can happen for two reasons:"
    33  echo " 1. You are using a go-bindata binary compiled with a different version"
    34  echo "    of golang (not 1.9). If so, please up/downgrade."
    35  echo ""
    36  echo " 2. You have made changes to the bpf/ directory. Please run the"
    37  echo "    following command to update the SHA in daemon/bpf.sha:"
    38  echo ""
    39  echo "    $ make -C daemon apply-bindata"
    40  echo ""
    41  echo "########################################################################"
    42  
    43  exit 1