+PACKAGE = $(shell basename `pwd` )
+DESTDIR = /
+REPO = /srv/www/repo/salt-packages/
+VERSION = $(shell cat VERSION )
+RELEASE = $(shell cat RELEASE )
+NRELEASE = $(shell echo $(RELEASE) + 1 | bc )
+YEAR = $(shell date +%Y )
+
+package:
+ sed s/VERSION/$(VERSION)/g oss-pkg-$(PACKAGE).spec.in > oss-pkg-$(PACKAGE).spec
+ sed -i s/RELEASE/$(NRELEASE)/g oss-pkg-$(PACKAGE).spec
+ sed -i s/PACKAGE/$(PACKAGE)/g oss-pkg-$(PACKAGE).spec
+ sed -i s/YEAR/$(YEAR)/g oss-pkg-$(PACKAGE).spec
+ sed s/VERSION/$(VERSION)/g init.sls.in > repo-ng/init.sls
+ ../oss-pkg-tools/create_hash.sh $(PACKAGE)
+ mkdir -p oss-pkg-$(PACKAGE)
+ sed s/PACKAGE/$(PACKAGE)/g $(PACKAGE).sls > oss-pkg-$(PACKAGE)/$(PACKAGE).sls
+ if [ -d repo-ng ]; then ln -s ../repo-ng/ oss-pkg-$(PACKAGE)/repo-ng; fi
+ tar hjcvpf oss-pkg-$(PACKAGE).tar.bz2 oss-pkg-$(PACKAGE)
+ rm -rf oss-pkg-$(PACKAGE)
+ mv oss-pkg-$(PACKAGE).tar.bz2 /usr/src/packages/SOURCES/
+ rpmbuild -bb oss-pkg-$(PACKAGE).spec
+ for i in $(REPO)/noarch/oss-pkg-$(PACKAGE)-$(VERSION)-*.rpm; do test -e $$i && rm $$i; done
+ mv /usr/src/packages/RPMS/noarch/oss-pkg-$(PACKAGE)-$(VERSION)-$(NRELEASE).noarch.rpm $(REPO)/noarch
+ echo $(NRELEASE) > RELEASE
+ git commit -a -m "New release"
+ createrepo $(REPO)
+ git push
+
+init:
+ test -d .git && rm -r .git
+ mv oss-pkg-packages.spec.in oss-pkg-$(PACKAGE).spec.in
+ sed -i 's/PACKAGE/$(PACKAGE)/g' oss-pkg-$(PACKAGE).spec.in
+ mkdir repo-ng
+ sed -i 's/PACKAGE/$(PACKAGE)/g' init.sls.in
+ mv temlate.sls $(PACKAGE).sls
+ sed -i 's/PACKAGE/$(PACKAGE)/g' $(PACKAGE).sls
+ git init
+ git add .
+ git commit -am "Initial version of $(PACKAGE)"
+ echo "Do not forget to adapt VERSION and the FULLNAMES file"