#!/bin/sh
# fake rsync just to make kernel headers_install happy
# jamesbond 2022

SOURCE=
TARGET=

# ignore all flags, just get the source and target
for p; do
	case "$p" in
		-*) ;; # skip
		*) if [ -z "$SOURCE" ]; then
				SOURCE="$p"
		   elif [ -z "$TARGET" ]; then
				TARGET="$p"
		   fi
	esac
done

echo "rsync parameters: $*"
echo "Collected source: $SOURCE"
echo "Collected target: $TARGET"
echo "Subtitute rsync running ..."
mkdir -p /tmp/include &&
cp -a $SOURCE/* /tmp/include &&
find /tmp/include -type f -a \! -name '*.h' -delete &&
find /tmp/include -type d -a -empty -delete &&
mkdir -p $TARGET/include &&
cp -a /tmp/include/* $TARGET/include &&
echo "Subtitute rsync completed."
