boot-keys-helper 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. KERNEL="kernel"
  3. TYPE="type"
  4. ROM="rom"
  5. IMG="img"
  6. boot_keys_cros() {
  7. local cros_script=$1
  8. shift
  9. local vboot_tools_path=$( project_install_path "vboot" "tools" )
  10. local cros_scripts_path=$( project_install_path "cros-scripts" )
  11. local cros_script_path="$cros_scripts_path/$cros_script"
  12. if ! [ -x "$cros_script_path" ]
  13. then
  14. printf "$cros_script script missing from cros-scripts install" >&2
  15. return 1
  16. fi
  17. VBOOT_KEYS_PATH=$VBOOT_KEYS_PATH VBOOT_TOOLS_PATH=$vboot_tools_path $cros_script_path "$@"
  18. }
  19. boot_keys_type() {
  20. tool_file_contents "$tool" "$CONFIGS" "$TYPE" "$@"
  21. }
  22. boot_keys_files_install_path() {
  23. local project=$1
  24. shift
  25. local helper_arguments
  26. local argument
  27. local ifs_save
  28. helper_arguments=$( project_action_helper "arguments" "$project" "$@" )
  29. if [ $? -ne 0 ] || [ -z "$helper_arguments" ]
  30. then
  31. project_install_path "$project" "$@"
  32. else
  33. # This it to allow space characters in arguments.
  34. ifs_save=$IFS
  35. IFS=$'\n'
  36. for argument in $( echo "$helper_arguments" )
  37. do
  38. (
  39. IFS=$ifs_save
  40. # Only a single argument at a time is returned by the helper.
  41. boot_keys_files_install_path "$project" "$@" "$argument"
  42. )
  43. done
  44. IFS=$ifs_save
  45. fi
  46. }
  47. boot_keys_files() {
  48. local project=$1
  49. shift
  50. local cros_scripts_path=$( project_install_path "cros-scripts" )
  51. local cros_boot_keys="$cros_scripts_path/cros-boot-keys"
  52. project_action_arguments_verify_recursive "install" "$project" "$@"
  53. boot_keys_files_install_path "$project" "$@"
  54. }