# Apt-file configuration file

# Substitutions are made as follow:
#	host => remote hostname
#	port => port
#	uri => complete URI from sources.list
#	path => path from /
#	dist => the distrib name
#	comp => the component name
#	cache => path to the cache dir
#	dest => the destination file name
#	cdrom => cdrom mount point

# Where are located Packages (relative to <comp> directory)
destination = <host>_<path>_dists_<dist>_Contents-<arch>.gz

# Fetch methods using curl -L
http = curl -L -I "<uri>/dists/<dist>/Contents-<arch>.gz" 2>&1 | grep '^HTTP.*404' > /dev/null || (curl -L -z "<cache>/<dest>" -R -o "<cache>/<dest>_tmp"  "<uri>/dists/<dist>/Contents-<arch>.gz" >/dev/null 2>&1 && (mv "<cache>/<dest>_tmp" "<cache>/<dest>" 2>&1 && chmod 644 "<cache>/<dest>") || (rm -f "<cache>/<dest>_tmp"; echo "Can't get <uri>/dists/<dist>/Contents-<arch>.gz"))
ftp = curl -L --ftp-pasv -I "<uri>/dists/<dist>/Contents-<arch>.gz" 2>&1 | grep '^Content-Length:' > /dev/null && (curl -L --ftp-pasv -z "<cache>/<dest>" -R -o "<cache>/<dest>_tmp"  "<uri>/dists/<dist>/Contents-<arch>.gz" >/dev/null 2>&1 && (mv "<cache>/<dest>_tmp" "<cache>/<dest>" 2>&1 && chmod 644 "<cache>/<dest>") || (rm -f "<cache>/<dest>_tmp"; echo "Can't get <uri>/dists/<dist>/Contents-<arch>.gz"))

# If you prefere wget uncomment following
http2 = wget -N -P "<cache>" -O "<cache>/<dest>_tmp" "<uri>/dists/<dist>/Contents-<arch>.gz" >/dev/null 2>&1 && (mv "<cache>/<dest>_tmp" "<cache>/<dest>" && chmod 644 "<cache>/<dest>")|| (rm -f "<cache>/<dest>_tmp"; echo "<uri>/dists/<dist>/Contents-<arch>.gz not found") 
ftp2 = wget -N --passive-ftp -P "<cache>" -O "<cache>/<dest>_tmp" "<uri>/dists/<dist>/Contents-<arch>.gz" >/dev/null 2>&1 && ( mv "<cache>/<dest>_tmp" "<cache>/<dest>" && chmod 644 "<cache>/<dest>") || (rm -f "<cache>/<dest>_tmp"; echo "<uri>/dists/<dist>/Contents-<arch>.gz not found")

ssh = scp -l <user> -P <port|22> "<host>:/<path>/dists/<dist>/Contents-<arch>.gz" "<cache>/<dest>" && chmod 644 "<cache>/<dest>"
rsh = rcp -l <user> "<host>:/<path>/dists/<dist>/Contents-<arch>.gz" "<cache>/<dest>" && chmod 644 "<cache>/<dest>"
file = cp "/<path>/dists/<dist>/Contents-<arch>.gz" "<cache>/<dest>" && chmod 644 "<cache>/<dest>"
copy = cp "/<path>/dists/<dist>/Contents-<arch>.gz" "<cache>/<dest>" && chmod 644 "<cache>/<dest>"
cdrom = echo "Put CDROM labeled <path> in the cdrom device" > /dev/stderr ; read ; mount "<cdrom>"; cp "<cdrom>/dists/<dist>/Contents-<arch>.gz" "<cache>/<dest>" && chmod 644 "<cache>/<dest>"; umount "<cdrom>"


