From 88f81527977bd3edb917ed98c39138de8e64875c Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Wed, 20 Sep 2017 22:57:14 -0400 Subject: Remove braces from parameter expansions * projects/grub/grub * projects/grub/grub-helper ditto --- projects/grub/grub | 72 ++++++++++----------- projects/grub/grub-helper | 156 +++++++++++++++++++++++----------------------- 2 files changed, 114 insertions(+), 114 deletions(-) (limited to 'projects/grub') diff --git a/projects/grub/grub b/projects/grub/grub index c444841b..4962da4f 100755 --- a/projects/grub/grub +++ b/projects/grub/grub @@ -16,108 +16,108 @@ # along with this program. If not, see . arguments() { - project_arguments_targets "${project}" "$@" + project_arguments_targets "$project" "$@" } usage() { - project_usage_actions "${project}" - project_usage_arguments "${project}" "$@" + project_usage_actions "$project" + project_usage_arguments "$project" "$@" } download() { - local repository="${project}" + local repository="$project" - project_download_git "${project}" "${repository}" 'https://git.savannah.gnu.org/r/grub.git' "$@" + project_download_git "$project" "$repository" 'https://git.savannah.gnu.org/r/grub.git' "$@" } download_check() { - local repository="${project}" + local repository="$project" - project_download_check_git "${project}" "${repository}" "$@" + project_download_check_git "$project" "$repository" "$@" } extract() { - project_extract "${project}" "$@" + project_extract "$project" "$@" } extract_check() { - project_extract_check "${project}" "$@" + project_extract_check "$project" "$@" } update() { - local repository="${project}" + local repository="$project" - project_update_git "${project}" "${repository}" "$@" + project_update_git "$project" "$repository" "$@" } update_check() { - local repository="${project}" + local repository="$project" - project_update_check_git "${project}" "${repository}" "$@" + project_update_check_git "$project" "$repository" "$@" } build() { local target="$1" - local repository="${project}" + local repository="$project" - project_sources_directory_missing_empty_error "${project}" "${repository}" "$@" + project_sources_directory_missing_empty_error "$project" "$repository" "$@" - if git_project_check "${repository}"; then - git_project_checkout "${project}" "${repository}" "$@" + if git_project_check "$repository"; then + git_project_checkout "$project" "$repository" "$@" fi - local project_path="$(project_path "${project}")" - local sources_path="$(project_sources_path "${project}" "${repository}" "$@")" - local build_path="$(project_build_path "${project}" "$@")" - local raw_keymap_path="${project_path}/${CONFIGS}/keymaps" + local project_path="$(project_path "$project")" + local sources_path="$(project_sources_path "$project" "$repository" "$@")" + local build_path="$(project_build_path "$project" "$@")" + local raw_keymap_path="$project_path/$CONFIGS/keymaps" - mkdir -p "${build_path}" + mkdir -p "$build_path" grub_build_utils - if [[ "${target}" == 'bios' ]]; then + if [[ "$target" == 'bios' ]]; then grub_build_floppy_image else grub_build_standalone_image fi - for raw_keymap in "${raw_keymap_path}"/*; do - grub_build_layout "${raw_keymap}" + for raw_keymap in "$raw_keymap_path"/*; do + grub_build_layout "$raw_keymap" done grub_build_font grub_copy_modules - make -C "${sources_path}" distclean + make -C "$sources_path" distclean } build_check() { - project_build_check "${project}" "$@" + project_build_check "$project" "$@" } install() { - project_install "${project}" "$@" + project_install "$project" "$@" } install_check() { - project_install_check "${project}" "$@" + project_install_check "$project" "$@" } release() { - local repository="${project}" + local repository="$project" - project_release_install_archive "${project}" "${IMAGES}" "$@" - project_release_sources_git "${project}" "${repository}" "$@" + project_release_install_archive "$project" "$IMAGES" "$@" + project_release_sources_git "$project" "$repository" "$@" } release_check() { - local repository="${project}" + local repository="$project" - project_release_install_archive_check "${project}" "${IMAGES}" "$@" - project_release_check_sources_git "${project}" "${repository}" "$@" + project_release_install_archive_check "$project" "$IMAGES" "$@" + project_release_check_sources_git "$project" "$repository" "$@" } clean() { - project_clean "${project}" "$@" + project_clean "$project" "$@" } diff --git a/projects/grub/grub-helper b/projects/grub/grub-helper index 604d4a54..dd069290 100755 --- a/projects/grub/grub-helper +++ b/projects/grub/grub-helper @@ -27,130 +27,130 @@ PREFIX='prefix' SIZE='size' grub_arch() { - project_file_contents "${project}" "${CONFIGS}" "${ARCH}" "$@" + project_file_contents "$project" "$CONFIGS" "$ARCH" "$@" } grub_font_file() { - project_file_contents "${project}" "${CONFIGS}" "${FONT_FILE}" "$@" + project_file_contents "$project" "$CONFIGS" "$FONT_FILE" "$@" } grub_font_project() { - project_file_contents "${project}" "${CONFIGS}" "${FONT_PROJECT}" "$@" + project_file_contents "$project" "$CONFIGS" "$FONT_PROJECT" "$@" } grub_format() { - project_file_contents "${project}" "${CONFIGS}" "${FORMAT}" "$@" + project_file_contents "$project" "$CONFIGS" "$FORMAT" "$@" } grub_platform() { - project_file_contents "${project}" "${CONFIGS}" "${PLATFORM}" "$@" + project_file_contents "$project" "$CONFIGS" "$PLATFORM" "$@" } grub_prefix() { - project_file_contents "${project}" "${CONFIGS}" "${PREFIX}" "$@" + project_file_contents "$project" "$CONFIGS" "$PREFIX" "$@" } grub_size() { - project_file_contents "${project}" "${CONFIGS}" "${SIZE}" "$@" + project_file_contents "$project" "$CONFIGS" "$SIZE" "$@" } grub_config_path() { - project_file_path "${project}" "${CONFIGS}" "${CONFIG}" "$@" + project_file_path "$project" "$CONFIGS" "$CONFIG" "$@" } grub_modmin_path() { - project_file_path "${project}" "${CONFIGS}" "${MODMIN}" "$@" + project_file_path "$project" "$CONFIGS" "$MODMIN" "$@" } grub_copy_modules() { - local grub_module_dir="${sources_path}/grub-core" - local keep_dir="${build_path}/$(grub_format "${target}" "$@")" + local grub_module_dir="$sources_path/grub-core" + local keep_dir="$build_path/$(grub_format "$target" "$@")" - mkdir -p "${keep_dir}" + mkdir -p "$keep_dir" - cp -a "${grub_module_dir}"/*.@(mod|lst) "${keep_dir}" + cp -a "$grub_module_dir"/*.@(mod|lst) "$keep_dir" } grub_build_font() { # Font project-specific filenames and paths - local font_file="$(grub_font_file "${FONTS}" "$@")" - local font_project="$(grub_font_project "${FONTS}" "$@")" - local font_build_dir="${root}/${BUILD}/${font_project}" + local font_file="$(grub_font_file "$FONTS" "$@")" + local font_project="$(grub_font_project "$FONTS" "$@")" + local font_build_dir="$root/$BUILD/$font_project" - local grub_mkfont="${sources_path}/grub-mkfont" + local grub_mkfont="$sources_path/grub-mkfont" # GRUB font directory for outputting the built PF2 file - mkdir -p "${build_path}/${FONTS}" + mkdir -p "$build_path/$FONTS" - "${grub_mkfont}" --output="${build_path}/${FONTS}/${font_file%.*}.pf2" \ - "${font_build_dir}/${font_file}" + "$grub_mkfont" --output="$build_path/$FONTS/${font_file%.*}.pf2" \ + "$font_build_dir/$font_file" } grub_build_utils() { ( # If arch and/or platform files don't exist, # the configure script will pick a reasonable default - local arch="$(grub_arch "${target}" "$@")" - local platform="$(grub_platform "${target}" "$@")" + local arch="$(grub_arch "$target" "$@")" + local platform="$(grub_platform "$target" "$@")" - cd "${sources_path}" || return + cd "$sources_path" || return - if git_project_check "${repository}"; then + if git_project_check "$repository"; then ./autogen.sh fi - ./configure --target="${arch}" --with-platform="${platform}" + ./configure --target="$arch" --with-platform="$platform" - make -j"${TASKS}" + make -j"$TASKS" ) } grub_build_layout() { local raw_layout="${1##*/}" local raw_layout_path="$1" - local keymap_out_path="${build_path}/keymaps" - local grub_mklayout="${sources_path}/grub-mklayout" - local grub_kbd_layout="${keymap_out_path}/${raw_layout}.gkb" + local keymap_out_path="$build_path/keymaps" + local grub_mklayout="$sources_path/grub-mklayout" + local grub_kbd_layout="$keymap_out_path/$raw_layout.gkb" - if ! [[ -e "${keymap_out_path}" ]]; then - mkdir -p "${keymap_out_path}" - elif ! [[ -d "${keymap_out_path}" ]]; then - printf '\n%s\n' "Error: File ${keymap_out_path} is not a directory" 1>&2 + if ! [[ -e "$keymap_out_path" ]]; then + mkdir -p "$keymap_out_path" + elif ! [[ -d "$keymap_out_path" ]]; then + printf '\n%s\n' "Error: File $keymap_out_path is not a directory" 1>&2 return 1 fi - "${grub_mklayout}" --output="${grub_kbd_layout}" --input="${raw_layout_path}" + "$grub_mklayout" --output="$grub_kbd_layout" --input="$raw_layout_path" } grub_build_bootable_image() { - local arch="$(grub_arch "${target}" "$@")" - local format="$(grub_format "${target}" "$@")" - local prefix="$(grub_prefix "${target}" "$@")" - local config_path="$(grub_config_path "${target}" "$@")" - - local grub_mkimage="${sources_path}/grub-mkimage" - local grub_module_dir="${sources_path}/grub-core" - - local grubimg="${build_path}/grub.img" - local grub_bootimg="${grub_module_dir}/boot.img" - local grub_bootable_img="${build_path}/grub2" - - "${grub_mkimage}" \ - --config="${config_path}" \ - --directory="${grub_module_dir}" \ - --output="${grubimg}" \ - --format="${format}" \ - --prefix="${prefix}" \ + local arch="$(grub_arch "$target" "$@")" + local format="$(grub_format "$target" "$@")" + local prefix="$(grub_prefix "$target" "$@")" + local config_path="$(grub_config_path "$target" "$@")" + + local grub_mkimage="$sources_path/grub-mkimage" + local grub_module_dir="$sources_path/grub-core" + + local grubimg="$build_path/grub.img" + local grub_bootimg="$grub_module_dir/boot.img" + local grub_bootable_img="$build_path/grub2" + + "$grub_mkimage" \ + --config="$config_path" \ + --directory="$grub_module_dir" \ + --output="$grubimg" \ + --format="$format" \ + --prefix="$prefix" \ cbfs configfile - cat "${grub_bootimg}" "${grubimg}" > "${grub_bootable_img}" - rm -f "${grubimg}" + cat "$grub_bootimg" "$grubimg" > "$grub_bootable_img" + rm -f "$grubimg" } grub_build_floppy_image() { - local grubimg="${build_path}/grub2" - local tempfile="${build_path}/temp.file" + local grubimg="$build_path/grub2" + local tempfile="$build_path/temp.file" if ! grub_build_bootable_image "$@"; then printf '\n%s\n\n' "Error: Failed to build a GRUB image" 1>&2 @@ -158,27 +158,27 @@ grub_build_floppy_image() { return 1 fi - local size="$(grub_size "${target}" "$@")" + local size="$(grub_size "$target" "$@")" # Pre-allocate a floppy-sized image # SeaBIOS requires floppy images to have a "correct" size - if ! [[ -e "${tempfile}" ]]; then - dd if=/dev/zero of="${tempfile}" bs=1024 count="${size:-160}" + if ! [[ -e "$tempfile" ]]; then + dd if=/dev/zero of="$tempfile" bs=1024 count="${size:-160}" else - printf '\n%s\n\n' "Error: File ${tempfile} already exists!" 1>&2 + printf '\n%s\n\n' "Error: File $tempfile already exists!" 1>&2 return 1 fi - local -i grubimg_size="$(stat -c %s "${grubimg}")" + local -i grubimg_size="$(stat -c %s "$grubimg")" local -i floppy_size="$((${size:-160} * 1024))" # Graft the GRUB image onto the blank floppy image if ((grubimg_size <= floppy_size)); then - dd if="${grubimg}" of="${tempfile}" bs=1 conv=notrunc + dd if="$grubimg" of="$tempfile" bs=1 conv=notrunc - rm -f "${grubimg}" - mv "${tempfile}" "${grubimg}" + rm -f "$grubimg" + mv "$tempfile" "$grubimg" else printf '\n%s' "Error: Image ${grubimg##*/} is too large; " 1>&2 printf '%s\n\n' "it must be less than ${size}KiB in size" 1>&2 @@ -188,25 +188,25 @@ grub_build_floppy_image() { } grub_build_standalone_image() { - local arch="$(grub_arch "${target}" "$@")" - local format="$(grub_format "${target}" "$@")" - local prefix="$(grub_prefix "${target}" "$@")" - local config_path="$(grub_config_path "${target}" "$@")" + local arch="$(grub_arch "$target" "$@")" + local format="$(grub_format "$target" "$@")" + local prefix="$(grub_prefix "$target" "$@")" + local config_path="$(grub_config_path "$target" "$@")" - local grubimg="${build_path}/grub2" + local grubimg="$build_path/grub2" - local grub_mkimage="${sources_path}/grub-mkimage" - local grub_mkstandalone="${sources_path}/grub-mkstandalone" - local grub_module_dir="${sources_path}/grub-core" + local grub_mkimage="$sources_path/grub-mkimage" + local grub_mkstandalone="$sources_path/grub-mkstandalone" + local grub_module_dir="$sources_path/grub-core" - "${grub_mkstandalone}" \ - --grub-mkimage="${grub_mkimage}" \ + "$grub_mkstandalone" \ + --grub-mkimage="$grub_mkimage" \ --fonts='' \ --themes='' \ --locales='' \ --install-modules='cbfs configfile' \ - --directory="${grub_module_dir}" \ - --format="${format}" \ - --output="${grubimg}" \ - /boot/grub/grub.cfg="${config_path}" + --directory="$grub_module_dir" \ + --format="$format" \ + --output="$grubimg" \ + /boot/grub/grub.cfg="$config_path" } -- cgit v1.2.3-70-g09d2