diff --git a/core/grub/build b/core/grub/build index e64920c1..74a562bc 100755 --- a/core/grub/build +++ b/core/grub/build @@ -36,6 +36,7 @@ build_grub() ( cd "grub-${1##*=}" ./configure \ + HELP2MAN="$OLDPWD/help2man" \ --prefix=/usr \ --sbindir=/usr/bin \ --sysconfdir=/etc \ diff --git a/core/grub/checksums b/core/grub/checksums index b1ead46c..bfd1586c 100644 --- a/core/grub/checksums +++ b/core/grub/checksums @@ -1,3 +1,4 @@ b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1 b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1 93cde7ed22280bf1bf205d1e2c9700c64d8d32bd759569f6e00913ec001389c5 +14188f9abf88c85cabc90a956a761d4ee6f08dd1c742aaf79e679b054655c674 diff --git a/core/grub/files/help2man b/core/grub/files/help2man new file mode 100755 index 00000000..278f5ce9 --- /dev/null +++ b/core/grub/files/help2man @@ -0,0 +1,283 @@ +#!/bin/sh +# +# A POSIX shell help2man implementation. Supports most options but does not +# output identical manuals. Written in a few hours this is still in "alpha" +# status. Please let me know if there are any issues. +# +# Copyright (c) 2019-2021 Dylan Araps +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +args() { + while _arg=$1; do + case $1 in -[a-zA-Z]) shift; esac + + case $_arg in + -n|--name=*) _arg_name=${1##--name=} + : "${_arg_name:?"$_arg requires an argument"}" ;; + + -s|--section=*) _arg_section=${1##--section=} + : "${_arg_section:?"$_arg requires an argument"}" ;; + + -m|--manual=*) _arg_manual=${1##--manual=} + : "${_arg_manual:?"$_arg requires an argument"}" ;; + + -S|--source=*) _arg_source=${1##--source=} + : "${_arg_source:?"$_arg requires an argument"}" ;; + + -i|--include=*|-I|--opt-include=*) _arg_include=${1##--include=} + : "${_arg_include:?"$_arg requires an argument"}" ;; + + -o|--output=*) _arg_output=${1##--output=} + : "${_arg_output:?"$_arg requires an argument"}" ;; + + --version) + cat <. +EOF + exit 0 + ;; + + *) + exe=$1 + break + ;; + esac + + shift + done +} + +fnr() { + # Replace all occurrences of substrings with substrings. This + # function takes pairs of arguments iterating two at a time + # until everything has been replaced. + _fnr=$1 + shift 1 + + while :; do case $_fnr-$# in + *"$1"*) _fnr=${_fnr%"$1"*}${2}${_fnr##*"$1"} ;; + *-2) break ;; + *) shift 2 + esac done +} + +clean() { + _trim=${1#${1%%[![:space:]]*}} + _trim=${_trim%${_trim##*[![:space:]]}} + fnr "$_trim" " " " " " " " " +} + +get_help() { + case $cmd_stderr in + 1) cmd_help=$("$exe" "${_arg_help_option:---help}" 2>&1) ;; + *) cmd_help=$("$exe" "${_arg_help_option:---help}") + esac || : + cmd_help=${cmd_help:?cannot get --help info from "$exe"} +} + +get_version() { + case $cmd_stderr in + 1) cmd_version_raw=${_arg_version_string:-\ + $("$exe" "${_arg_version_option:---version}" 2>&1)} ;; + *) cmd_version_raw=${_arg_version_string:-\ + $("$exe" "${_arg_version_option:---version}")} + esac || : + + read -r cmd_name cmd_version _junk < "${_arg_output:-/dev/stdout}" +.\\" DO NOT MODIFY THIS FILE! It was generated by ${0##*/} 1.48.3. +.TH $cmd_NAME "${_arg_section:-1}" "$cmd_date"\ + "${_arg_source:-$cmd_version_raw}" "${_arg_manual:-User Commands}" +${HELP_NAME:+"$nl$HELP_NAME"}\ +${HELP_SYNOPSIS:+"$nl$HELP_SYNOPSIS"}\ +${HELP_DESCRIPTION:+"$nl$HELP_DESCRIPTION"}\ +${HELP_OPTIONS:+"$nl$HELP_OPTIONS"}\ +${HELP_REPORTING_BUGS:+"$nl$HELP_REPORTING_BUGS"}\ +${HELP_SEE_ALSO:+"$nl$HELP_SEE_ALSO"} +EOF +} + +main "$@" diff --git a/core/grub/sources b/core/grub/sources index 5ebd598f..e0a06a6c 100644 --- a/core/grub/sources +++ b/core/grub/sources @@ -1,3 +1,4 @@ https://ftp.gnu.org/gnu/grub/grub-VERSION.tar.xz grub-pc https://ftp.gnu.org/gnu/grub/grub-VERSION.tar.xz grub-efi files/grub.default +files/help2man