blob: 99d1c645d8890f862cbef8c3c48d3abfd54777a6 (
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
|
# Maintainer: Steven De Bondt <egnappah at gmail dot com>
pkgbase=geoipdatabase_reloaded
pkgver=0.9.1
pkgrel=1
arch=('x86_64')
url="https://dev.maxmind.com/geoip/geoip2/geolite2/"
license=('GPL2')
makedepends=('python2')
# We all love colors. Stop pretending you don't.
BRED="\033[1;31m"
BYELLOW='\033[1;93m'
BORANGE='\033[01;38;5;214m'
BGREEN='\033[1;92m'
NOCOLOR='\033[0m'
#the deprecated package for parsing the geoip data
source=('http://nhameh.ovh/varia/python2-pygeoip-0.3.2-4-any.pkg.tar.xz'
# the main kernel config files
'git+https://github.com/sherpya/geolite2legacy/')
sha256sums=('SKIP'
'SKIP')
pkgver() {
echo $pkgver
}
prepare() {
if [ "$(pacman -Q python2-pygeoip)" == "" ]; then
echo -e "${BYELLOW}Now installing a ${BRED}(missing in the arch repo??) ${BORANGE}package${BYELLOW} to parse the geoipfiles..."
echo -e "${BORANGE}python2-pygeoip${BYELLOW} got completely deprecated for undisclosed ${BRED}(as usual)${BYELLOW} reasons, so we need to install this here from an external source.${NOCOLOR}"
sudo pacman --noconfirm -U ../python2-pygeoip-0.3.2-4-any.pkg.tar.xz
fi
if [ ! -d CSVzips ]; then
mkdir CSVzips
fi
rm -rf CSVzips/* 2> /dev/null
if [ ! -d output ]; then
mkdir output
fi
rm -rf output/* 2> /dev/null
echo -e "${BYELLOW}Downloading the ${BGREEN}newest${BYELLOW} GeoIP CSV files from maxmind...${NOCOLOR}"
wget -P CSVzips/ https://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip
wget -P CSVzips/ https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip
wget -P CSVzips/ https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN-CSV.zip
}
build() {
echo -e "${BYELLOW}Now ${BGREEN}building${BYELLOW} the .DAT files for the geoip database.${NOCOLOR}"
python2 geolite2legacy/geolite2legacy.py -i CSVzips/GeoLite2-Country-CSV.zip -f geolite2legacy/geoname2fips.csv -o output/GeoIP.dat
python2 geolite2legacy/geolite2legacy.py -i CSVzips/GeoLite2-City-CSV.zip -f geolite2legacy/geoname2fips.csv -o output/GeoIPCity.dat
python2 geolite2legacy/geolite2legacy.py -i CSVzips/GeoLite2-ASN-CSV.zip -f geolite2legacy/geoname2fips.csv -o output/GeoIPASNum.dat
}
package() {
pkgdesc="Compiles the newest geoip databases for counties and cities from maxmind and installs them on your system"
echo -e "${BYELLOW}Installing the GeoIP Databases files in the right location${NOCOLOR}"
mkdir -p ../pkg/$pkgbase/usr/share/GeoIP
cp output/* ../pkg/$pkgbase/usr/share/GeoIP/
}
pkgname=("${pkgbase}")
|