init.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. project_name="Lynar Studios - Standard Library"
  3. script_directory="$PWD"
  4. root_directory=$(dirname $(dirname $script_directory))
  5. test_directory="$root_directory/test"
  6. test_resources_directory="$test_directory/resources"
  7. test_file_name="no-writable.txt"
  8. test_file_path="$test_resources_directory/$test_file_name"
  9. indentation=" -->"
  10. error_level="[ERROR]"
  11. ########################################
  12. # script execution
  13. ########################################
  14. echo "Setting up project '$project_name' for development on Linux environment ...
  15. "
  16. # check if rights are sufficient
  17. echo "$indentation checking rights ..."
  18. if ! sudo -v; then
  19. echo "$indentation $error_level no sufficient rights, must be executed as sudo-user ..."
  20. else
  21. echo "$indentation user is sudo ..."
  22. fi
  23. # list variables
  24. echo "$indentation script directory identified as '$script_directory' ..."
  25. echo "$indentation root directory identified as '$root_directory' ..."
  26. echo "$indentation test directory identified as '$test_directory' ..."
  27. echo "$indentation test resources directory identified as '$test_resources_directory' ..."
  28. # prepare test files
  29. if sudo -v; then
  30. echo "$indentation changing permissions for '$test_file_path' file ..."
  31. chmod -w "$test_file_path"
  32. fi