source: MondoRescue/branches/3.3/contrib/pbtest@ 3735

Last change on this file since 3735 was 3735, checked in by Bruno Cornec, 4 years ago

test with SLES and btrfs

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/bash
2# Test a remote machine such as Fedora, RHEL, SLES
3#
4
5# On RHEL 7.3+
6# for ssh access edit pam.d files to avoid root login by ssh to fail with uid < 1000
7# Install on it perl perl-Data-Dumper and perl-YAML
8# setup that VM with pb -p pb -m $DISTRO sbx2setupvm
9# setup that VM after with pb -p mondorescue -m $DISTRO prepvm
10#
11#DISTRO=sles-15-x86_64
12DISTRO=sles-12-x86_64
13#DISTRO=rhel-8-x86_64
14#DISTRO=rhel-7-x86_64
15#DISTRO=rhel-5-x86_64
16#DISTRO=fedora-20-x86_64
17
18NAME=`pbdistrocheck $DISTRO | grep -E '^Name:' | awk '{print $2}'`
19VER=`pbdistrocheck $DISTRO | grep -E '^Ver:' | awk '{print $2}'`
20ARCH=`pbdistrocheck $DISTRO | grep -E '^Arch:' | awk '{print $2}'`
21D=$DISTRO
22DEST=/users/mondo/small
23DIR=images
24TEMP=temp
25CACHE=cache
26MNT=/mnt2
27KEY=$HOME/.ssh/pb_rsa
28PORT=`ps auxww | grep qemu | grep -w $D | grep -v grep | perl -p -e 's|.*127.0.0.1:([0-9]+)-:.*|$1|'`
29if [ _"$PORT" == _"" ]; then
30 pb -p mondorescue -r branches/3.3 -m $D launchvm
31fi
32
33pb -p mondorescue -r branches/3.3 -m $D sbx2vm MondoRescue mondo mindi mindi-busybox
34cat > /tmp/test << EOF
35#!/bin/bash
36#
37if [ $NAME = "rhel" ]; then
38 REPODIR="/etc/yum.repos.d"
39 REPOCMD="yum"
40elif [ $NAME = "sles" ]; then
41 REPODIR="/etc/zypp/repos.d"
42 REPOCMD="zypper --gpg-auto-import-keys --non-interactive"
43fi
44\$REPOCMD install -y curl
45cd \$REPODIR
46if [ ! -f \$REPODIR/mondorescue.repo ]; then
47 curl ftp://ftp.mondorescue.org/$NAME/$VER/$ARCH/mondorescue.repo -o mondorescue.repo
48fi
49if [ ! -f \$REPODIR/mondorescue-test.repo ]; then
50 curl ftp://ftp.mondorescue.org/test/$NAME/$VER/$ARCH/mondorescue-test.repo -o mondorescue-test.repo
51fi
52if [ $NAME = "rhel" ]; then
53 rpm -q epel-release
54 if [ \$? -ne 0 ]; then
55 dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$VER.noarch.rpm
56 fi
57 \$REPOCMD makecache
58elif [ $NAME = "sles" ]; then
59 \$REPOCMD ref
60fi
61\$REPOCMD install -y nfs-utils
62# To take test repo first do it that way
63\$REPOCMD install -y mindi
64\$REPOCMD install -y mondo
65\$REPOCMD update -y mondo mindi perl-MondoRescue mindi-busybox
66rpm -aq | grep -Ei 'mondo|mindi'
67modprobe nfsv3
68mkdir -p $MNT
69mount -o vers=3 10.0.2.2:$DEST $MNT
70mkdir -p $MNT/$DIR $MNT/$TEMP $MNT/$CACHE
71mondoarchive -N -G -K 99 -E '/home|/var/log|/usr/share/doc|/usr/src|/usr/share/texmf|/mnt|/mnt2' -s 4480m -n 10.0.2.2:$DEST -d $DIR -p $D -z -O -S $MNT/$CACHE -T $MNT/$TEMP
72umount $MNT/
73EOF
74# Now should be OK
75PORT=`ps auxww | grep qemu | grep -w $D | grep -v grep | perl -p -e 's|.*127.0.0.1:([0-9]+)-:.*|$1|'`
76
77ssh -i $KEY -p $PORT root@localhost "rm -rf ./test"
78scp -i $KEY -P $PORT /tmp/test root@localhost:
79ssh -i $KEY -p $PORT root@localhost "chmod 755 ./test ; sh -x ./test"
80
81sudo chown bruno $DEST/temp
82Q=$DEST/temp/test.qemu
83qemu-img create -f qcow2 $Q 7G
84cmd="qemu-kvm -m 2048 -boot d -cdrom $DEST/$DIR/$D-1.iso $Q"
85echo "Calling restore test: $cmd"
86$cmd
Note: See TracBrowser for help on using the repository browser.