aboutsummaryrefslogtreecommitdiff
path: root/subprojects/freeamo/src/unmaintained/verify-license-copy-old
blob: 640d6d57b56bad1f83da874dd77249201e3df82e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env bash
#    This file is part of FreeAMO
#    Copyright (C) 2017 David Hedlund
#
#    FreeAMO is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    FreeAMO is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

while IFS= read -r id; do
    



    if [ ! -f "addon-$id-latest.xpi" ]; then
        
        echo "Nonfree" >> ../VERIFY-LICENSE-COPY.txt
        
    elif unzip -l "addon-$id-latest.xpi" | awk '{ print $4 }' | grep -q "^LICENSE$"; then
        
        echo "LICENSE" >> ../VERIFY-LICENSE-COPY.txt

    elif unzip -l "addon-$id-latest.xpi" | awk '{ print $4 }' | grep -q "^LICENSE.txt$"; then
        
        echo "LICENSE.txt" >> ../VERIFY-LICENSE-COPY.txt

    elif unzip -l "addon-$id-latest.xpi" | awk '{ print $4 }' | grep -q "^LICENSE.md$"; then
        
        echo "LICENSE.md" >> ../VERIFY-LICENSE-COPY.txt



    elif unzip -l "addon-$id-latest.xpi" | awk '{ print $4 }' | grep -q "^COPYING$"; then
        
        echo "COPYING" >> ../VERIFY-LICENSE-COPY.txt

    elif unzip -l "addon-$id-latest.xpi" | awk '{ print $4 }' | grep -q "^COPYING.txt$"; then
        
        echo "COPYING.txt" >> ../VERIFY-LICENSE-COPY.txt

    elif unzip -l "addon-$id-latest.xpi" | awk '{ print $4 }' | grep -q "^COPYING.md$"; then
        
        echo "COPYING.md" >> ../VERIFY-LICENSE-COPY.txt

    else

        echo "Request" >> ../VERIFY-LICENSE-COPY.txt
        
    fi

done < ../id.txt



line="0";

while IFS= read -r status; do


    ((line++))

    average_daily_users="$(sed -n ${line}p ../average_daily_users.txt)";
    id="$(sed -n ${line}p ../id.txt)";
    slug="$(sed -n ${line}p ../slug.txt)";
    license_name_en_US="$(sed -n ${line}p ../license.name.enUS.txt)";
    homepage_en_US="$(sed -n ${line}p ../homepage.en-US.txt | sed "s|3A\\/\\/|\n|" | tail -n 1)";
    support_email_en_US="$(sed -n ${line}p ../support_email.en-US.txt)";
    support_url_en_US="$(sed -n ${line}p ../support_url.en-US.txt | sed "s|3A\\/\\/|\n|" | tail -n 1)";



    if [ "$license_name_en_US" == "GNU General Public License, version 3.0" ]; then license_txt="https://www.gnu.org/licenses/gpl-3.0.txt"; license_file_name="COPYING";
    elif [ "$license_name_en_US" == "GNU General Public License, version 2.0" ]; then license_txt="https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt"; license_file_name="COPYING";
    elif [ "$license_name_en_US" == "GNU Lesser General Public License, version 3.0" ]; then license_txt="https://www.gnu.org/licenses/lgpl-3.0.txt"; license_file_name="COPYING";
    elif [ "$license_name_en_US" == "GNU Lesser General Public License, version 2.1" ]; then license_txt="https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt"; license_file_name="COPYING";
    elif [ "$license_name_en_US" == "Mozilla Public License, version 2.0" ];  then license_txt="https://www.mozilla.org/media/MPL/2.0/index.txt"; license_file_name="LICENSE";
    elif [ "$license_name_en_US" == "Mozilla Public License Version 1.1" ];  then license_txt="https://www.mozilla.org/media/MPL/1.1/index.txt"; license_file_name="LICENSE";
    elif [ "$license_name_en_US" == "BSD License" ];  then license_txt="https://directory.fsf.org/wiki?title=License:FreeBSD"; license_file_name="LICENSE";
    elif [ "$license_name_en_US" == "MIT/X11 License" ];  then license_txt="https://directory.fsf.org/wiki/License:X11"; license_file_name="LICENSE";
    fi


    if [ "$(sed -n ${line}p ../name.en-US.txt)" != "null" ]; then name="$(sed -n ${line}p ../name.en-US.txt)";
    elif [ "$(sed -n ${line}p ../name.en-GB.txt)" != "null" ]; then name="$(sed -n ${line}p ../name.en-GB.txt)";
    else name="$slug";
    fi


    if [ "$status" = "Request" ]; then

        ((count_reports++))

        # Authors that don't provide contact information will be ignored, its impossible to track conversations in Reviews anyway, because they will be deleted.

        if [ "$homepage_en_US" != "null" ] || [ "$support_url_en_US" != "null" ] || [ "$support_email_en_US" != "null" ]; then

            decimals="$(echo "$average_daily_users" | sed -r ':L;s=\b([0-9]+)([0-9]{3})\b=\1,\2=g;t L')";

            echo "
$decimals average daily users: $name - https://addons.mozilla.org/en-US/firefox/addon/$slug/
  Request: \"You have distributed $name under $license_name_en_US on https://addons.mozilla.org/en-US/firefox/addon/$slug/, but you have not added a copy of the license. can you please download the text of the license from $license_txt and add save it to file name $license_file_name and put it in the root directory of you program?\" by contacting:";

            if [ "$homepage_en_US" != "null" ]; then echo "    * Homepage (please submit Pull Request for $license_file_name if possible): $homepage_en_US"; fi
            if [ "$support_url_en_US" != "null" ]; then echo "    * Support URL (please submit Pull Request for $license_file_name if possible): $support_url_en_US"; fi
            if [ "$support_email_en_US" != "null" ]; then echo "    * Support E-mail: $support_email_en_US"; fi

        fi

    fi

done < ../VERIFY-LICENSE-COPY.txt

echo "
#########################
$count_reports reports to submit";