piston/repo/entrypoint.sh

57 lines
1.4 KiB
Bash
Raw Normal View History

cd /piston/packages
2021-03-14 00:33:15 +01:00
SERVER=1
2021-03-14 01:21:06 +01:00
BUILD=1
2021-03-14 04:03:40 +01:00
CI=0
2021-03-14 02:50:55 +01:00
2021-03-14 01:21:06 +01:00
echo "Running through arguments.."
2021-03-14 00:33:15 +01:00
for pkg in "$@"
do
2021-03-14 02:50:55 +01:00
shift
2021-03-14 01:21:06 +01:00
if [[ "$pkg" = "--no-server" ]]; then
echo "Not starting index server after builds"
SERVER=0
elif [[ "$pkg" = "--no-build" ]]; then
echo "Building no more package"
BUILD=0
2021-03-14 02:50:55 +01:00
elif [[ "$pkg" = "--ci" ]]; then
echo "Running in CI mode, --no-build, --no-server"
BUILD=0
SERVER=0
2021-03-14 04:03:40 +01:00
CI=1
2021-03-14 01:21:06 +01:00
else
if [[ $BUILD -eq 1 ]]; then
echo "Building package $pkg"
make -j16 $pkg.pkg.tar.gz
echo "Done with package $pkg"
2021-03-14 04:03:40 +01:00
elif [[ $CI -eq 1 ]]; then
echo "Commit SHA: $pkg"
echo "Changed files:"
2021-03-14 04:12:28 +01:00
git diff --name-only $pkg^1 $pkg
2021-03-14 04:03:40 +01:00
2021-03-14 04:12:28 +01:00
PACKAGES=$(git diff --name-only $pkg^1 $pkg | awk -F/ '{ print $2 "-" $3 }' | sort -u)
2021-03-14 04:03:40 +01:00
echo "Building packages: $PACKAGES"
for package in "$PACKAGES"; do
make -j16 $package.pkg.tar.gz
done
2021-03-14 01:21:06 +01:00
else
2021-03-14 04:03:40 +01:00
echo "Building was disabled, skipping $pkg build=$BUILD ci=$CI"
2021-03-14 01:21:06 +01:00
fi
fi
done
cd /piston/repo
2021-03-14 01:21:06 +01:00
echo "Creating index"
./mkindex.sh
2021-03-14 01:21:06 +01:00
echo "Index created"
2021-03-14 01:21:06 +01:00
if [[ $SERVER -eq 1 ]]; then
echo "Starting index server.."
python3 -m http.server
else
echo "Skipping starting index server"
fi
2021-03-14 01:06:04 +01:00
exit 0