#!/usr/bin/bash VERSION=$(grep Version ../SPECS/*.spec | cut -d: -f2 | sed -e 's|^[[:space:]]*||') NAME=$(grep Name ../SPECS/*.spec | cut -d: -f2 | sed -e 's|^[[:space:]]*||') DATE=$(grep "define date" ../SPECS/*.spec | awk '{print $3}') #DATE="20190118" if [ ! $(which cargo-vendor) ]; then echo echo "cargo-vendor not found!" echo "You need to install the cargo-vendor package before running this script." exit fi if [ -a ${NAME}-cargo-vendor-${DATE}.tar.xz ]; then echo "${NAME}-cargo-vendor-${DATE}.tar.xz exists. Do you want to replace it? [Y/n]" read answer if [[ ${answer} == "" || ${answer} == "Y" || ${answer} == "y" ]]; then echo "Deleting ${NAME}-cargo-vendor-${DATE}.tar.xz" rm -f ${NAME}-cargo-vendor-${DATE}.tar.xz else echo "OK. Exiting" exit fi fi tar xfz ${NAME}-${VERSION}-${DATE}.tar.gz cd ${NAME}-master echo "Running cargo vendor for ${NAME}" cargo vendor --frozen 3>&1 1> ../cargo-vendor.log 2>&1 tar cf ../${NAME}-cargo-vendor-${DATE}.tar vendor cd .. echo "Compressing the ${NAME}-${VERSION}-${DATE} vendor archive" xz -e9 ${NAME}-cargo-vendor-${DATE}.tar rm -rf ${NAME}-master echo "Done"