[PATCH] deb-pkg: generate changelog, copyright and control on demand

maximilian attems
2008-09-17T20:58:05Z

if one those files are already in place don't overwrite it.

Cc: Andres Salomon <dilinger@debian.org>
Signed-off-by: maximilian attems <max@stro.at>
---
scripts/package/builddeb | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 01964f4..b690a91 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -63,6 +63,10 @@ EOF
chmod 755 "$tmpdir/DEBIAN/$script"
done

+[ -f debian/changelog ] || gen_changelog
+[ -f debian/copyright ] || gen_copyright
+[ -f debian/control ] || gen_control
+
# Try to determine maintainer and email values
if [ -n "${DEBEMAIL}" ]; then
email=${DEBEMAIL}
@@ -79,7 +83,10 @@ else
name="Anonymous Maintainer"
fi
maintainer="${name} <${email}>"
+
# Generate a simple changelog template
+gen_changelog()
+{
cat <<EOF > debian/changelog
linux-2.6 ($version-$revision) unstable; urgency=low

@@ -87,8 +94,11 @@ linux-2.6 ($version-$revision) unstable; urgency=low

-- ${maintainer} $(date -R)
EOF
+}

# Generate copyright file
+gen_copyright()
+{
cat <<EOF > debian/copyright
This is a packacked upstream version of the Linux kernel.

@@ -107,8 +117,11 @@ git://git.eu.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
On Debian GNU/Linux systems, the complete text of the GNU General
Public License can be found in \`/usr/share/common-licenses/GPL'.
EOF
+}

# Generate a control file
+gen_control()
+{
if [ "$ARCH" == "um" ]; then

cat <<EOF > debian/control
@@ -148,6 +161,7 @@ Description: Linux kernel, version $version
files version $version
EOF
fi
+}

# Fix some ownership and permissions
chown -R root:root "$tmpdir"
--
1.5.6.5