mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-02 21:00:13 -05:00
- install-build-pkgs runs as root and handed its compiler choice to build-mergerfs through /tmp/build-env, which another user could create before root writes it. Use /etc/mergerfs-build-env, written to a temporary name, made mode 0644 and renamed into place, so a normal user can source it regardless of root's umask and never reads it half written. - The C++20 probe compiles in a private temporary directory instead of at fixed names in /tmp. - yum hosts also consider an already installed devtoolset, which "yum list available" omits. - Document sourcing the handoff file before make deb.
79 lines
1.6 KiB
Bash
Executable file
79 lines
1.6 KiB
Bash
Executable file
#!/bin/sh
|
|
set -e
|
|
|
|
# Written by install-build-pkgs. Never source a file from /tmp: any
|
|
# local user can create it.
|
|
BUILD_ENV=/etc/mergerfs-build-env
|
|
if [ -e "$BUILD_ENV" ]; then
|
|
. "$BUILD_ENV"
|
|
fi
|
|
|
|
rpmbuild_flags()
|
|
{
|
|
case "$(command -v "${CXX:-g++}")" in
|
|
/opt/rh/*)
|
|
printf '%s' '--undefine _annotated_build'
|
|
;;
|
|
esac
|
|
}
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "usage: $0 <branch> <git_repo>"
|
|
echo "argv: $@"
|
|
echo "argc: $#"
|
|
exit 1
|
|
fi
|
|
|
|
GIT_REPO="${1}"
|
|
BRANCH="${2}"
|
|
BUILDDIR="/tmp/build"
|
|
|
|
echo "Clone source from ${GIT_REPO} to ${BUILDDIR}"
|
|
git \
|
|
clone \
|
|
--single-branch \
|
|
--branch="${BRANCH}" \
|
|
"${GIT_REPO}" \
|
|
"${BUILDDIR}"
|
|
|
|
cd "${BUILDDIR}"
|
|
|
|
git log HEAD^1..
|
|
|
|
mkdir "/build"
|
|
if [ -e /usr/bin/apt-get ]; then
|
|
make deb
|
|
elif [ -e /usr/bin/dnf ]; then
|
|
make RPMBUILD_FLAGS="$(rpmbuild_flags)" rpm
|
|
elif [ -e /usr/bin/yum ]; then
|
|
make RPMBUILD_FLAGS="$(rpmbuild_flags)" rpm
|
|
elif [ -e /sbin/apk ]; then
|
|
echo "NOT YET SUPPORTED"
|
|
exit 1
|
|
elif [ -e /usr/sbin/pkg ]; then
|
|
echo "NOT YET SUPPORTED"
|
|
exit 1
|
|
elif [ -e /usr/bin/pacman ]; then
|
|
make tarball
|
|
else
|
|
echo "NOT YET SUPPORTED"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Copy packages to host..."
|
|
if [ -e /usr/bin/pacman ]; then
|
|
find "${BUILDDIR}" \
|
|
-type f \
|
|
-name "*.tar.gz" \
|
|
-exec cp -v {} /build/ \;
|
|
else
|
|
find "${BUILDDIR}" \
|
|
-type f \
|
|
\( -name "*.deb" -or -name "*.rpm" \) \
|
|
-not -name "*dbgsym*" \
|
|
-not -name "*sym*" \
|
|
-not -name "*src.rpm" \
|
|
-exec cp -v {} /build/ \;
|
|
fi
|
|
|
|
exit 0
|