v-update-sys-vesta 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. # info: update vesta package/configs
  3. # options: PACKAGE [VERSION]
  4. #
  5. # The function runs as rpm update trigger. It pulls shell script from vesta
  6. # server and runs it.
  7. #----------------------------------------------------------#
  8. # Variable&Function #
  9. #----------------------------------------------------------#
  10. # Argument defenition
  11. package=$1
  12. version=$2
  13. release=$3
  14. # Importing system enviroment
  15. source /etc/profile
  16. # Includes
  17. source $VESTA/conf/vesta.conf
  18. source $VESTA/func/main.sh
  19. #----------------------------------------------------------#
  20. # Verifications #
  21. #----------------------------------------------------------#
  22. # Checking arg number
  23. check_args '1' "$#" 'PACKAGE [VERSION] [RELEASE]'
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Clean yum chache
  28. yum -q clean all
  29. # Define yum cmd
  30. yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta"
  31. # Update vesta package
  32. if [ -z "$version" ]; then
  33. $yum update $package > /dev/null 2>&1
  34. if [ $? -ne 0 ]; then
  35. echo "Error: $package update failed"
  36. log_event "$E_UPDATE" "$EVENT"
  37. exit $E_UPDATE
  38. fi
  39. fi
  40. #----------------------------------------------------------#
  41. # Vesta #
  42. #----------------------------------------------------------#
  43. # Logging
  44. log_event "$OK" "$EVENT"
  45. exit