2019-09-25 09:05:22 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-10-08 07:14:16 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
#
|
|
|
|
# Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
|
|
|
|
2019-09-25 09:05:22 +00:00
|
|
|
DIFF=$(
|
|
|
|
diff -uNr \
|
|
|
|
-x README.md \
|
|
|
|
-x kernel \
|
|
|
|
-x kernel8.img \
|
|
|
|
-x Cargo.lock \
|
|
|
|
-x target \
|
2019-10-05 17:20:30 +00:00
|
|
|
$1 $2 \
|
2019-10-08 07:14:16 +00:00
|
|
|
| sed -r "s/[12][90][127][90]-.*//g" \
|
2019-10-20 12:42:59 +00:00
|
|
|
| sed -r "s/[[:space:]]*$//g" \
|
|
|
|
| sed -r "s/%/modulo/g"
|
2019-09-25 09:05:22 +00:00
|
|
|
)
|
|
|
|
|
2019-10-08 07:14:16 +00:00
|
|
|
HEADER="## Diff to previous"
|
|
|
|
ORIGINAL=$(
|
|
|
|
cat $2/README.md \
|
|
|
|
| sed -rn "/$HEADER/q;p"
|
|
|
|
)
|
|
|
|
|
|
|
|
printf "$ORIGINAL" > "$2/README.md"
|
|
|
|
printf "\n\n$HEADER\n" >> "$2/README.md"
|
2019-09-25 09:05:22 +00:00
|
|
|
printf "\`\`\`diff\n" >> "$2/README.md"
|
|
|
|
printf "${DIFF//'diff -uNr -x README.md -x kernel -x kernel8.img -x Cargo.lock -x target'/'\ndiff -uNr'}" >> "$2/README.md"
|
|
|
|
printf "\n\`\`\`\n" >> "$2/README.md"
|