#!/bin/sh

#DATE=`date +"%Y.%m.%d_%H.%M.%S"`
DATE=`date +"%Y.%m.%d"`

INSTALL_FROM=/users/soft5/newlabo/test/alliance

INSTALL_TO=/users/soft5/newlabo/alliance

COPYTHIS=\*
#COPYTHIS=asimut

cd $INSTALL_FROM/archi

for ARCHI in Linux SunOS Solaris
 do
 for FILE in $INSTALL_FROM/archi/$ARCHI/bin/$COPYTHIS
 do
#    echo %%%%%% $FILE
    cp -f $FILE $INSTALL_TO/archi/$ARCHI/bin/`basename $FILE`.$DATE
    chmod ug+rw $INSTALL_TO/archi/$ARCHI/bin/`basename $FILE`.$DATE
    ln -f -s $INSTALL_TO/archi/$ARCHI/bin/`basename $FILE`.$DATE $INSTALL_TO/archi/$ARCHI/bin/`basename $FILE`
    chmod ug+rw $INSTALL_TO/archi/$ARCHI/bin/`basename $FILE`
done

  for TRUC in $INSTALL_FROM/archi/$ARCHI/lib/$COPYTHIS
  do
#    echo %%%%%% $TRUC
    cp -f $TRUC $INSTALL_TO/archi/$ARCHI/lib/`basename $TRUC`
    chmod ug+rw $INSTALL_TO/archi/$ARCHI/lib/`basename $TRUC`
  done

  for TRUC in $INSTALL_FROM/archi/$ARCHI/include/$COPYTHIS
  do
#    echo %%%%%% $TRUC
    cp -f $TRUC $INSTALL_TO/archi/$ARCHI/include/`basename $TRUC`
    chmod ug+rw $INSTALL_TO/archi/$ARCHI/include/`basename $TRUC`
  done

done

# Sanity checks
echo "Launching chgrp and chmod ..."
chmod -R ug+w /users/soft5/newlabo/alliance
chgrp -R alliance /users/soft5/newlabo/alliance

echo "Il faut faire ranlib..."
