]> git.ipfire.org Git - thirdparty/strongswan.git/blob - testing/scripts/restore-defaults
173baf820a03cd016a1795cfd5d56cbaa8d1b0e6
[thirdparty/strongswan.git] / testing / scripts / restore-defaults
1 #!/bin/bash
2 # Restore the default host configurations
3 #
4 # Copyright (C) 2004 Eric Marchionni, Patrik Rayo
5 # Zuercher Hochschule Winterthur
6 #
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the
9 # Free Software Foundation; either version 2 of the License, or (at your
10 # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # for more details.
16
17 DIR=$(dirname `readlink -f $0`)
18 . $DIR/../testing.conf
19 . $DIR/function.sh
20 SSHCONF="-F $DIR/../ssh_config"
21
22 testname=$1
23
24 HOSTCONFIGDIR=$DIR/../hosts
25 TESTSDIR=$BUILDDIR/tests
26
27 [ -d $TESTSDIR ] || die "Directory '$TESTSDIR' not found"
28 [ -d $TESTSDIR/$testname ] || die "Test '$testname' not found"
29 [ -f $TESTSDIR/$testname/test.conf ] || die "File 'test.conf' is missing"
30
31 . $TESTSDIR/$testname/test.conf
32
33 if [ -d $TESTSDIR/${testname}/hosts ]
34 then
35 for host in `ls $TESTSDIR/${testname}/hosts`
36 do
37 eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
38 scp $SSHCONF -r $HOSTCONFIGDIR/${host}/etc $HOSTLOGIN:/ > /dev/null 2>&1
39 scp $SSHCONF -r $HOSTCONFIGDIR/default/etc $HOSTLOGIN:/ > /dev/null 2>&1
40 done
41 fi