v_change_sys_user_package 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_CONF/vesta.conf
  12. source $V_FUNC/shared.func
  13. #----------------------------------------------------------#
  14. # Verifications #
  15. #----------------------------------------------------------#
  16. # Checking arg number
  17. check_args '2' "$#" 'user package'
  18. # Checking argument format
  19. format_validation 'user' 'package'
  20. # Checking user
  21. is_user_valid
  22. # Checking user is active
  23. is_user_suspended
  24. # Checking package
  25. is_package_valid
  26. # Checking current data
  27. is_package_avalable
  28. #----------------------------------------------------------#
  29. # Action #
  30. #----------------------------------------------------------#
  31. # Get old package value
  32. old_package=$(get_user_value '$PACKAGE')
  33. # Changing user package
  34. change_user_package
  35. #----------------------------------------------------------#
  36. # Vesta #
  37. #----------------------------------------------------------#
  38. # Logging
  39. log_event 'system' "$V_EVENT"
  40. exit