Merge pull request #4481 from obrakmann/linux-packaging
Fix build of Debian package
This commit is contained in:
@@ -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
|
||||||
@@ -9,41 +15,42 @@ then
|
|||||||
fi
|
fi
|
||||||
DATE=`echo $1 | grep -o "[0-9]\\+-\\?[0-9]\\?"`
|
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}/${DOCDIR}"
|
||||||
cp copyright root/usr/share/doc/openra/copyright
|
cp copyright "${DEB_BUILD_ROOT}/${DOCDIR}/copyright"
|
||||||
CHANGES=`cat ./root/usr/share/openra/CHANGELOG`
|
cp "${DEB_BUILD_ROOT}/${LIBDIR}/AUTHORS" "${DEB_BUILD_ROOT}/${DOCDIR}"
|
||||||
|
gzip -9 "${DEB_BUILD_ROOT}/${DOCDIR}/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}/${DOCDIR}/changelog"
|
||||||
cat ./root/usr/share/openra/CHANGELOG >> root/usr/share/doc/openra/changelog
|
cat "${DEB_BUILD_ROOT}/${LIBDIR}/CHANGELOG" >> "${DEB_BUILD_ROOT}/${DOCDIR}/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}" >> "${DEB_BUILD_ROOT}/${DOCDIR}/changelog"
|
||||||
gzip -9 root/usr/share/doc/openra/changelog
|
gzip -9 "${DEB_BUILD_ROOT}/${DOCDIR}/changelog"
|
||||||
|
rm "${DEB_BUILD_ROOT}/${LIBDIR}/CHANGELOG"
|
||||||
|
rm "${DEB_BUILD_ROOT}/${LIBDIR}/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
|
||||||
@@ -53,9 +60,9 @@ chmod 0644 DEBIAN/md5sums
|
|||||||
PKGVERSION=`echo $1 | sed "s/-/\\./g"`
|
PKGVERSION=`echo $1 | sed "s/-/\\./g"`
|
||||||
|
|
||||||
# Start building, the file should appear in the output directory
|
# Start building, the file should appear in the output directory
|
||||||
fakeroot dpkg-deb -b . $3/openra_${PKGVERSION}_all.deb
|
fakeroot dpkg-deb -b . "$3/openra_${PKGVERSION}_all.deb"
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
popd
|
popd
|
||||||
rm -rf root
|
rm -rf "${DEB_BUILD_ROOT}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user