|
Guides All Guides and HOWTO's. |
|
Thread Tools | Display Modes |
|
|||
Customizeable FTP auto-fetch script (OpenBSD snapshot download as example)
The native ftp programs of FreeBSD and OpenBSD have a feature called auto-fetching. Using this to get a single file is doable. You type something like this
Code:
ftp ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/base35.tgz Code:
ftp ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/MD5 \ ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/base35.tgz \ ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/bsd \ ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/etc35.tgz \ ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/floppy35.fs In its current state. the script has been configured to download by ftp an OpenBSD snapshot. After reading the script, you will see that it is simple to adapt to your needs or wishes. Some tips
Code:
#!/bin/sh # --- FTP auto-fetch script # --- get OpenBSD snapshot server=ftp.openbsd.org server=openbsd.bay13.net dir=pub/OpenBSD/snapshots/i386 # --- customizeable file sets base="MD5 \ base35.tgz \ bsd \ bsd.rd \ comp35.tgz \ etc35.tgz \ floppy35.fs \ man35.tgz \ misc35.tgz " xwin="xbase35.tgz \ xetc35.tgz \ xfont35.tgz \ xserv35.tgz \ xshare35.tgz" misc="INSTALL.i386 \ INSTALL.linux \ index.txt" # --- main function get() { ftplist="" # Set to null in case for second invocation for item in $@ ; do full_name=ftp://$server/$dir/$item ftplist="$ftplist $full_name" done echo "About to get the following:" echo "$ftplist" ftp $ftplist } # --- main script get $base #get $xwin #get $misc And yes, I know there are more feature rich alternatives like curl and wget. The advantage of this script is that is will run on a basic FreeBSD or OpenBSD install. So you could use it to download the curl or wget package
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
Tags |
auto-fetch, ftp, script, shell |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
equivalent to freebsd fetch | pbd | OpenBSD General | 9 | 7th August 2009 11:45 AM |
Best way to upgrade from -release to snapshot | Carpetsmoker | OpenBSD General | 5 | 26th July 2009 08:51 PM |
portupgrade -af, how to submit fetch options? | bsdfan | FreeBSD Ports and Packages | 4 | 28th December 2008 09:05 PM |
Auto-YES? | wubrgamer | FreeBSD Ports and Packages | 7 | 24th September 2008 01:58 PM |
linux-flashplugin fetch error. | bsdnewbie999 | FreeBSD General | 5 | 16th May 2008 05:40 AM |