3 # hdw - linux ./scripts/Update-Tree script
5 # author: hackbard@hackdaworld.dyndns.org
13 -mode) mode="$2" ; shift 2 ;;
16 echo "$0 -mode [keep|del|update]"
25 # test - u need cvs installed!
26 if [ ! -f /usr/bin/cvs ] ; then
27 echo "you need cvs for updating the tree"
32 # make sure cvs works ..
33 [ ! -f $HOME/.cvspass ] && touch $HOME/.cvspass
36 if [ -d ./CVS ] ; then
37 echo "updating from official cvs tree first ..."
38 cvs up -d > /dev/null 2>&1
44 echo "fetching developers packages ..."
45 cvs -d:pserver:anonymous@hackdaworld.dyndns.org:/hdw-repos co packages targets > /dev/null 2>&1
48 # add targets to $part one day
49 for part in packages; do
50 for dir in `ls -A --ignore="CVS" ./$part`; do
51 if [ ! -d ../$part/$dir ] ; then
52 echo "creating new repository $dir ..."
55 for object in `ls -A --ignore="CVS" ./$part/$dir`; do
56 if [ ! -d ../$part/$dir/$object ] ; then
57 existing_p=`find ../$part -type d -name $object`
58 if [ -z "$existing_p" ] ; then
59 echo "creating new package $object"
60 mkdir ../$part/$dir/$object
61 cp -r ./$part/$dir/$object/* \
64 if [ "$mode" = "del" ] ; then
65 echo "del mode: overwriting $object ..."
67 cp -r ./$part/$dir/$object/* \
70 echo "$object exists."
71 if [ "$mode" = "update" ] ; then
73 echo "running cvs ..."
74 cvs up -d >/dev/null 2>&1
80 if [ "$mode" = "del" ] ; then
81 echo "del mode: overwriting $object ..."
82 rm -rf ../$part/$dir/$object/*
83 cp -r ./$part/$dir/$object/* \
87 echo "$object exists."
88 if [ "$mode" = "update" ] ; then
89 cd ../$part/$dir/$object
90 echo "running cvs ..."
91 cvs up -d >/dev/null 2>&1
100 cd .. && rm -rf ./temp