./configure
make
-
-
Save krasnosvar/03919878b1aed03f7bff265c3e22e272 to your computer and use it in GitHub Desktop.
Build an rpm/deb package for a Symfony project
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
config: | |
packagename: symfony-demo | |
version: 1.0.0 | |
arch: all | |
maintainer: Bob The Builder <[email protected]> | |
description: Symfony demo project | |
url: http://symfony.com | |
packagetype: rpm | |
depends: '' | |
# - apache2 | |
# - libapache2-mod-php5 | |
tmpdir: /tmp | |
templatedir: templates | |
postinst: '' | |
preinst: '' | |
postrm: '' | |
prerm: '' | |
debconfconfig: '' | |
debconftemplate: '' | |
rpmconfconfig: --rpm-os linux | |
configfile: '' | |
installcmd: mkdir -p \$(PTMP)/build/var/www/symfony-demo; rsync -a --exclude Makefile* \$(PTMP)/src/ \$(PTMP)/build/var/www/symfony-demo |
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 | |
CONFIG=.package.yml | |
REQUIRED_COMMANDS="fpm shyaml" | |
for command in $REQUIRED_COMMANDS; do | |
echo -n "checking for $command... " | |
which $command || { echo "not found"; exit 1; } | |
done | |
cp Makefile.in Makefile | |
for key in $(cat $CONFIG | shyaml keys config); do | |
value=$(cat $CONFIG | shyaml get-value config.$key | sed -e 's/[\/&]/\\&/g') | |
variable=$(echo $key | tr '[:lower:]' '[:upper:]') | |
if [[ $(cat $CONFIG | shyaml get-type config.$key) == "sequence" ]]; then | |
echo "$variable" | |
else | |
sed -i '' -e 's/@'$variable'@/'"$value"'/g' Makefile | |
fi | |
done |
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
# This Makefile has been generated by the configure script. DO NOT | |
# modify it manually. If you want to modify the Makefile model, modify the | |
# Makefile.in file and run ./configure again. | |
NAME=@PACKAGENAME@ | |
VERSION=@VERSION@ | |
MAINTAINER=@MAINTAINER@ | |
PACKAGENAME=@PACKAGENAME@ | |
PACKAGETYPE=@PACKAGETYPE@ | |
URL=@URL@ | |
ARCH=@ARCH@ | |
DEPENDS=@DEPENDS@ | |
MAINTAINER=@MAINTAINER@ | |
DESCRIPTION=@DESCRIPTION@ | |
POSTINST=@POSTINST@ | |
PREINST=@PREINST@ | |
POSTRM=@POSTRM@ | |
PRERM=@PRERM@ | |
DEBCONFCONFIG=@DEBCONFCONFIG@ | |
DEBCONFTEMPLATE=@DEBCONFTEMPLATE@ | |
RPMCONFCONFIG=@RPMCONFCONFIG@ | |
CONFIGFILE=@CONFIGFILE@ | |
TEMPLATEDIR=@TEMPLATEDIR@ | |
TMP=@TMPDIR@ | |
ENV= | |
PTMP=$(TMP)/$(PACKAGENAME) | |
all: package | |
clean: | |
rm -rf $(PTMP) | |
structure: clean | |
mkdir -p $(PTMP)/src $(PTMP)/build $(PTMP)/misc | |
rsync -rl --exclude packaging --exclude Makefile \ | |
--exclude packaging_config.php --exclude '.git*' --exclude '.svn' \ | |
--exclude '.CVS' --exclude "$(TMP)" . $(PTMP)/src | |
template: structure | |
build: template | |
@INSTALLCMD@ | |
package: build | |
fpm -s dir -t $(PACKAGETYPE) -n "$(PACKAGENAME)" -v "$(VERSION)" -m "$(MAINTAINER)" --url "$(URL)" \ | |
--description "$(DESCRIPTION)" $(DEPENDS) $(POSTINST) $(PREINST) $(POSTRM) $(PRERM) \ | |
$(DEBCONFCONFIG) \ | |
$(DEBCONFTEMPLATE) \ | |
$(RPMCONFCONFIG) \ | |
$(CONFIGFILE) \ | |
-a $(ARCH) -C $(PTMP)/build -p $(PTMP)/$(PACKAGENAME)_$(VERSION)_$(ARCH).$(PACKAGETYPE) . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment