Created
April 18, 2020 22:29
-
-
Save nunogrl/a2122120b77b40c391cfbe215c678ba6 to your computer and use it in GitHub Desktop.
create a deb file from an existing directory tree
This file contains hidden or 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/sh | |
# usage: | |
# version=123 sh create_debpackage.sh | |
package=bcwebsite | |
# version=234 | |
if [ ! -d ${package} ]; then | |
mkdir -p ${package}/DEBIAN | |
cat << EOF1 > ${package}/DEBIAN/control | |
Package: bcwebsite | |
Version: ${version} | |
Architecture: amd64 | |
Depends: | |
Maintainer: Nuno Leitao <[email protected]> | |
Description: SMF engine to serve Barbear Classico site. | |
EOF1 | |
cat << EOF2 > ${package}/DEBIAN/postinst | |
#!/bin/sh | |
set -e | |
echo "this is the postinstall" | |
#Move the bootstrap file to proper location | |
# mv /opt/myPackage/packaging/bootstrap.prod /opt/myPackage/.bootstraprc | |
#Clear the DEBIAN folder | |
# rm -rf /opt/myPackage/packaging/DEBIAN | |
EOF2 | |
cat << EOF3 > ${package}/DEBIAN/preinst | |
#!/bin/sh | |
echo "Do something" | |
EOF3 | |
chmod 755 bcwebsite/DEBIAN/*inst | |
fi | |
ver=$(grep Version ${package}/DEBIAN/control | cut -d" " -f2) | |
newver=$(( $ver + 1 )) | |
sed -i "s/Version: .*/Version: $newver/g" bcwebsite/DEBIAN/control | |
tar cf - /opt/nci | (cd ${package} ; tar xf -) | |
dpkg-deb --build ${package} && dpkg-name -o -s .. ${package}.deb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment