diff options
author | Sedat Dilek <sedat.dilek@gmail.com> | 2015-01-03 04:50:19 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2015-01-06 14:42:46 -0500 |
commit | d9f711db8348233a2958cf91a19ca78677f677e0 (patch) | |
tree | 24d11fa0d69b27749c8c0ca2558a52377893afd7 /scripts/package | |
parent | 701ca30cc69bb03c0e24b67a99cdb8930dc0114f (diff) |
builddeb: Try to determine distribution
lsb_release command is a good choice to determine the distribution
name for the changelog file in the generated Debian packages [1].
Its installation is no precondition.
In Debian it is still not essential or build-essential.
Ben gave some helpful informations and detailed explanations in [2].
There he also suggested to have an option to explicitly set the
distribution name (see $KDEB_CHANGELOG_DIST variable).
Embedded the improvement as suggested by Thorsten (see [3]):
"This is suboptimal: if KDEB_CHANGELOG_DIST is defined,
lsb_release is not necessary. The following snippet
also omits using its output if it fails but still
produces any:"
Dealing with this issue I learned about "The Colon in the Shell." and
possible pitfalls in this area (see [4,5]). Furthermore, refreshed my
knowledge about redirecting outputs with the echo command (see [5]).
Special thanks to Thorsten, I enjoyed the IRC session with you.
Cooked together the snippets of Ben and Thorsten (see [2,3]).
Tested against Linux v3.19-rc2.
Thanks goes to Alexander, Ben, maximilian and Thorsten for the very
vital help.
[1] https://lkml.org/lkml/2012/4/23/516
[2] http://marc.info/?l=linux-kbuild&m=142022188322321&w=2
[3] http://marc.info/?l=linux-kbuild&m=142023476825460&w=2
[4] http://blog.brlink.eu/index.html#i70
[5] https://www.mirbsd.org/permalinks/wlog-10_e20141209-tg.htm
[6] http://stackoverflow.com/questions/23489934/echo-2-some-text-what-does-it-mean-in-shell-scripting
CC: Alexander Wirt <formorer@debian.org>
Suggested-by: Ben Hutchings <ben@decadent.org.uk>
Suggested-by: Thorsten Glaser <tg@mirbsd.org>
Reviewed-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: maximilian attems <max@stro.at>
[ dileks: Reviewed his suggested diff in RFC v4 ]
Reviewed-by: Thorsten Glaser <tg@debian.org>
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/package')
-rwxr-xr-x | scripts/package/builddeb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 2c68c8bf6c76..88dbf23b6970 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -217,9 +217,20 @@ else | |||
217 | fi | 217 | fi |
218 | maintainer="$name <$email>" | 218 | maintainer="$name <$email>" |
219 | 219 | ||
220 | # Try to determine distribution | ||
221 | if [ -n "$KDEB_CHANGELOG_DIST" ]; then | ||
222 | distribution=$KDEB_CHANGELOG_DIST | ||
223 | elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ]; then | ||
224 | : # nothing to do in this case | ||
225 | else | ||
226 | distribution="unstable" | ||
227 | echo >&2 "Using default distribution of 'unstable' in the changelog" | ||
228 | echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly" | ||
229 | fi | ||
230 | |||
220 | # Generate a simple changelog template | 231 | # Generate a simple changelog template |
221 | cat <<EOF > debian/changelog | 232 | cat <<EOF > debian/changelog |
222 | linux-upstream ($packageversion) unstable; urgency=low | 233 | linux-upstream ($packageversion) $distribution; urgency=low |
223 | 234 | ||
224 | * Custom built Linux kernel. | 235 | * Custom built Linux kernel. |
225 | 236 | ||