2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00
Files
criu/scripts/protobuf-gen.sh
Adrian Reber 84215e0355 scripts: run shellcheck on the scripts folder
Shellcheck (https://github.com/koalaman/shellcheck) can identify common
errors in shell scripts. This initial integration of shellcheck only
checks the scripts in the 'scripts/' folder. This commit fixes (or
disables) all reports of shellcheck to ensure this part starts error
free. I am not convinced this is really necessary as most changes do not
seem to be necessary for their circumstances. On the other hand it
probably does not hurt to use a checker to avoid unnecessary errors.

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-10-20 00:18:24 -07:00

24 lines
491 B
Bash

#!/bin/bash
# shellcheck disable=SC2013,SC1004
TR="y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
for x in $(sed -n '/PB_AUTOGEN_START/,/PB_AUTOGEN_STOP/ {
/PB_AUTOGEN_ST/d;
s/,.*$//;
s/\tPB_//;
p;
}' criu/include/protobuf-desc.h); do
x_la=$(echo "$x" | sed $TR)
x_uf=$(echo "$x" | sed -nr 's/^./&#\\\
/;
s/_(.)/\\\
\1#\\\
/g;
p;' | \
sed -r "/^[A-Z]#\\\\\$/!{ $TR; }" | \
sed -r ':loop; N; s/#?\\\n//; t loop')
echo "CR_PB_DESC($x, $x_uf, $x_la);"
done