mirror of
https://github.com/sched-ext/scx.git
synced 2024-12-02 23:37:12 +00:00
38 lines
760 B
Bash
38 lines
760 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
if [ $# -ne 1 ]; then
|
||
|
echo "Usage: sync-from-kernel.sh KERNEL_DIR_TO_SYNC_FROM" 1>&2
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
kernel="$1/tools/sched_ext"
|
||
|
files=(scheds/include/common/* scheds/kernel-examples/*.[hc])
|
||
|
|
||
|
echo "Syncing ${#files[@]} files from \"$1\""
|
||
|
|
||
|
nr_missing=0
|
||
|
for i in "${files[@]}"; do
|
||
|
base=$(basename "$i")
|
||
|
if [ ! -f "$kernel/$base" ]; then
|
||
|
echo "$base does not exist in $kernel" 1>&2
|
||
|
nr_missing=$((nr_missing+1))
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
if [ $nr_missing -gt 0 ]; then
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
nr_skipped=0
|
||
|
for i in "${files[@]}"; do
|
||
|
base=$(basename "$i")
|
||
|
if cmp -s "$kernel/$base" $i; then
|
||
|
nr_skipped=$((nr_skipped+1))
|
||
|
continue
|
||
|
fi
|
||
|
echo "Syncing $base"
|
||
|
cp -f "$kernel/$base" $i
|
||
|
done
|
||
|
|
||
|
echo "Skipped $nr_skipped files as they are unchanged"
|