libreboot

my branch of libreboot
git clone git://git.hazbo.co.uk/libreboot.git
Log | Files | Refs | README

boot-keys-helper (1513B)


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