-
-
Save Landrash/07e730255214d1cc5d307513484bcddd to your computer and use it in GitHub Desktop.
Quickly generate a deb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set -e | |
PROGRAMNAME=test | |
VERSION=0.1 | |
ARCH=amd64 | |
OUTPUT_FILENAME="${PROGRAMNAME}_${VERSION}_${ARCH}.deb" | |
echo "creating deb for '${PROGRAMNAME}'; output '${OUTPUT_FILENAME}'" | |
mkdir -v -p debian/DEBIAN | |
mkdir -v -p debian/usr/bin | |
DESKTOPFILESDIR="debian/usr/share/applications" | |
chmod 644 "${DESKTOPFILESDIR}/${PROGRAMNAME}.desktop" | |
DOCSDIR="debian/usr/share/doc/${PROGRAMNAME}" | |
ICONDIR="debian/usr/share/icons/hicolor/scalable/apps" | |
ICONPATH="${ICONDIR}/${PROGRAMNAME}.svg" | |
chmod 644 "${ICONPATH}" | |
find debian -type d | xargs chmod 755 | |
# mv -v "${PROGRAMNAME}/${PROGRAMNAME}" debian/usr/bin/ | |
chmod 755 debian/usr/bin/* | |
cat "License to be determined" > "${DOCSDIR}/copyright" | |
find "${DOCSDIR}" -type f -exec chmod 0644 {} \; | |
mkdir -p debian/usr/share/doc/${PROGRAMNAME}/ | |
find debian/usr -type d -exec chmod 0755 {} \; | |
echo "" | gzip -9 - -c -f > debian/usr/share/doc/${PROGRAMNAME}/changelog.gz | |
chmod 0644 debian/usr/share/doc/${PROGRAMNAME}/changelog.gz | |
# round((size in bytes)/1024) | |
INSTALLED_SIZE=$(du -s debian/usr | awk '{x=$1/1024; i=int(x); if ((x-i)*10 >= 5) {f=1} else {f=0}; print i+f}') | |
echo "size=${INSTALLED_SIZE}" | |
echo "Package: ${PROGRAMNAME} | |
Version: ${VERSION} | |
Priority: optional | |
Architecture: ${ARCH} | |
Depends: bash (>=4.0) | |
Installed-Size: ${INSTALLED_SIZE} | |
Maintainer: No Name <[email protected]> | |
Description: asdasd asd asd sad asd asd | |
asd asd asd asd asd sad sa d. | |
asd sad ." > debian/DEBIAN/control | |
fakeroot dpkg-deb --build debian | |
mv -v debian.deb "${OUTPUT_FILENAME}" | |
find debian/ | |
lintian "${OUTPUT_FILENAME}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment