2007-09-23 08:04:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2020-03-11 09:07:21 -01:00
|
|
|
## Copyright (C) 2016-2020 The Debian Live team
|
2015-01-04 18:05:39 -01:00
|
|
|
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
2012-07-29 23:59:00 +00:00
|
|
|
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
2010-09-02 11:12:37 +00:00
|
|
|
## This is free software, and you are welcome to redistribute it
|
|
|
|
## under certain conditions; see COPYING for details.
|
|
|
|
|
|
|
|
|
2020-02-21 21:23:40 -01:00
|
|
|
PROGRAM_NAME="live-build"
|
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
2020-05-03 00:25:55 +00:00
|
|
|
FRONTEND="lb"
|
|
|
|
PROGRAM="${FRONTEND} $(basename "${0}")"
|
2022-02-10 18:40:16 -01:00
|
|
|
VERSION=""
|
|
|
|
# Find the version:
|
|
|
|
# 1) For development versions, the git hash with date
|
|
|
|
# 2) For distributed source code, the version from the changelog
|
|
|
|
# 3) For installed versions, the version from the file VERSION
|
|
|
|
if [ ! -z "${LIVE_BUILD}" -a "$(command -v git)" -a -e ${LIVE_BUILD}/.git ]; then
|
|
|
|
VERSION="$(cd ${LIVE_BUILD}; git log -n 1 --pretty=format:%H_%aI)"
|
|
|
|
# If a local modification is made or there are staged commits, add 'with_local_changes'
|
|
|
|
# See https://stackoverflow.com/questions/2657935/checking-for-a-dirty-index-or-untracked-files-with-git
|
|
|
|
if ! $(cd ${LIVE_BUILD}; git diff-index --quiet HEAD --ignore-submodules --); then
|
|
|
|
VERSION="${VERSION}_with_local_changes"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z "${VERSION}" -a ! -z "${LIVE_BUILD}" -a -e ${LIVE_BUILD}/debian/changelog ]; then
|
|
|
|
# Remove the epoch
|
|
|
|
VERSION="$(dpkg-parsechangelog -S Version | sed -e 's/^[0-9]://')"
|
|
|
|
fi
|
|
|
|
if [ -z "${VERSION}" ]; then
|
|
|
|
VERSION="$(cat /usr/share/live/build/VERSION)"
|
|
|
|
fi
|
2008-09-17 09:07:44 +00:00
|
|
|
|
2020-04-23 15:00:19 +00:00
|
|
|
LIVE_BUILD_VERSION="${VERSION}"
|
2012-12-19 07:49:06 -01:00
|
|
|
|
2012-10-22 17:20:12 +00:00
|
|
|
PATH="${PWD}/local/bin:${PATH}"
|