v-update-sys-vesta 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 definition
  11. package=$1
  12. # Importing system environment
  13. source /etc/profile
  14. # Includes
  15. source $VESTA/func/main.sh
  16. source $VESTA/conf/vesta.conf
  17. #----------------------------------------------------------#
  18. # Verifications #
  19. #----------------------------------------------------------#
  20. # Checking arg number
  21. check_args '1' "$#" 'PACKAGE'
  22. #----------------------------------------------------------#
  23. # Action #
  24. #----------------------------------------------------------#
  25. if [ -e "/etc/redhat-release" ]; then
  26. # Clean yum chache
  27. yum -q clean all
  28. # Define yum cmd
  29. yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta"
  30. # Update vesta package
  31. $yum update $package > /dev/null 2>&1
  32. check_result $? "$package update failed" $E_UPDATE
  33. else
  34. # Update repo
  35. apt-get update -o Dir::Etc::sourcelist="sources.list.d/vesta.list" \
  36. -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -qq
  37. # Update vesta package
  38. apt-get install $package -qq > /dev/null 2>&1
  39. check_result $? "$package update failed" $E_UPDATE
  40. fi
  41. #----------------------------------------------------------#
  42. # Vesta #
  43. #----------------------------------------------------------#
  44. # Logging
  45. log_event "$OK" "$ARGUMENTS"
  46. exit