Skip to content

Commit 7276d02

Browse files
committed
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
1 parent 96c7977 commit 7276d02

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

frontend/lb

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set -e
1515
[ -n "${LIVE_BUILD}" ] && [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
1616

1717
# Setting static variables
18+
PROGRAM="${FRONTEND}"
1819
DESCRIPTION="Utility to build live systems"
1920
HELP=""
2021
USAGE="lb {clean|config|build}"

functions/arguments.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Arguments ()
1616

1717
local ARGUMENTS
1818
local ERR=0
19-
ARGUMENTS="$(getopt --shell sh --name ${PROGRAM} --longoptions $LONGOPTS --options $SHORTOPTS -- "${@}")" || ERR=$?
19+
ARGUMENTS="$(getopt --shell sh --name "${PROGRAM}" --longoptions $LONGOPTS --options $SHORTOPTS -- "${@}")" || ERR=$?
2020

2121
if [ $ERR -eq 1 ]; then
2222
Echo_error "invalid argument(s)"

functions/common.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111

1212
PROGRAM_NAME="live-build"
13-
PROGRAM="lb"
13+
FRONTEND="lb"
14+
PROGRAM="${FRONTEND} $(basename "${0}")"
1415
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)"
1516

1617
LIVE_BUILD_VERSION="${VERSION}"

functions/man.sh

+2-12
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,8 @@
1111

1212
Man ()
1313
{
14-
local BASENAME
15-
BASENAME=$(basename ${0})
16-
if command -v man >/dev/null
17-
then
18-
case $BASENAME in
19-
$PROGRAM)
20-
man ${PROGRAM}
21-
;;
22-
*)
23-
man ${PROGRAM} $(basename ${0})
24-
;;
25-
esac
14+
if command -v man >/dev/null; then
15+
man ${PROGRAM}
2616
else
2717
Echo_warning "man is not installed, falling back to usage output."
2818
Usage

scripts/build/config

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ set -e
1515
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
1616

1717
# Setting static variables
18-
PROGRAM="lb config"
1918
DESCRIPTION="Create configuration for live-build(7)"
2019
USAGE="${PROGRAM} [--apt apt|apt-get|aptitude]\n\
2120
\t [--apt-ftp-proxy URL]\n\

0 commit comments

Comments
 (0)