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

Last change on this file since 3707 was 3707, checked in by Bruno Cornec, 6 years ago

Update pbtest to latest version with SLES support

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