#!/bin/sh -e
# Simple script to fetch NetBSD/vax MOP boot files for all versions (up to 9.1) - abs@absd.org

for version in 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.4 1.4.1 1.4.2 1.4.3 1.5 1.5.1 1.5.2 1.5.3 \
	1.6 1.6.1 1.6.2 2.0 2.0.2 2.0.3 2.1 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 \
        4.0 4.0.1 5.0 5.0.1 5.0.2 5.1 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.2 5.2.1 5.2.2 5.2.3 \
        6.0 6.0.1 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.1 6.1.1 6.1.2 6.1.3 6.1.4 6.1.5 \
        7.0 7.0.1 7.0.2 7.1 7.1.1 7.1.2 7.2 8.0 8.1 8.2 9.0 9.1 ; do

    echo -n "$version: "
    base=http://archive.netbsd.org/pub/NetBSD-archive

    case $version in
       2.0.3 )  echo "Source only release"; continue ;;
       1.0 | 1.1 | 1.2.1 | 1.3.1 | 1.3.3) echo "No vax port in release"; continue ;;
       1.2 | 1.4.2 | 1.4.3 ) echo "No vax netboot in release"; continue ;;
       1.3*)         distname=boot.mopformat ;;
       1.4.1)        distname=boot.mop.gz ;; # Seriously - one version has gzipped mop
       1.4* | 1.5* ) distname=boot.mop ;; 
       1.6* | 2* | 3* | 4* | 5* | 6* ) distname=boot ;;
       * ) distname=boot ; base=http://ftp.netbsd.org/pub/NetBSD ;;
    esac

    remote=$base/NetBSD-$version/vax/installation/netboot/$distname
    echo $remote

    case $remote in
      *gz) ftp -V -o netbsd-vax-$version.mop.gz $remote && gunzip -f netbsd-vax-$version.mop.gz ;;
      *) ftp -V -o netbsd-vax-$version.mop $remote ;;
    esac

done
