Skip to content

Instantly share code, notes, and snippets.

@timconradinc
Created July 25, 2014 21:22
Show Gist options
  • Save timconradinc/91f5c2fc6177fdefb0f2 to your computer and use it in GitHub Desktop.
Save timconradinc/91f5c2fc6177fdefb0f2 to your computer and use it in GitHub Desktop.
fpm wrapper
PKG_NAME=$(basename $(pwd))
TMP_PATH=/tmp/$PKG_NAME-$RANDOM
VERSION=1.0
# increment ITERATION for additional builds that may be needed.
# This is helpful for minor changes, like adding new account id's or something
# along thos elines
ITERATION=1
DESCRIPTION="This is a basic description of this package"
START=$PWD
mkdir -p ${TMP_PATH}/data/company/${PKG_NAME}/{bin,etc,src,bak}
SDIRS="src etc bin"
# simple workaround for copying the various files in the repo to
# the location they'll be packaged in
for D in ${SDIRS}
do
if [ $(ls ${START}/${D}/* 2> /dev/null | wc -l) -gt 0 ];
then
cp -Rpv ${START}/${D}/* ${TMP_PATH}/data/company/${PKG_NAME}/src/
fi
done
cd $START
# I fail at inline comments, so here's the comments for the following fpm command
# this is the main command - this shouldn't need to be changed:
# fpm --deb-user root --deb-group root -s dir -t deb -a all -n ${PKG_NAME} -C ${TMP_PATH} -v ${VERSION} -p ${PKG_NAME}${PKG_TAG}-VERSION_ARCH.deb --iteration ${ITERATION} \
# Use this flag for packages that should be installed *before* this package, otherwise packages get installed in no particular order which can cause dependancy issues.
#--deb-pre-depends company-baseconfig \
# These are regular packages that this package depends on.
#-d curl \
# This will be your basic install script that actually does whatever.
#--after-install ${START}/fpm/install.sh \
# this is the basic uninstall script
#--after-remove ${START}/fpm/uninstall.sh \
# This next line shouldn't need to be messed with.
# keep --deb-pre-depends company-baseconfig as it configures a lot of core things.
echo "pwd: $(pwd)"
fpm --deb-user root --deb-group root -s dir -t deb -a all -n ${PKG_NAME} -C ${TMP_PATH} -v ${VERSION} -p ${PKG_NAME}${PKG_TAG}-VERSION_ARCH.deb --iteration ${ITERATION} \
--description "${DESCRIPTION}" \
--deb-pre-depends company-baseconfig \
-d curl \
--after-install ${START}/fpm/install.sh \
--after-remove ${START}/fpm/uninstall.sh \
data && mv *.deb ..
rm -rf ${TMP_PATH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment