| #!/bin/bash |
| # Clone from github and get the version. |
| REPO=NNT-Linux-driver |
| SRC_URI=https://github.com/Mellanox/${REPO}.git |
| if ! git clone "${SRC_URI}"; then |
| echo Failed to clone ${SRC_URI} |
| exit 1 |
| fi |
| VERSION="$(cd ${REPO}; git rev-parse HEAD)" |
| echo Using ${VERSION} |
| |
| # Check to see if mirrors already has the version. |
| SRCTAR="Mellanox-${REPO}-${VERSION}.tar.xz" |
| if gsutil ls gs://chromeos-localmirror/distfiles/${SRCTAR}; then |
| echo ${SRCTAR} already exists in localmirror |
| exit 0 |
| fi |
| |
| # Generate a tar of the source and upload. |
| if ! tar --exclude "${REPO}/.git" -cJf ${SRCTAR} ${REPO}; then |
| echo Failed to generate tar |
| exit 2 |
| fi |
| if ! gsutil cp ${SRCTAR} gs://chromeos-localmirror/distfiles/; then |
| echo Failed to copy to localmirror |
| exit 3 |
| fi |