Add configure options when building rpm (#3422)

This commit is contained in:
Haowei Yu 2020-05-19 10:04:09 -07:00 committed by GitHub
parent 76127399a5
commit 3d97332fd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -3,7 +3,7 @@
# Copyright (C) 2014-2020 Firejail Authors
# License GPL v2
#
# Usage: ./platform/rpm/mkrpm.sh firejail <version>
# Usage: ./platform/rpm/mkrpm.sh firejail <version> "<config options>"
#
# Builds rpms in a temporary directory then places the result in the
# current working directory.
@ -11,6 +11,7 @@
name=$1
# Strip any trailing prefix from the version like -rc1 etc
version=$(echo "$2" | sed 's/\-.*//g')
config_opt=$3
if [[ ! -f platform/rpm/${name}.spec ]]; then
echo error: spec file not found for name \"${name}\"
@ -22,6 +23,10 @@ if [[ -z "${version}" ]]; then
exit 1
fi
if [[ -z "${config_opt}" ]]; then
config_opt="--disable-userns --disable-contrib-install"
fi
# Make a temporary directory and arrange to clean up on exit
tmpdir=$(mktemp -d)
mkdir -p ${tmpdir}/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
@ -32,7 +37,10 @@ trap cleanup EXIT
# Create the spec file
tmp_spec_file=${tmpdir}/SPECS/${name}.spec
sed -e "s/__NAME__/${name}/g" -e "s/__VERSION__/${version}/g" platform/rpm/${name}.spec >${tmp_spec_file}
sed -e "s/__NAME__/${name}/g" \
-e "s/__VERSION__/${version}/g" \
-e "s/__CONFIG_OPT__/${config_opt}/g" \
platform/rpm/${name}.spec >${tmp_spec_file}
# FIXME: We could parse RELNOTES and create a %changelog section here
# Copy the source to build into a tarball