mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
26 lines
653 B
Plaintext
26 lines
653 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
set -xe
|
||
|
|
||
|
# create the rpm tree
|
||
|
rpmdir=$(mktemp -d)
|
||
|
install -d -m0755 $rpmdir/{BUILD,BUILDROOT,RPMS/$(uname -m),SOURCES,SPECS,SRPMS}
|
||
|
|
||
|
# copy the sources into place
|
||
|
cp redhat/nnn.spec $rpmdir/SPECS/nnn.spec
|
||
|
vers=$(git describe --always | sed 's/^v//' | tr - .)
|
||
|
sed -i -e "s/Version:\s*\(\S\+\)/Version: $vers/" $rpmdir/SPECS/nnn.spec
|
||
|
git archive --prefix=nnn-$vers/ --format=tar.gz -o $rpmdir/SOURCES/nnn-$vers.tar.gz HEAD
|
||
|
|
||
|
# do the build
|
||
|
( cd $rpmdir/SPECS && rpmbuild --define="%_topdir $rpmdir" -ba nnn.spec )
|
||
|
|
||
|
# retreive the artifacts
|
||
|
mkdir -p dist
|
||
|
cp $rpmdir/{SRPMS,RPMS/*}/*.rpm dist/
|
||
|
|
||
|
# clean up
|
||
|
rm -rf $rpmdir
|
||
|
|
||
|
# vim: et:ai:ts=4:sw=4
|