summaryrefslogtreecommitdiff
path: root/scripts/package/builddeb
diff options
context:
space:
mode:
authorFrans Pop <elendil@planet.nl>2009-04-23 01:08:44 +0200
committerSam Ravnborg <sam@ravnborg.org>2009-06-09 22:37:35 +0200
commit3e2ab2563a599c3d3fd03952c056af09fc03b74a (patch)
tree5d06666b9c983acf50db9ca33ab67956ee61932d /scripts/package/builddeb
parent4f66199b4b372a530333d0f25aeb5d80362241ed (diff)
downloadlwn-3e2ab2563a599c3d3fd03952c056af09fc03b74a.tar.gz
lwn-3e2ab2563a599c3d3fd03952c056af09fc03b74a.zip
kbuild, deb-pkg: refactor code to reduce duplication
Factor out code to build package into separate function and only write "source" section for the debian/control file once. Signed-off-by: Frans Pop <elendil@planet.nl> Acked-by: maximilian attems <max@stro.at> Cc: Andres Salomon <dilinger@debian.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/package/builddeb')
-rw-r--r--scripts/package/builddeb37
1 files changed, 20 insertions, 17 deletions
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index eff7f9de30dc..feebd69c2eea 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -11,6 +11,18 @@
set -e
+create_package() {
+ local pname="$1" pdir="$2"
+
+ # Fix ownership and permissions
+ chown -R root:root "$pdir"
+ chmod -R go-w "$pdir"
+
+ # Create the package
+ dpkg-gencontrol -isp -p$pname -P"$pdir"
+ dpkg --build "$pdir" ..
+}
+
# Some variables and settings used throughout the script
version=$KERNELRELEASE
revision=$(cat .version)
@@ -77,13 +89,16 @@ linux ($version-$revision) unstable; urgency=low
EOF
# Generate a control file
-if [ "$ARCH" = "um" ]; then
- cat <<EOF > debian/control
+cat <<EOF > debian/control
Source: linux
Section: base
Priority: optional
Maintainer: $name
Standards-Version: 3.6.1
+EOF
+
+if [ "$ARCH" = "um" ]; then
+ cat <<EOF >> debian/control
Package: $packagename
Provides: kernel-image-$version, linux-image-$version
@@ -100,12 +115,7 @@ Description: User Mode Linux kernel, version $version
EOF
else
- cat <<EOF > debian/control
-Source: linux
-Section: base
-Priority: optional
-Maintainer: $name
-Standards-Version: 3.6.1
+ cat <<EOF >> debian/control
Package: $packagename
Provides: kernel-image-$version, linux-image-$version
@@ -118,10 +128,6 @@ EOF
fi
-# Fix some ownership and permissions
-chown -R root:root "$tmpdir"
-chmod -R go-w "$tmpdir"
-
# Do we have firmware? Move it out of the way and build it into a package.
if [ -e "$tmpdir/lib/firmware" ]; then
mv "$tmpdir/lib/firmware" "$fwdir/lib/"
@@ -134,12 +140,9 @@ Description: Linux kernel firmware, version $version
This package contains firmware from the Linux kernel, version $version
EOF
- dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
- dpkg --build "$fwdir" ..
+ create_package "$fwpackagename" "$fwdir"
fi
-# Perform the final magic
-dpkg-gencontrol -isp -p$packagename
-dpkg --build "$tmpdir" ..
+create_package "$packagename" "$tmpdir"
exit 0