diff options
author | Frans Pop <elendil@planet.nl> | 2009-04-22 19:08:44 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2009-06-09 16:37:35 -0400 |
commit | 3e2ab2563a599c3d3fd03952c056af09fc03b74a (patch) | |
tree | 5d06666b9c983acf50db9ca33ab67956ee61932d /scripts | |
parent | 4f66199b4b372a530333d0f25aeb5d80362241ed (diff) |
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')
-rw-r--r-- | scripts/package/builddeb | 37 |
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 @@ | |||
11 | 11 | ||
12 | set -e | 12 | set -e |
13 | 13 | ||
14 | create_package() { | ||
15 | local pname="$1" pdir="$2" | ||
16 | |||
17 | # Fix ownership and permissions | ||
18 | chown -R root:root "$pdir" | ||
19 | chmod -R go-w "$pdir" | ||
20 | |||
21 | # Create the package | ||
22 | dpkg-gencontrol -isp -p$pname -P"$pdir" | ||
23 | dpkg --build "$pdir" .. | ||
24 | } | ||
25 | |||
14 | # Some variables and settings used throughout the script | 26 | # Some variables and settings used throughout the script |
15 | version=$KERNELRELEASE | 27 | version=$KERNELRELEASE |
16 | revision=$(cat .version) | 28 | revision=$(cat .version) |
@@ -77,13 +89,16 @@ linux ($version-$revision) unstable; urgency=low | |||
77 | EOF | 89 | EOF |
78 | 90 | ||
79 | # Generate a control file | 91 | # Generate a control file |
80 | if [ "$ARCH" = "um" ]; then | 92 | cat <<EOF > debian/control |
81 | cat <<EOF > debian/control | ||
82 | Source: linux | 93 | Source: linux |
83 | Section: base | 94 | Section: base |
84 | Priority: optional | 95 | Priority: optional |
85 | Maintainer: $name | 96 | Maintainer: $name |
86 | Standards-Version: 3.6.1 | 97 | Standards-Version: 3.6.1 |
98 | EOF | ||
99 | |||
100 | if [ "$ARCH" = "um" ]; then | ||
101 | cat <<EOF >> debian/control | ||
87 | 102 | ||
88 | Package: $packagename | 103 | Package: $packagename |
89 | Provides: kernel-image-$version, linux-image-$version | 104 | Provides: kernel-image-$version, linux-image-$version |
@@ -100,12 +115,7 @@ Description: User Mode Linux kernel, version $version | |||
100 | EOF | 115 | EOF |
101 | 116 | ||
102 | else | 117 | else |
103 | cat <<EOF > debian/control | 118 | cat <<EOF >> debian/control |
104 | Source: linux | ||
105 | Section: base | ||
106 | Priority: optional | ||
107 | Maintainer: $name | ||
108 | Standards-Version: 3.6.1 | ||
109 | 119 | ||
110 | Package: $packagename | 120 | Package: $packagename |
111 | Provides: kernel-image-$version, linux-image-$version | 121 | Provides: kernel-image-$version, linux-image-$version |
@@ -118,10 +128,6 @@ EOF | |||
118 | 128 | ||
119 | fi | 129 | fi |
120 | 130 | ||
121 | # Fix some ownership and permissions | ||
122 | chown -R root:root "$tmpdir" | ||
123 | chmod -R go-w "$tmpdir" | ||
124 | |||
125 | # Do we have firmware? Move it out of the way and build it into a package. | 131 | # Do we have firmware? Move it out of the way and build it into a package. |
126 | if [ -e "$tmpdir/lib/firmware" ]; then | 132 | if [ -e "$tmpdir/lib/firmware" ]; then |
127 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" | 133 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" |
@@ -134,12 +140,9 @@ Description: Linux kernel firmware, version $version | |||
134 | This package contains firmware from the Linux kernel, version $version | 140 | This package contains firmware from the Linux kernel, version $version |
135 | EOF | 141 | EOF |
136 | 142 | ||
137 | dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir" | 143 | create_package "$fwpackagename" "$fwdir" |
138 | dpkg --build "$fwdir" .. | ||
139 | fi | 144 | fi |
140 | 145 | ||
141 | # Perform the final magic | 146 | create_package "$packagename" "$tmpdir" |
142 | dpkg-gencontrol -isp -p$packagename | ||
143 | dpkg --build "$tmpdir" .. | ||
144 | 147 | ||
145 | exit 0 | 148 | exit 0 |