reGen2 Linux Release Metatool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.2 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. #!/bin/bash
  2. # Copyright 2010-2012, Asio Software Technologies
  3. # Distributed under the terms of the GNU General Public License v3
  4. # Declare basic system variables
  5. EZNAME=$(basename ${0})
  6. EZROOT=$(dirname $(readlink -ne ${0}))
  7. # Load necessary files
  8. source /etc/profile
  9. source ${EZROOT}/libraries/common
  10. # Load EzBuild libraries & configuration
  11. loadLibraries
  12. loadConfiguration
  13. # Print EzBuild notice and parse arguments
  14. printNotice
  15. until [[ -z "${1}" ]]; do
  16. case "${1}" in
  17. -c|--cleanlog)
  18. EZOPT_CLEANLOG=true
  19. ;;
  20. -h|--help)
  21. showEzsyncUsage
  22. ;;
  23. -n|--nosync)
  24. shift
  25. if [ -z ${1} ]; then
  26. die "--nosync requires an additional argument!"
  27. else
  28. EZNOSYNC=${EZNOSYNC+"$EZNOSYNC "}"${1}"
  29. fi
  30. ;;
  31. -p|--purge)
  32. EZOPT_PURGETMP=true
  33. ;;
  34. -P|--purgeonly)
  35. EZOPT_PURGETMP=true
  36. EZOPT_PURGEONLY=true
  37. ;;
  38. -s|--syscheck)
  39. EZOPT_SYSCHECKONLY=true
  40. ;;
  41. *)
  42. die "Unrecognized option ${1}"
  43. ;;
  44. esac
  45. shift
  46. done
  47. # Check system requirements
  48. printInfo "Checking system prerequisites..."
  49. checkPrerequisites
  50. [ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements!" 1
  51. if isEnabled ${EZOPT_SYSCHECKONLY}; then
  52. printInfo "Your system meets all EzBuild requirements!"
  53. quit
  54. fi
  55. # Do not allow more than one working copy
  56. PID=$(pidof -s -o '%PPID' -x ${EZNAME})
  57. if [ ${PID} ]; then
  58. printWarn "The ${EZNAME} is already working with PID: ${PID}"
  59. printWarn "You cannot have more than one instancy running"
  60. exit 0
  61. fi
  62. # Optionally purge whole temp directory or log file only
  63. if isEnabled ${EZOPT_PURGETMP}; then
  64. printInfo "Clearing temp directory..."
  65. cleanTemp
  66. if isEnabled ${EZOPT_PURGEONLY}; then
  67. quit
  68. fi
  69. elif isEnabled ${EZOPT_CLEANLOG}; then
  70. printInfo "Clearing log file..."
  71. cleanLog
  72. fi
  73. # Initialize EzBuild environment
  74. makeCoreDirectories || die "EzBuild was unable to create all necessary directories!" 1
  75. EZNOTIFY="yes"
  76. makeSshWrapper || die "EzBuild was unable to create a wrapper file to SSH" 1
  77. trap 'die "Process killed! This may lead into unexpected problems!"' 1 2 3 9 15 17 18 23
  78. # Load necessary public keys
  79. printInfo "Loading public keys..."
  80. eval `keychain --noask --eval id_dsa id_rsa &> /dev/null`
  81. [ ${?} -ne 0 ] && die "EzBuild was unable to load public keys!" 1