#!/bin/bash

KERVER="$1"
if [ "x$KERVER" = "x" ];then
  echo "Please enter kernel version as an argumant"
  echo "$0 3.4.6-1vl70"
  exit 1
fi
KERNEL=$(echo $KERVER|cut -d'-' -f1)
VER=$(echo $KERVER|cut -d'-' -f2)
VLVER=$(echo $KERVER|cut -d'l' -f2|sed 's/./&./')
dir=$(pwd|cut -d'/' -f5)
echo $KERNEL $VER $VLVER $dir

case $dir in
  VL64*)
    ARCH="x86_64"
    ;;
  veclinux-*)
    ARCH="x86"
    ;;
  *)
    echo "you must run this from the repo you want to download into ie=veclinux-7.1"
    exit 1
    ;;
esac

mkdir -p $KERVER
cd $KERVER

wget http://vlcore.vectorlinux.com/pkg/untested/veclinux-$VLVER/$ARCH/kernel-$KERNEL-$ARCH-$VER.txz
wget http://vlcore.vectorlinux.com/pkg/untested/veclinux-$VLVER/$ARCH/kernel-modules-$KERNEL-$ARCH-$VER.txz
wget http://vlcore.vectorlinux.com/pkg/untested/veclinux-$VLVER/$ARCH/kernel-stripped-src-$KERNEL-$ARCH-$VER.txz
wget http://vlcore.vectorlinux.com/pkg/untested/veclinux-$VLVER/$ARCH/kernel-src-$KERNEL-$ARCH-$VER.txz
wget http://vlcore.vectorlinux.com/pkg/untested/veclinux-$VLVER/$ARCH/bcm_wimax-0.1_$KERNEL-$ARCH-$VER.txz
wget http://vlcore.vectorlinux.com/pkg/untested/veclinux-$VLVER/$ARCH/broadcom-sta-5.100.82.112_$KERNEL-$ARCH-$VER.txz
wget http://vlcore.vectorlinux.com/pkg/untested/veclinux-$VLVER/$ARCH/ndiswrapper-1.58rc1_$KERNEL-$ARCH-$VER.txz
wget http://vlcore.vectorlinux.com/pkg/untested/veclinux-$VLVER/$ARCH/amd-catalyst-driver-13.251_$KERNEL-$ARCH-$VER.txz
