]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/restore_ingres_catalog_backup.in
First stab at a simple script to dump the content of the complete Ingres bacula datab...
[bacula/bacula] / bacula / src / cats / restore_ingres_catalog_backup.in
1 #!/bin/sh
2 #
3 # shell script to restore a dump of the bacula Ingres database using
4 # a base64 encoded tar of the content.
5 #
6
7 bindir=@SQL_BINDIR@
8 PATH="$bindir:$PATH"
9 db_name=${db_name:-@db_name@}
10 db_user=${db_user:-@db_user@}
11 working_dir="@working_dir@"
12
13 #
14 # Source the Ingres settings when they exist.
15 #
16 [ -f ${bindir}/../../.ingIIsh  ] && . ${bindir}/../../.ingIIsh
17
18 #
19 # See if the dumpdir exists.
20 #
21 [ ! -d ${working_dir}/ingres_dump ] && mkdir -p ${working_dir}/ingres_dump
22
23 #
24 # Decode the tar and restore it.
25 #
26 cd ${working_dir}/ingres_dump || exit 1
27 case `uname -s` in
28    Linux)
29       base64 -d | gzip -dc | tar xf -
30       ;;
31    SunOS)
32       uudecode -p | gzip -dc | tar xf -
33       ;;
34    *)
35       echo "Unsupported OS type encountered, `uname -s`"
36       exit 1
37       ;;
38 esac
39
40 if [ $? = 0 ]; then
41    #
42    # Restore the data
43    #
44    sql -u${db_user} ${db_name} < copy.in
45    sysmod ${db_name}
46 fi
47
48 cd /
49
50 rm -rf ${working_dir}/ingres_dump
51
52 exit 0