summaryrefslogtreecommitdiff
path: root/scripts/combo-layer-hook-default.sh
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2022-05-25 17:12:18 -0500
committerJohn Klug <john.klug@multitech.com>2022-05-25 17:12:18 -0500
commit7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8 (patch)
tree56e91417e6f937b3956cadcf4973756cebb4a8b0 /scripts/combo-layer-hook-default.sh
downloadmlinux-7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8.tar.gz
mlinux-7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8.tar.bz2
mlinux-7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8.zip
mLinux 6
Diffstat (limited to 'scripts/combo-layer-hook-default.sh')
-rwxr-xr-xscripts/combo-layer-hook-default.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/combo-layer-hook-default.sh b/scripts/combo-layer-hook-default.sh
new file mode 100755
index 0000000..1e3a3b9
--- /dev/null
+++ b/scripts/combo-layer-hook-default.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Hook to add source component/revision info to commit message
+# Parameter:
+# $1 patch-file
+# $2 revision
+# $3 reponame
+
+patchfile=$1
+rev=$2
+reponame=$3
+
+sed -i -e "0,/^Subject:/s#^Subject: \[PATCH\] \($reponame: \)*\(.*\)#Subject: \[PATCH\] $reponame: \2#" $patchfile
+if grep -q '^Signed-off-by:' $patchfile; then
+ # Insert before Signed-off-by.
+ sed -i -e "0,/^Signed-off-by:/s#\(^Signed-off-by:.*\)#\(From $reponame rev: $rev\)\n\n\1#" $patchfile
+else
+ # Insert before final --- separator, with extra blank lines removed.
+ perl -e "\$_ = join('', <>); s/^(.*\S[ \t]*)(\n|\n\s*\n)---\n/\$1\n\nFrom $reponame rev: $rev\n---\n/s; print;" $patchfile >$patchfile.tmp
+ mv $patchfile.tmp $patchfile
+fi