piston/repo/entrypoint.sh

54 lines
1.2 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 02:50:55 +01:00
ls -la /piston /piston/*
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 03:28:45 +01:00
SHA=$1
shift
2021-03-14 03:23:36 +01:00
echo "Commit Sha: $SHA"
PACKAGES=$(git diff-tree --no-commit-id --name-only -r $SHA | awk -F/ '{ print $2 "-" $3 }' | sort -u)
2021-03-14 03:17:48 +01:00
echo "Building packages: $PACKAGES"
for package in "$PACKAGES"; do
2021-03-14 02:50:55 +01:00
make -j16 $package.pkg.tar.gz
done
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"
else
echo "Building was disabled, skipping $pkg"
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