mergerfs/buildtools/build-mergerfs

65 lines
1.2 KiB
Text
Raw Normal View History

#!/bin/sh
2025-08-29 08:51:05 -04:00
set -e
2025-08-29 08:51:05 -04:00
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"
2025-08-29 08:51:05 -04:00
echo "Clone source from ${GIT_REPO} to ${BUILDDIR}"
git \
clone \
--single-branch \
--branch="${BRANCH}" \
2025-08-29 08:51:05 -04:00
"${GIT_REPO}" \
"${BUILDDIR}"
2025-08-29 08:51:05 -04:00
cd "${BUILDDIR}"
git log HEAD^1..
2025-08-29 08:51:05 -04:00
mkdir "/build"
if [ -e /usr/bin/apt-get ]; then
make deb
elif [ -e /usr/bin/dnf ]; then
make rpm
elif [ -e /usr/bin/yum ]; then
. /opt/rh/devtoolset-9/enable
make rpm
elif [ -e /sbin/apk ]; then
echo "NOT YET SUPPORTED"
2025-09-29 15:05:07 -04:00
exit 1
elif [ -e /usr/sbin/pkg ]; then
echo "NOT YET SUPPORTED"
2025-09-29 15:05:07 -04:00
exit 1
2026-03-13 15:46:18 -05:00
elif [ -e /usr/bin/pacman ]; then
make tarball
2025-08-29 08:51:05 -04:00
else
echo "NOT YET SUPPORTED"
2025-09-29 15:05:07 -04:00
exit 1
fi
2025-08-29 08:51:05 -04:00
2025-09-29 15:05:07 -04:00
echo "Copy packages to host..."
2026-03-13 15:46:18 -05:00
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
2025-09-29 15:05:07 -04:00
exit 0