diff options
Diffstat (limited to 'packaging/make-deb.sh')
-rwxr-xr-x | packaging/make-deb.sh | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/packaging/make-deb.sh b/packaging/make-deb.sh new file mode 100755 index 0000000..a7e7817 --- /dev/null +++ b/packaging/make-deb.sh @@ -0,0 +1,126 @@ +#!/bin/bash + +# Checks + +DEBIAN_DIR=packaging/debian +VERSION=`cat version.txt` +PKG_REVISION=1 +ARCH=amd64 +if [ `uname -i` != 'x86_64' ] +then + ARCH=i386 +fi +echo "Arch: $ARCH" + +DEBROOT=freshmemory_${VERSION}-${PKG_REVISION}_${ARCH} + +if [ ! -x freshmemory ] +then + echo "Error: Executable 'freshmemory' doesn't exist" + exit 1 +fi + +if [ -x ${DEBROOT} ] +then + sudo rm -rf ${DEBROOT} +fi + +strip freshmemory + +lrelease -silent freshmemory.pro + +mkdir -p $DEBROOT/DEBIAN +cp ${DEBIAN_DIR}/control $DEBROOT/DEBIAN +cp ${DEBIAN_DIR}/conffiles $DEBROOT/DEBIAN +cp ${DEBIAN_DIR}/postinst $DEBROOT/DEBIAN +cp ${DEBIAN_DIR}/prerm $DEBROOT/DEBIAN + +mkdir -p $DEBROOT/usr/bin +cp freshmemory $DEBROOT/usr/bin + +mkdir -p $DEBROOT/etc/xdg/freshmemory +cp doc/config/freshmemory.ini $DEBROOT/etc/xdg/freshmemory + +mkdir -p $DEBROOT/usr/share/freshmemory +cp --parents tr/*.qm $DEBROOT/usr/share/freshmemory + +cp ${DEBIAN_DIR}/freshmemory.xml $DEBROOT/usr/share/freshmemory + +# Copying Linux platform files + +DEBDOCDIR=$DEBROOT/usr/share/doc/freshmemory +mkdir -p $DEBDOCDIR +cp AUTHORS $DEBDOCDIR +cp ${DEBIAN_DIR}/copyright $DEBDOCDIR +cp README $DEBDOCDIR +cp ${DEBIAN_DIR}/changelog.Debian $DEBDOCDIR +gzip --best $DEBDOCDIR/changelog.Debian + +DEBMANDIR=$DEBROOT/usr/share/man/man1 +mkdir -p $DEBMANDIR +cp ${DEBIAN_DIR}/freshmemory.1 $DEBMANDIR +gzip --best $DEBMANDIR/freshmemory.1 + +mkdir -p $DEBROOT/usr/share/applications +cp ${DEBIAN_DIR}/freshmemory.desktop $DEBROOT/usr/share/applications +mkdir -p $DEBROOT/usr/share/pixmaps +cp images/freshmemory.png $DEBROOT/usr/share/pixmaps + +# Patching control file + +PKGSIZE=`du -s --exclude DEBIAN $DEBROOT| cut -f1` +echo "Package size: $PKGSIZE" + +CONTROL_TARGET=$DEBROOT/DEBIAN/control +CONTROL_DIFF=${DEBIAN_DIR}/control.diff +cp /dev/null $CONTROL_DIFF + +VERSION_NUMSTR=`grep "Version" -n $CONTROL_TARGET` +VERSION_LINE=`echo $VERSION_NUMSTR | cut -d: -f1` +VERSION_STR=`echo $VERSION_NUMSTR | cut -d: -f2-3` +echo "@@ -$VERSION_LINE,1 +$VERSION_LINE,1 @@" >> $CONTROL_DIFF +echo "-$VERSION_STR" >> $CONTROL_DIFF +echo "+Version: $VERSION-1" >> $CONTROL_DIFF + +SIZE_NUMSTR=`grep "Installed-Size" -n $CONTROL_TARGET` +SIZE_LINE=`echo $SIZE_NUMSTR | cut -d: -f1` +SIZE_STR=`echo $SIZE_NUMSTR | cut -d: -f2-3` +echo "@@ -$SIZE_LINE,1 +$SIZE_LINE,1 @@" >> $CONTROL_DIFF +echo "-$SIZE_STR" >> $CONTROL_DIFF +echo "+Installed-Size: $PKGSIZE" >> $CONTROL_DIFF + +ARCH_NUMSTR=`grep "Architecture" -n $CONTROL_TARGET` +ARCH_LINE=`echo $ARCH_NUMSTR | cut -d: -f1` +ARCH_STR=`echo $ARCH_NUMSTR | cut -d: -f2-3` +echo "@@ -$ARCH_LINE,1 +$ARCH_LINE,1 @@" >> $CONTROL_DIFF +echo "-$ARCH_STR" >> $CONTROL_DIFF +echo "+Architecture: $ARCH" >> $CONTROL_DIFF + +patch $CONTROL_TARGET < $CONTROL_DIFF + +# Patching desktop file + +DESKTOP_TARGET=$DEBROOT/usr/share/applications/freshmemory.desktop +DESKTOP_DIFF=${DEBIAN_DIR}/desktop.diff +cp /dev/null $DESKTOP_DIFF + +VERSION_NUMSTR=`grep "Version" -n $DESKTOP_TARGET` +VERSION_LINE=`echo $VERSION_NUMSTR | cut -d: -f1` +VERSION_STR=`echo $VERSION_NUMSTR | cut -d: -f2-3` +echo "@@ -$VERSION_LINE,1 +$VERSION_LINE,1 @@" >> $DESKTOP_DIFF +echo "-$VERSION_STR" >> $DESKTOP_DIFF +echo "+Version=$VERSION" >> $DESKTOP_DIFF + +patch $DESKTOP_TARGET < $DESKTOP_DIFF + +# Access rights + +sudo chown root:root -R ${DEBROOT} +sudo chmod g-w -R ${DEBROOT} +sudo chmod -x ${DEBROOT}/etc/xdg/freshmemory/freshmemory.ini + +# Make deb + +dpkg-deb -b ${DEBROOT} ${DEBROOT}.deb +lintian ${DEBROOT}.deb + |