#!/bin/sh
#120801 download Woof.
#this code is clumsy, had to checkout, then set some parameters in repo, then erase and checkout again.
#One optional parameter, 'update'.

if [ $1 ];then
 case $1 in
  *update)
   [ ! -d woofx ] && exit 2
   cd woofx
   git pull
  ;;
  *help)
   echo "Current directory must be in a Linux filesystem."
   echo "The Woof repository will be checked-out into directory 'woofx'."
   echo "Option passed parameter 'update' will update 'woofx' from the online
Woof repository directory."
  ;;
 esac
 exit 0
fi

# download woof-CE's code
git="$(which git)"
if [ -n "$git" ]
then
	"$git" clone https://github.com/puppylinux-woof-CE/woof-CE.git woofx
else
	zip="$(mktemp -u)"
	wget -O "$zip" https://github.com/puppylinux-woof-CE/woof-CE/archive/master.zip
	unzip "$zip"
	rm -f "$zip"
	mv woof-CE-master woofx
fi