summaryrefslogtreecommitdiff
path: root/insertlicense.sh
blob: 53400b9180a4474f9c8e7804e764357bef5ead90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
echo "IMPORTANT: Hit C-c if you forgot to backup/commit stuff!!!"
read
ls *.c *.h *.cpp | while read i; do
    if grep --silent "DO NOT EDIT" "$i" || grep --silent "DeaDBeeF - ultimate music player for GNU/Linux systems with X11" "$i"  ; then
        if grep --silent "version 3 of the License" "$i" ; then
            echo "changing $i to gpl2"
            sed -i 's/version 3 of the License/version 2 of the License/' "$i"
        else
            echo "skipping file $i"
        fi
    else
        echo "adding license text to $i"
        cat shortlicense >/tmp/deadbeef.lic.tmp
        cat "$i" >>/tmp/deadbeef.lic.tmp
        mv /tmp/deadbeef.lic.tmp "$i"
    fi
done