Search
SailfishOS Open Build Service
>
Projects
>
home:nielnielsen
>
geoip
> geoip-fetch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File geoip-fetch of Package geoip
#!/bin/bash set -e baseurl="http://geolite.maxmind.com/download/geoip/database" geoipdir='/usr/share/GeoIP' tempdir=`mktemp -d` cd "$tempdir" trap "/bin/rm -rf $tempdir" EXIT sources=(GeoLiteCountry/GeoIP.dat.gz GeoIPv6.dat.gz asnum/GeoIPASNum.dat.gz -- GeoLiteCity.dat.gz) targets=(GeoIP.dat GeoIPv6.dat GeoIPASNum.dat -- GeoIPCity.dat) verbose= if [ -t 0 ]; then verbose="-#" fi skiplarge=1 if [ "$1" = "-a" ]; then skiplarge= shift fi i=0 while [ $i -lt ${#sources[@]} ]; do if [ ${sources[$i]} = '--' ]; then i=$((i+1)) [ -z "$skiplarge" ] || break continue fi [ -z "$verbose" ] || echo "${targets[$i]} ..." if curl ${verbose:--s} -f -o "$tempdir/${targets[$i]}.gz" "$baseurl/${sources[$i]}"; then if gzip -d ${targets[$i]}.gz; then mv ${targets[$i]} "$geoipdir/${targets[$i]}" fi fi i=$((i+1)) done