Salome HOME
b9ece389bdf5c29862d24da67af494a4473d85bf
[modules/hexablock.git] / src / HEXABLOCK / dsave
1 #!/bin/sh
2 # Copyright (C) 2009-2023  CEA, EDF
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # Comm : Proc de sauvegarde de repertoire
22
23 appel=$0
24 PATH=/usr/bin:$PATH
25
26 ## ========================================================== Begin
27
28 radical=pack
29
30 if ( [ -z "$1" ] ) then
31    echo
32    echo " *** Indiquez un repertoire a sauver"
33    echo
34    exit 1
35    fi
36
37 radical=`echo $1 | cut -d/ -f1 | cut -d. -f1`
38 liste_rep=
39 dest=.
40 wait_dest=
41 h=
42 psuff=
43 for arg in $*
44     do
45     case $arg in 
46        -setx ) set -x
47          ;;
48        *.tgz ) radical=`echo $arg | cut -d. -f1`
49          ;;
50        -ln ) h=h
51          ;;
52        -d )  wait_dest=ok
53          ;;
54        -m )  psuff="-matin"
55          ;;
56        -s )  psuff="-soir"
57          ;;
58
59        d=* | -d=* )   dest=`echo $arg | cut -d= -f2`
60                  echo dest=$dest
61          ;;
62        * ) if ( [ $wait_dest ] ) then
63               wait_dest=
64               dest=$arg
65            else
66               liste_rep="$liste_rep $arg"
67               radical=$arg
68            fi
69          ;;
70     esac
71     done
72
73 suff=`date '+%Y-%m-%d'`
74 suff2=`date '+%Y-%m-%d_%H-%M'`
75
76 fictar="$dest/$radical-$suff$psuff.tgz"
77 if ( [ -f $fictar ] ) then
78    fictar="$dest/$radical-$suff2$psuff.tgz"
79    fi
80
81 tar cvfz$h $fictar $liste_rep
82 echo
83 echo " ... Fichier cree : $fictar"
84