Created
February 26, 2013 05:17
-
-
Save lusis/5036105 to your computer and use it in GitHub Desktop.
Generate system packages with FPM as part of maven.
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
#!/usr/bin/env bash | |
if [ -z ${CURRENT_ITERATION} ]; then | |
CURRENT_ITERATION=0enstratus1 | |
fi | |
case "${PKG_VERSION}" in | |
*-SNAPSHOT) | |
echo "Packaging a snapshot version!" | |
CURRENT_TSTAMP=`date +%s` | |
#CURRENT_SHA=`git rev-parse HEAD` | |
#CURRENT_ITERATION="${CURRENT_TSTAMP}-${CURRENT_SHA}" | |
CURRENT_ITERATION="${CURRENT_TSTAMP}" | |
;; | |
*) | |
echo "Not packaging a snapshot version" | |
;; | |
esac | |
echo "Current iteration: ${CURRENT_ITERATION}" | |
EXTRACT_DIR=fpm/extract/ | |
WORKSPACE=fpm/workspace/ | |
SOURCE=${APPNAME}-${PKG_VERSION}.tar.gz | |
mkdir -p ${EXTRACT_DIR} | |
mkdir -p ${WORKSPACE} | |
echo "Extracting ${APPNAME}-${PKG_VERSION}" | |
tar zxf ${APPNAME}-${PKG_VERSION}.tar.gz -C ${EXTRACT_DIR} --strip-components=1 | |
echo "chown -R enstratus:enstratus /services/${SHORTNAME}" > postinst | |
fpm \ | |
--workdir ${WORKSPACE} \ | |
-C ${EXTRACT_DIR} \ | |
--prefix services/${SHORTNAME}/ \ | |
-t deb \ | |
-s dir \ | |
--category non-free \ | |
-d enstratus-base \ | |
--after-install postinst \ | |
--iteration ${CURRENT_ITERATION} \ | |
--vendor "enStratus Networks Inc" \ | |
-m "John E. Vincent <john.vincent@enstratus.com>" \ | |
--url "https://enstratus.com" \ | |
--description "${DESCRIPTION}" \ | |
-a all \ | |
-n ${APPNAME} \ | |
-v ${PKG_VERSION} \ | |
. |
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
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>exec-maven-plugin</artifactId> | |
<version>1.2.1</version> | |
<executions> | |
<execution> | |
<id>fpm</id> | |
<phase>package</phase> | |
<goals><goal>exec</goal></goals> | |
</execution> | |
</executions> | |
<configuration> | |
<executable>package.sh</executable> | |
<workingDirectory>target</workingDirectory> | |
<environmentVariables> | |
<PKG_VERSION>${project.version}</PKG_VERSION> | |
<APPNAME>${project.artifactId}</APPNAME> | |
<SHORTNAME>${enstratus.component.name}</SHORTNAME> | |
<DESCRIPTION>${project.description}</DESCRIPTION> | |
</environmentVariables> | |
</configuration> | |
</plugin> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment