Skip to content

Instantly share code, notes, and snippets.

@Darkflib
Created October 7, 2012 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Darkflib/3849505 to your computer and use it in GitHub Desktop.
Save Darkflib/3849505 to your computer and use it in GitHub Desktop.
Packaging GeoIP
#!/bin/bash
#### Edit the paths to suit your environment.
mkdir /tmp/geoip
cd /tmp/geoip/
rm -f *.dat
wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gzip -d - < GeoIP.dat.gz > GeoIP.dat
wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gzip -d - < GeoLiteCity.dat.gz > GeoLiteCity.dat
DATE=`date +%Y%M%d-%H%M`
MAINTAINER="Mike Preston <mike.preston@synety.com>"
# we probably should set the homepage,description and other info for production :)
/var/lib/gems/1.8/gems/fpm-0.4.20/bin/fpm -s dir -t deb -n geoip-data -v ${DATE} -m "${MAINTAINER}" --prefix /usr/share/GeoIP/ *.dat
root@teamplayr:www$ dpkg --info /opt/geoip/geoip-data_20122507-2025_amd64.deb
new debian package, version 2.0.
size 13509556 bytes: control archive= 394 bytes.
0 bytes, 0 lines conffiles
315 bytes, 12 lines control
Package: geoip-data
Version: 20122507-2025
License: unknown
Vendor: root@teamplayr.technomonk.net
Architecture: amd64
Maintainer: Mike Preston <mike.preston@synety.com>
Installed-Size: 20109
#Pre-Depends:
Section: default
Priority: extra
Homepage: http://example.com/no-uri-given
Description: no description given
root@teamplayr:www$ dpkg --contents /opt/geoip/geoip-data_20122507-2025_amd64.deb
drwx------ root/root 0 2012-10-07 20:25 ./
drwxr-xr-x root/root 0 2012-10-07 20:25 ./usr/
drwxr-xr-x root/root 0 2012-10-07 20:25 ./usr/share/
drwxr-xr-x root/root 0 2012-10-07 20:25 ./usr/share/GeoIP/
-rw-r--r-- root/root 1354216 2012-10-07 20:25 ./usr/share/GeoIP/GeoIP.dat
-rw-r--r-- root/root 19237666 2012-10-07 20:25 ./usr/share/GeoIP/GeoLiteCity.dat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment