Fix build of Debian package

The build of the Debian package had the following issues:
* AUTHORS, CHANGELOG and COPYRIGHT files were placed in /usr/lib/openra
* /usr/share/doc/openra/changelog.gz did not contain the changelog
This commit is contained in:
Oliver Brakmann
2014-01-21 20:37:23 +01:00
parent 2b07bd0f1c
commit 8d76d8e4e0

View File

@@ -1,6 +1,12 @@
#!/bin/bash #!/bin/bash
# OpenRA packaging script for Debian based distributions # OpenRA packaging script for Debian based distributions
LINUX_BUILD_ROOT="$(readlink -f "$2")"
DEB_BUILD_ROOT=./root
LIBDIR=/usr/lib/openra
DOCDIR=/usr/share/doc/openra
E_BADARGS=85 E_BADARGS=85
if [ $# -ne "3" ] if [ $# -ne "3" ]
then then
@@ -11,39 +17,40 @@ DATE=`echo $1 | grep -o "[0-9]\\+-\\?[0-9]\\?"`
TYPE=`echo $1 | grep -o "^[a-z]*"` TYPE=`echo $1 | grep -o "^[a-z]*"`
VERSION=$DATE.$TYPE VERSION=$DATE.$TYPE
rootdir=`readlink -f $2`
PACKAGE_SIZE=`du --apparent-size -c $rootdir/usr | grep "total" | awk '{print $1}'`
# Copy template files into a clean build directory (required) # Copy template files into a clean build directory (required)
mkdir root mkdir "$DEB_BUILD_ROOT"
cp -R DEBIAN root cp -R DEBIAN "$DEB_BUILD_ROOT"
cp -R $rootdir/usr root cp -R "$LINUX_BUILD_ROOT"/usr "$DEB_BUILD_ROOT"
# Binaries go in /usr/games # Binaries go in /usr/games
mv root/usr/bin/ root/usr/games/ mv "$DEB_BUILD_ROOT"/usr/bin/ "$DEB_BUILD_ROOT"/usr/games/
sed "s|/usr/bin|/usr/games|g" root/usr/games/openra > temp sed "s|/usr/bin|/usr/games|g" "$DEB_BUILD_ROOT"/usr/games/openra > temp
mv temp root/usr/games/openra mv -f temp "$DEB_BUILD_ROOT"/usr/games/openra
chmod +x root/usr/games/openra chmod +x "$DEB_BUILD_ROOT"/usr/games/openra
sed "s|/usr/bin|/usr/games|g" root/usr/games/openra-editor > temp sed "s|/usr/bin|/usr/games|g" "$DEB_BUILD_ROOT"/usr/games/openra-editor > temp
mv temp root/usr/games/openra-editor mv -f temp "$DEB_BUILD_ROOT"/usr/games/openra-editor
chmod +x root/usr/games/openra-editor chmod +x "$DEB_BUILD_ROOT"/usr/games/openra-editor
# Put the copyright and changelog in /usr/share/doc/openra/ # Put the copyright and changelog in /usr/share/doc/openra/
mkdir -p root/usr/share/doc/openra/ mkdir -p "$DEB_BUILD_ROOT"/usr/share/doc/openra/
cp copyright root/usr/share/doc/openra/copyright cp copyright "$DEB_BUILD_ROOT"/usr/share/doc/openra/copyright
CHANGES=`cat ./root/usr/share/openra/CHANGELOG` mv "$DEB_BUILD_ROOT"/usr/lib/openra/AUTHORS "$DEB_BUILD_ROOT"/usr/share/doc/openra
gzip -9 "$DEB_BUILD_ROOT"/usr/share/doc/openra/AUTHORS
DATE=`date -R` DATE=`date -R`
echo -e "openra (${VERSION}) unstable; urgency=low\n" > root/usr/share/doc/openra/changelog echo -e "openra (${VERSION}) unstable; urgency=low\n" > "$DEB_BUILD_ROOT"/usr/share/doc/openra/changelog
cat ./root/usr/share/openra/CHANGELOG >> root/usr/share/doc/openra/changelog cat "$DEB_BUILD_ROOT"/usr/lib/openra/CHANGELOG >> "$DEB_BUILD_ROOT"/usr/share/doc/openra/changelog
echo -e "\n\n-- Paul Chote <sleipnir@sleipnirstuff.com> ${DATE}" >> root/usr/share/doc/openra/changelog echo -e "\n\n-- Paul Chote <sleipnir@sleipnirstuff.com> ${DATE}" >> root/usr/share/doc/openra/changelog
gzip -9 root/usr/share/doc/openra/changelog gzip -9 "$DEB_BUILD_ROOT"/usr/share/doc/openra/changelog
rm "$DEB_BUILD_ROOT"/usr/lib/openra/CHANGELOG
rm "$DEB_BUILD_ROOT"/usr/lib/openra/COPYING
# Create the control file # Create the control file
sed "s/{VERSION}/$VERSION/" DEBIAN/control | sed "s/{SIZE}/$PACKAGE_SIZE/" > root/DEBIAN/control PACKAGE_SIZE=`du --apparent-size -c "$DEB_BUILD_ROOT"/usr | grep "total" | awk '{print $1}'`
sed "s/{VERSION}/$VERSION/" DEBIAN/control | sed "s/{SIZE}/$PACKAGE_SIZE/" > "$DEB_BUILD_ROOT"/DEBIAN/control
# Build it in the temp directory, but place the finished deb in our starting directory # Build it in the temp directory, but place the finished deb in our starting directory
pushd root pushd "$DEB_BUILD_ROOT"
# Calculate md5sums and clean up the ./usr/ part of them # Calculate md5sums and clean up the ./usr/ part of them
find . -type f -not -path "./DEBIAN/*" -print0 | xargs -0 -n1 md5sum | sed 's|\./usr/|/usr/|' > DEBIAN/md5sums find . -type f -not -path "./DEBIAN/*" -print0 | xargs -0 -n1 md5sum | sed 's|\./usr/|/usr/|' > DEBIAN/md5sums
@@ -57,5 +64,5 @@ fakeroot dpkg-deb -b . $3/openra_${PKGVERSION}_all.deb
# Clean up # Clean up
popd popd
rm -rf root rm -rf "$DEB_BUILD_ROOT"