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.

90 lines
2.0 KiB

  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. -D|--tarballdate)
  21. shift
  22. if [ -z ${1} ]; then
  23. die "--tarballdate requires an additional argument!"
  24. else
  25. TARBALLDATE="${1}"
  26. fi
  27. ;;
  28. -h|--help)
  29. showEzbuildUsage
  30. ;;
  31. -l|--listmods)
  32. listModules
  33. ;;
  34. -p|--purge)
  35. EZOPT_PURGETMP=true
  36. ;;
  37. -P|--purgeonly)
  38. EZOPT_PURGETMP=true
  39. EZOPT_PURGEONLY=true
  40. ;;
  41. -s|--syscheck)
  42. EZOPT_SYSCHECKONLY=true
  43. ;;
  44. *)
  45. die "Unrecognized option ${1}"
  46. ;;
  47. esac
  48. shift
  49. done
  50. # Check system requirements
  51. printInfo "Checking system prerequisites..."
  52. checkPrerequisites
  53. [ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements!" 1
  54. if isEnabled ${EZOPT_SYSCHECKONLY}; then
  55. printInfo "Your system meets all EzBuild requirements!"
  56. quit
  57. fi
  58. # Do not allow more than one working copy
  59. PID=$(pidof -s -o '%PPID' -x ${EZNAME})
  60. if [ ${PID} ]; then
  61. printWarn "The ${EZNAME} is already working with PID: ${PID}"
  62. printWarn "You cannot have more than one instancy running"
  63. exit 0
  64. fi
  65. # Optionally purge whole temp directory or log file only
  66. if isEnabled ${EZOPT_PURGETMP}; then
  67. printInfo "Clearing temp directory..."
  68. cleanTemp
  69. if isEnabled ${EZOPT_PURGEONLY}; then
  70. quit
  71. fi
  72. elif isEnabled ${EZOPT_CLEANLOG}; then
  73. printInfo "Clearing log file..."
  74. cleanLog
  75. fi
  76. # Initialize EzBuild environment
  77. makeCoreDirectories || die "EzBuild was unable to create all necessary directories!" 1
  78. EZNOTIFY="yes"
  79. export LC_ALL="C"
  80. trap 'die "Process killed! This may lead into unexpected problems!"' 1 2 3 9 15 17 18 23