Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
     5         kx #!/bin/bash
     5         kx 
     5         kx ### Sample download script for https://mailfud.org/geoip-legacy/
     5         kx ### - Adjust DBDIR and FILES below
     5         kx ### - Copy script to /etc/cron.weekly or similar for your OS,
     5         kx ###   note that /etc/cron.* filename MUST NOT HAVE .sh extension,
     5         kx ###   rename to /etc/cron.weekly/geoip_update
     5         kx ### Contact: admin@mailfud.org
     5         kx 
     5         kx # Database directory
     5         kx DBDIR=@DATABASES_DIR@
     5         kx # Files to download (.dat.gz suffix not required)
     5         kx # FILES="GeoIP GeoIPv6 GeoIPCity GeoIPCityv6 GeoIPASNum GeoIPASNumv6 GeoIPOrg GeoIPISP"
     5         kx FILES="@DATABASES_LIST@"
     5         kx 
     5         kx # If http proxy needed
     5         kx #https_proxy="http://foo.bar:3128"
     5         kx 
     5         kx ### v0.24
     5         kx ### - add support for Ubuntu 22.04 /usr/libexec/xtables-addons/xt_geoip_build
     5         kx ### v0.23
     5         kx ### - fix xtables 3.8+, requires dbip-country-lite.csv
     5         kx ### v0.22
     5         kx ### - fix xtables stuff
     5         kx ### v0.21
     5         kx ### - added GeoIPCityv6, GeoIPASNumv6, fix https_proxy export
     5         kx 
     5         kx # DB directory
     5         kx test -w $DBDIR && cd $DBDIR 2>/dev/null || { echo "Invalid directory: $DBDIR"; exit 1; }
     5         kx 
     5         kx # Sleep 0-600 sec if started from cron
     5         kx if [ ! -t 0 ]; then sleep $((RANDOM/54)); fi
     5         kx 
     5         kx export https_proxy
     5         kx for f in $FILES; do
     5         kx   # Make sure .gz is stripped
     5         kx   f=${f%*.gz}
     5         kx   # Make sure .dat exists
     5         kx   if [[ ! "$f" =~ \.csv ]]; then f=${f%*.dat}.dat; fi
     5         kx   # .gz files are kept on disk to compare timestamps (-N)
     5         kx   wget -nv -N -T 30 --max-redirect 0 https://mailfud.org/geoip-legacy/$f.gz
     5         kx   RET=$?
     5         kx   if [ $RET -ne 0 ]; then
     5         kx           echo "wget $f.gz failed: $RET" >&2
     5         kx           continue
     5         kx   fi
     5         kx   # Unpack and replace files atomically
     5         kx   if gzip -dc $f.gz >$f.tmp; then
     5         kx     if ! diff $f $f.tmp >/dev/null 2>&1; then
     5         kx       if [ "$f" = "$XTABLES" ]; then XUPD=1; fi
     5         kx       echo "updating $f"
     5         kx       chmod 644 $f.tmp
     5         kx       /bin/mv -f $f.tmp $f
     5         kx     else
     5         kx       echo "$f is up to date"
     5         kx     fi
     5         kx   else
     5         kx     echo "gunzip $f failed" >&2
     5         kx     rm -f $f.gz
     5         kx   fi
     5         kx   rm -f $f.tmp
     5         kx done