fix usage/help/man bugs

- the definition of $PROGRAM as used in $USAGE strings defined in each
   script has been broken for a long time, being simply "lb" when it needs
   to be "lb COMMAND".
 - `config` changed $PROGRAM to "lb config" thus its output was correct in
   this regard unlike everything else, but with the switch to a more
   "intelligent" `Man()` function recently, it means that instead of
   `man lb config`, what was actually run was `man lb config config`,
   which displayed the manpage, then on exiting with `q`, it showed some
   sort of index line todo with a "config" search (no exact manpage
   match?), for which you had to enter `ctrl+c` to get rid of.

this revises things to fix the issues, minimising change by changing
$PROGRAM to "lb COMMAND", with the frontend overriding this.

Gbp-Dch: Ignore
This commit is contained in:
Lyndon Brown 2020-05-03 01:25:55 +01:00
parent 96c7977732
commit 7276d0213f
5 changed files with 6 additions and 15 deletions

View File

@ -15,6 +15,7 @@ set -e
[ -n "${LIVE_BUILD}" ] && [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh [ -n "${LIVE_BUILD}" ] && [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
# Setting static variables # Setting static variables
PROGRAM="${FRONTEND}"
DESCRIPTION="Utility to build live systems" DESCRIPTION="Utility to build live systems"
HELP="" HELP=""
USAGE="lb {clean|config|build}" USAGE="lb {clean|config|build}"

View File

@ -16,7 +16,7 @@ Arguments ()
local ARGUMENTS local ARGUMENTS
local ERR=0 local ERR=0
ARGUMENTS="$(getopt --shell sh --name ${PROGRAM} --longoptions $LONGOPTS --options $SHORTOPTS -- "${@}")" || ERR=$? ARGUMENTS="$(getopt --shell sh --name "${PROGRAM}" --longoptions $LONGOPTS --options $SHORTOPTS -- "${@}")" || ERR=$?
if [ $ERR -eq 1 ]; then if [ $ERR -eq 1 ]; then
Echo_error "invalid argument(s)" Echo_error "invalid argument(s)"

View File

@ -10,7 +10,8 @@
PROGRAM_NAME="live-build" PROGRAM_NAME="live-build"
PROGRAM="lb" FRONTEND="lb"
PROGRAM="${FRONTEND} $(basename "${0}")"
VERSION="$(if [ -e ${LIVE_BUILD}/debian/changelog ]; then sed -e 's/.*(\(.*\)).*/\1/; s/^[0-9]://; q' ${LIVE_BUILD}/debian/changelog; else cat /usr/share/live/build/VERSION; fi)" VERSION="$(if [ -e ${LIVE_BUILD}/debian/changelog ]; then sed -e 's/.*(\(.*\)).*/\1/; s/^[0-9]://; q' ${LIVE_BUILD}/debian/changelog; else cat /usr/share/live/build/VERSION; fi)"
LIVE_BUILD_VERSION="${VERSION}" LIVE_BUILD_VERSION="${VERSION}"

View File

@ -11,18 +11,8 @@
Man () Man ()
{ {
local BASENAME if command -v man >/dev/null; then
BASENAME=$(basename ${0})
if command -v man >/dev/null
then
case $BASENAME in
$PROGRAM)
man ${PROGRAM} man ${PROGRAM}
;;
*)
man ${PROGRAM} $(basename ${0})
;;
esac
else else
Echo_warning "man is not installed, falling back to usage output." Echo_warning "man is not installed, falling back to usage output."
Usage Usage

View File

@ -15,7 +15,6 @@ set -e
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
# Setting static variables # Setting static variables
PROGRAM="lb config"
DESCRIPTION="Create configuration for live-build(7)" DESCRIPTION="Create configuration for live-build(7)"
USAGE="${PROGRAM} [--apt apt|apt-get|aptitude]\n\ USAGE="${PROGRAM} [--apt apt|apt-get|aptitude]\n\
\t [--apt-ftp-proxy URL]\n\ \t [--apt-ftp-proxy URL]\n\