summaryrefslogtreecommitdiff
path: root/check-non-free
blob: 7022469b9807b31c39c08ab702b7fb6fde27a6b2 (plain)
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
#!/bin/bash
#  check-nonfree
#  Copyright 2010 Joshua Ismael Haase Hernández
#  Copyright © 2011 Joseph Graham

#  ---------- GNU General Public License 3 ----------
                                                                             
#  This file is part of Parabola.                                          
                                                                             
#  Parabola 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.                                     
                                                                             
#  Parabola 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 Parabola.  If not, see <http://www.gnu.org/licenses/>.       

# Set this to the URL of the blacklist.
blacklist_url="http://repo.parabolagnulinux.org/docs/blacklist.txt"

# Make a temproary directory and go to it.
tempdir=$(mktemp -d)
cd ${tempdir}

#Run a sanity check
which pacman wget >/dev/null 2>/dev/null ||
{
    echo "Cannot find pacman or wget, exiting"
    exit 1
}

# Download the blacklist.
echo "Downloading the blacklist of proprietary software packages."
echo
wget ${blacklist_url} 2>/dev/null ||
{
    echo "Download failed, exiting"
    exit 1
}

declare -a exists

for package in $(cut -d: -f1 blacklist.txt)
do
    # Check if the package is in pacman's database.
    if pacman -Q ${package} >/dev/null 2>/dev/null
    then
        # Add this package to the array of blacklited packages that have been
	# found in the system.
	exists[${#exists[@]}]=${package}
    fi
done

# Check if no proprietray software was found.
if (( ! ${#exists[@]} ))
then
    echo "No proprietary software has been found on your system."

    # Exit.
    exit 0

# Check if one proprietary software package was found.
elif (( ${#exists[@]} = 1 ))
then
    echo "This proprietary package has been found on your system:"

# Multiple proprietary software packages have been found.
else
    echo "These proprietary packages have been found on your system:"
fi

# Echo a blank line as a seperator.
echo

# Print all the proprietary software packages that have been found, seperated
# by newlines.
for package in ${exists[@]}
do
    echo ${package}
done

rm -rf $tempdir

exit 0