Skip to content

Instantly share code, notes, and snippets.

@rmacian
Last active September 18, 2018 12:40
Show Gist options
  • Save rmacian/5a7a5b243e14529075bfd2bf5ea1c4ed to your computer and use it in GitHub Desktop.
Save rmacian/5a7a5b243e14529075bfd2bf5ea1c4ed to your computer and use it in GitHub Desktop.
Build rpm with fpm
# This is how we want to name the binary output
#
VERSION := 3.7.62
PKGNAME := openshift-clients
LICENSE := Apache 2.0
VENDOR=
URL := https://github.com/openshift/origin
RELEASE := 1.git.0.ba171ec.el6
USER := root
ARCH := amd64
DESC := Origin Client binaries for Linux
MAINTAINER := Raul Macian <raul.macian@amaris.com>
DOCKER_WDIR := /tmp/fpm
DOCKER_FPM := tenzer/fpm
FPM_OPTS=-s dir -v $(VERSION) -n $(PKGNAME) \
--license "$(LICENSE)" \
--vendor "$(VENDOR)" \
--maintainer "$(MAINTAINER)" \
--architecture $(ARCH) \
--url "$(URL)" \
--description "$(DESC)" \
--config-files etc/ \
--verbose \
-d git \
# -d bash-completion
DEB_OPTS= -t deb --deb-user $(USER) \
--before-remove scripts/prerm.deb \
--after-remove scripts/postrm.deb \
--before-install scripts/preinst.deb
RPM_OPTS =--rpm-user $(USER) \
# --before-install scripts/preinst.rpm \
# --before-remove scripts/prerm.rpm \
# --after-remove scripts/postrm.rpm \
# --rpm-sign
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS=-ldflags "-X main.app_version=${VERSION}"
all: build rpm
build:
mkdir skel && cd skel && \
tar xvf ../atomic-openshift-clients-3.7.62-1.git.0.ba171ec.el7.x86_64.rpm
rpm:
docker run --rm -it \
-v "${PWD}:${DOCKER_WDIR}" -w ${DOCKER_WDIR} ${DOCKER_FPM} -t rpm ${RPM_OPTS} \
--iteration ${RELEASE} \
-C skel \
${FPM_OPTS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment