v_change_sys_user_package 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. # info: changing user package
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. package="$2"
  9. # Importing variables
  10. source $VESTA/conf/vars.conf
  11. source $V_FUNC/shared_func.sh
  12. #----------------------------------------------------------#
  13. # Verifications #
  14. #----------------------------------------------------------#
  15. # Checking arg number
  16. check_args '2' "$#" 'user package'
  17. # Checking argument format
  18. format_validation 'user' 'package'
  19. # Checking user
  20. is_user_valid
  21. # Checking user is active
  22. is_user_suspended
  23. # Checking package
  24. is_package_valid
  25. # Checking current data
  26. is_package_avalable
  27. #----------------------------------------------------------#
  28. # Action #
  29. #----------------------------------------------------------#
  30. # Get old package value
  31. old_package=$(get_user_value '$PACKAGE')
  32. # Changing user package
  33. change_user_package
  34. #----------------------------------------------------------#
  35. # Vesta #
  36. #----------------------------------------------------------#
  37. # Logging
  38. log_event 'system' "$V_EVENT"
  39. exit $OK