mirror of
https://abf.rosa.ru/djam/rpm-antifascist.git
synced 2025-02-24 00:22:49 +00:00
50 lines
1.1 KiB
Bash
Executable file
50 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -efu
|
|
|
|
# Mask to exclude files. You may add the following into the end of %prep section:
|
|
# export ANTIFASCIST_EXCLUDE_MASK="*.po"
|
|
ANTIFASCIST_EXCLUDE_MASK="${ANTIFASCIST_EXCLUDE_MASK:-}"
|
|
|
|
keywords=()
|
|
# ak - add keyword
|
|
# $1: keyword to add
|
|
ak(){
|
|
keywords=("${keywords[@]}" "$1")
|
|
}
|
|
|
|
# "Glory to Ukraine", "Stand with Ukraine"
|
|
ak Ukraine
|
|
ak Украина
|
|
# "Слава Украине"
|
|
ak Украине
|
|
ak Україна
|
|
ak Україне
|
|
ak Putin
|
|
ak Путин
|
|
# popular in README.md
|
|
ak SWUbanner
|
|
# https://github.com/vshymanskyy/StandWithUkraine
|
|
ak StandWithUkraine
|
|
# nodejs module
|
|
ak peacenotwar
|
|
# emoji, Ukrainian flags
|
|
ak 🇺🇦
|
|
|
|
regex="${keywords[0]}"
|
|
for (( i=1; i<${#keywords[@]}; i++ ))
|
|
do
|
|
regex="${regex}|${keywords[$i]}"
|
|
done
|
|
|
|
echo "RPM AntiFascist is using the following regex: $regex"
|
|
|
|
grep_exclude_args=""
|
|
if [ -n "$ANTIFASCIST_EXCLUDE_MASK" ]; then
|
|
grep_exclude_args="--exclude=$ANTIFASCIST_EXCLUDE_MASK"
|
|
fi
|
|
# shellcheck disable=SC2086
|
|
if grep -inHrE ${grep_exclude_args} -- "$regex" "$PWD"; then
|
|
echo "RPM AntiFascist has detected potentially faschism/nazi-alike text or malware!"
|
|
exit 5
|
|
fi
|