balto_upload.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # Overview:
  3. #
  4. # A script to upload binaries to baltorepo.com.
  5. #
  6. # Usage:
  7. #
  8. # bash ./balto_upload.sh <package>
  9. #
  10. # A token is needed to upload. Set as follows:
  11. # export BALTO_TOKEN=<your token here>
  12. #
  13. # Directory structure:
  14. #
  15. # release/armv7l/*.tar.xz binary tarball for armv7l
  16. # release/i686/*.tar.xz binary tarball for i686
  17. # release/x86_64/*.tar.xz binary tarball for x86_64
  18. #
  19. # Author: Ed Reel (uberhacker) edreel at gmail dot com
  20. # Contact me if you would like access to the repository.
  21. #
  22. # Updated: 2021-04-14
  23. #
  24. # License: GPL-3+
  25. [ -z "$1" ] && echo "Usage: $(basename $0) <package>" && exit 1
  26. [ ! -f ../packages/$1.rb ] && echo "Package $1.rb not found." && exit 1
  27. for ARCH in armv7l i686 x86_64; do
  28. NAME=$1
  29. [[ "${NAME}" =~ "_" ]] && NAME=$(echo ${NAME}|sed -e 's/_//g')
  30. PACKAGE=../packages/$1.rb
  31. FILE="../release/${ARCH}/${1}-*${ARCH}.tar.xz"
  32. DOWNLOAD=$(ls ${FILE} 2> /dev/null | sed 's,../release/${ARCH}/,,')
  33. if [ -n "${DOWNLOAD}" ]; then
  34. NONAME=${DOWNLOAD#*-}
  35. VERSION=${NONAME%-chromeos*}
  36. RAWDESC=$(grep "^ description" ${PACKAGE})
  37. DESCRIPTION=$(echo ${RAWDESC}|sed -e 's/^description //'|sed -e 's/"//g'|sed -e "s/'//g"|cut -c -200)
  38. #echo "NAME=$NAME"
  39. #echo "VARIANT=$ARCH"
  40. #echo "VERSION=$VERSION"
  41. #echo "DOWNLOAD=$DOWNLOAD"
  42. #echo "DESCRIPTION=$DESCRIPTION"
  43. #exit
  44. curl \
  45. --header "Authorization: Bearer ${BALTO_TOKEN}" \
  46. --form "download=@${DOWNLOAD}" \
  47. --form "name=${NAME}" \
  48. --form "variant=${ARCH}" \
  49. --form "version=${VERSION}" \
  50. --form "description=${DESCRIPTION}" \
  51. https://chromebrew.baltorepo.com/chromebrew/chromebrew/upload/
  52. fi
  53. done