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>
This commit is contained in:
parent
4f66199b4b
commit
3e2ab2563a
1 changed files with 20 additions and 17 deletions
|
@ -11,6 +11,18 @@
|
||||||
|
|
||||||
set -e
|
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
|
# Some variables and settings used throughout the script
|
||||||
version=$KERNELRELEASE
|
version=$KERNELRELEASE
|
||||||
revision=$(cat .version)
|
revision=$(cat .version)
|
||||||
|
@ -77,13 +89,16 @@ linux ($version-$revision) unstable; urgency=low
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Generate a control file
|
# Generate a control file
|
||||||
if [ "$ARCH" = "um" ]; then
|
cat <<EOF > debian/control
|
||||||
cat <<EOF > debian/control
|
|
||||||
Source: linux
|
Source: linux
|
||||||
Section: base
|
Section: base
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: $name
|
Maintainer: $name
|
||||||
Standards-Version: 3.6.1
|
Standards-Version: 3.6.1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "$ARCH" = "um" ]; then
|
||||||
|
cat <<EOF >> debian/control
|
||||||
|
|
||||||
Package: $packagename
|
Package: $packagename
|
||||||
Provides: kernel-image-$version, linux-image-$version
|
Provides: kernel-image-$version, linux-image-$version
|
||||||
|
@ -100,12 +115,7 @@ Description: User Mode Linux kernel, version $version
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
else
|
else
|
||||||
cat <<EOF > debian/control
|
cat <<EOF >> debian/control
|
||||||
Source: linux
|
|
||||||
Section: base
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: $name
|
|
||||||
Standards-Version: 3.6.1
|
|
||||||
|
|
||||||
Package: $packagename
|
Package: $packagename
|
||||||
Provides: kernel-image-$version, linux-image-$version
|
Provides: kernel-image-$version, linux-image-$version
|
||||||
|
@ -118,10 +128,6 @@ EOF
|
||||||
|
|
||||||
fi
|
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.
|
# Do we have firmware? Move it out of the way and build it into a package.
|
||||||
if [ -e "$tmpdir/lib/firmware" ]; then
|
if [ -e "$tmpdir/lib/firmware" ]; then
|
||||||
mv "$tmpdir/lib/firmware" "$fwdir/lib/"
|
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
|
This package contains firmware from the Linux kernel, version $version
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
|
create_package "$fwpackagename" "$fwdir"
|
||||||
dpkg --build "$fwdir" ..
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Perform the final magic
|
create_package "$packagename" "$tmpdir"
|
||||||
dpkg-gencontrol -isp -p$packagename
|
|
||||||
dpkg --build "$tmpdir" ..
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue