Advertisement
Guest User

copy-script

a guest
Nov 27th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #Config options
  4. export SRC_ROOT=/home/albinoman887/cm-12
  5. export TMP_UPLOAD=/home/albinoman887/tmp
  6. export WEB_ROOT=/var/www/html
  7. export MIRROR_ROOT=albinoman@download.chronic-buildbox.com:/home/albinoman/upload
  8. export MEGA_ROOT=/Root/html
  9.  
  10. #######################################################################################
  11.  
  12. export DEVICE="$1"
  13. export BUILD_TYPE="$2"
  14. export CURDATE=`date "+%m.%d.%Y"`
  15.  
  16.  
  17. function SetupDownloads()
  18. {
  19. cd $SRC_ROOT/out/target/product/$DEVICE/
  20. cp -r cm-12*.zip $TMP_UPLOAD/
  21. cd $TMP_UPLOAD
  22. cp -r cm-12*.zip $WEB_ROOT/$DEVICE/$BUILD_TYPE/
  23. scp cm-12*.zip $MIRROR_ROOT/
  24. ssh -t albinoman@download.chronic-buildbox.com "cd $MIRROR_ROOT ; cp -r cm-12*$DEVICE*.zip $WEB_ROOT/$DEVICE/$BUILD_TYPE/ ; rm -r cm-12*$DEVICE*.zip"
  25. megasync -l $WEB_ROOT/$DEVICE/$BUILD_TYPE -r $MEGA_ROOT/$DEVICE/$BUILD_TYPE
  26. rm -r cm-12*.zip
  27. cd $SRC_ROOT
  28. }
  29.  
  30. #######################################################################################
  31.  
  32. #Set device
  33. if [ "$1" = "" ]; then
  34. clear
  35. echo
  36. echo "No device set via cmdline, enter which device to build: "
  37. echo
  38. read DEVICE
  39. fi
  40.  
  41. #Set build type
  42. if [ "$2" = "" ]; then
  43. clear
  44. echo
  45. echo "No build type set via cmdline, select build type (nightly/release/dev): "
  46. echo
  47. read BUILD_TYPE
  48. fi
  49.  
  50. #print build config
  51. echo
  52. echo "Set DEVICE to: $DEVICE"
  53. echo "Set BUILD TYPE to: $BUILD_TYPE"
  54. echo
  55.  
  56. #Get time
  57. time_start=$(date +%s.%N)
  58.  
  59. # Copy builds
  60. SetupDownloads
  61.  
  62. #Print total build time
  63. time_end=$(date +%s.%N)
  64. echo -e "${BLDYLW}Total time elapsed: ${TCTCLR}${TXTGRN}$(echo "($time_end - $time_start) / 60"|bc ) ${TXTYLW}minutes${TXTGRN} ($(echo "$time_end - $time_start"|bc ) ${TXTYLW}seconds) ${TXTCLR}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement