]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/do_sed
Add encryption regression test
[bacula/bacula] / regress / scripts / do_sed
1 #!/bin/sh
2 #
3 if test $# != 6 ; then
4    echo "First arg must be email name"
5    echo "  and the second must be a tape drive"
6    echo "  and the third must be a tape control name or /dev/null"
7    echo "  and the fourth must be the full path to the mtx program"
8    echo "  and the fifth must be tape drive 1 or /dev/null"
9    echo "  and the sixth must be the smtp or email host"
10    exit 1
11 fi
12 mkdir -p ${cwd}/bin
13 out="/tmp/sed_tmp"
14 cwd=`pwd`
15 HOST="localhost"
16 # Create sed command script
17 echo "s%@sbindir@%${cwd}/bin%g" >${out}
18 echo "s%@scriptdir@%${cwd}/bin%g" >>${out}
19 echo "s%@working_dir@%${cwd}/working%g" >>${out}
20 echo "s%@piddir@%${cwd}/working%g" >>${out}
21 echo "s%@subsysdir@%${cwd}/working%g" >>${out}
22 echo "s%@job_email@%${1}%g" >>${out}
23 echo "s%@tape_drive@%${2}%g" >>${out}
24 echo "s%@autochanger@%${3}%g" >>${out}
25 echo "s%@tmpdir@%${cwd}/tmp%g" >>${out}
26 echo "s%@hostname@%${HOST}%g" >>${out}
27 echo "s%@changer_path@%${4}%g" >>${out}
28 echo "s%@tape_drive1@%${5}%g" >>${out}
29 echo "s%@smtp_host@%${6}%g" >>${out}
30
31 echo "AUTOCHANGER=\"${3}\"" >config.out
32 echo "TAPE_DRIVE1=\"${5}\"" >>config.out
33
34
35 # process .in files with sed script
36 sed -f ${out} ${cwd}/scripts/test-bacula-dir.conf.in >${cwd}/scripts/test-bacula-dir.conf
37 sed -f ${out} ${cwd}/scripts/new-test-bacula-dir.conf.in >${cwd}/scripts/new-test-bacula-dir.conf
38 sed -f ${out} ${cwd}/scripts/testa-bacula-dir.conf.in >${cwd}/scripts/testa-bacula-dir.conf
39 sed -f ${out} ${cwd}/scripts/test-bacula-fd.conf.in >${cwd}/scripts/test-bacula-fd.conf
40 sed -f ${out} ${cwd}/scripts/test-bacula-sd.conf.in >${cwd}/scripts/test-bacula-sd.conf
41 sed -f ${out} ${cwd}/scripts/test-console.conf.in >${cwd}/scripts/test-console.conf
42 sed -f ${out} ${cwd}/scripts/crypto-bacula-fd.conf.in >${cwd}/scripts/crypto-bacula-fd.conf
43 sed -f ${out} ${cwd}/scripts/bacula-dir-tape.conf.in >${cwd}/scripts/bacula-dir-tape.conf
44 sed -f ${out} ${cwd}/scripts/win32-bacula-dir-tape.conf.in >${cwd}/scripts/win32-bacula-dir-tape.conf
45 sed -f ${out} ${cwd}/scripts/bacula-sd-tape.conf.in >${cwd}/scripts/bacula-sd-tape.conf
46 sed -f ${out} ${cwd}/scripts/bacula-sd-2tape.conf.in >${cwd}/scripts/bacula-sd-2tape.conf
47 sed -f ${out} ${cwd}/scripts/bacula-sd-2drive.conf.in >${cwd}/scripts/bacula-sd-2drive.conf
48 sed -f ${out} ${cwd}/scripts/cleanup-tape.in >${cwd}/scripts/cleanup-tape
49 sed -f ${out} ${cwd}/scripts/cleanup-2tape.in >${cwd}/scripts/cleanup-2tape
50 sed -f ${out} ${cwd}/scripts/cleanup-2drive.in >${cwd}/scripts/cleanup-2drive
51 sed -f ${out} ${cwd}/scripts/prepare-two-tapes.in >${cwd}/scripts/prepare-two-tapes
52
53 cp ${cwd}/bin/bacula-sd.conf /tmp/bac$$
54 sed s%/tmp%${cwd}/tmp%g /tmp/bac$$ >${cwd}/bin/bacula-sd.conf
55 chmod 777 ${cwd}/scripts/cleanup-*tape ${cwd}/scripts/cleanup-*drive ${cwd}/scripts/prepare-two-tapes
56 rm -f /tmp/bac$$
57 cp ${cwd}/bin/mtx-changer /tmp/bac$$
58 sed "s%^MTX.*$%MTX=${4}%g" /tmp/bac$$ >${cwd}/bin/mtx-changer
59 chmod 777 ${cwd}/bin/mtx-changer
60
61 # get proper SD tape definitions
62 cp -f ${cwd}/scripts/linux_tape_options ${cwd}/bin/tape_options
63 if test x`uname` = xFreeBSD ; then
64    cp -f ${cwd}/scripts/freebsd_tape_options ${cwd}/bin/tape_options
65 fi
66
67 rm -f ${out}
68 rm -f /tmp/bac$$