Last active
September 24, 2015 11:01
-
-
Save sdumetz/7ce71a939a8018004fe6 to your computer and use it in GitHub Desktop.
barebones script to build deb packages
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 | |
# basic deb package building | |
set -e | |
DIR="$( cd "$( dirname "$0" )" && pwd )" | |
NODE_ENV=production | |
VERSION=$(head -1 $DIR/debian/changelog|sed -r 's/.*\(([^\)]*)\).*/\1/') | |
NAME=$(head -1 $DIR/debian/changelog|cut -d " " -f 1) | |
TMP=$(mktemp -d) | |
DEST=$TMP/$NAME-$VERSION | |
PREFIX=usr | |
ETC=/etc/$NAME | |
LIB=${DEST}/${PREFIX}/lib | |
BIN=${DEST}/${PREFIX}/bin | |
SHARE=${DEST}/${PREFIX}/share | |
mkdir -p $LIB $BIN | |
### HERE CP files and directories ### | |
### END of CP ### | |
### Edit symbolic link | |
ln -s /$PREFIX/lib/node_modules/$NAME/bin/$NAME $BIN/$NAME | |
#replace placeholders in control | |
sed -i -e "s/{{NAME}}/$NAME/" -e "s/{{VERSION}}/$VERSION/" $DEST/DEBIAN/control | |
echo "building package : ${NAME}_${VERSION}.deb" | |
dpkg-deb --build $DEST $DIR/${NAME}_${VERSION}.deb | |
rm -rf $TMP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment