mirror of
https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials.git
synced 2024-11-11 07:10:59 +00:00
33 lines
803 B
Bash
Executable File
33 lines
803 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# SPDX-License-Identifier: MIT OR Apache-2.0
|
|
#
|
|
# Copyright (c) 2018-2021 Andre Richter <andre.o.richter@gmail.com>
|
|
|
|
DIFF=$(
|
|
diff -uNr \
|
|
-x README.md \
|
|
-x README.CN.md \
|
|
-x kernel \
|
|
-x kernel8.img \
|
|
-x Cargo.lock \
|
|
-x target \
|
|
$1 $2 \
|
|
| sed -r "s/[12][90][127][0-9]-[0-9][0-9]-[0-9][0-9] .*//g" \
|
|
| sed -r "s/[[:space:]]*$//g" \
|
|
| sed -r "s/%/modulo/g" \
|
|
| sed -r "s/diff -uNr -x README.md -x README.CN.md -x kernel -x kernel8.img -x Cargo.lock -x target/\ndiff -uNr/g"
|
|
)
|
|
|
|
HEADER="## Diff to previous"
|
|
ORIGINAL=$(
|
|
cat $2/README.md \
|
|
| sed -rn "/$HEADER/q;p"
|
|
)
|
|
|
|
echo "$ORIGINAL" > "$2/README.md"
|
|
printf "\n$HEADER\n" >> "$2/README.md"
|
|
printf "\`\`\`diff\n" >> "$2/README.md"
|
|
echo "$DIFF" >> "$2/README.md"
|
|
printf "\n\`\`\`\n" >> "$2/README.md"
|