File: purge-non-gpl.sh

package info (click to toggle)
snort 2.9.7.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 55,000 kB
  • ctags: 38,464
  • sloc: ansic: 266,667; sh: 12,508; makefile: 2,908; yacc: 497; perl: 496; lex: 261; sed: 14
file content (23 lines) | stat: -rw-r--r-- 472 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# Purges non-GPL rules from a common set

if [ -z "$1" ] ; then
    echo "Usage: $0 directory_with_rules"
fi

if [ ! -d "$1" ] ; then
    echo "ERROR: $1 is not a directory"
    exit 1
fi

for file in $1/*rules; do
    if [ -r "$file" ] ; then
        name=`basename $file`
        if [ ! -e "$name" ] ; then
            cat $file |perl remove-non-gpl.pl >$name
        else
            echo "ERROR: Cowardly refusing to overwrite $name"
        fi
    fi
done