2017-02-09 15:15:56 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export SCRIPTPATH="$( builtin cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
export LANG=en_US.utf8
|
|
|
|
|
|
|
|
# primarily install git for the setup below
|
|
|
|
dnf -y install git
|
|
|
|
|
|
|
|
if [[ `pwd` =~ ^/mnt/tests.*$ ]]; then
|
|
|
|
echo "Setting up native beaker environment."
|
|
|
|
git clone https://pagure.io/dist-git.git
|
|
|
|
export DISTGITROOTDIR=$SCRIPTPATH/dist-git
|
|
|
|
else
|
|
|
|
echo "Setting up from source tree."
|
|
|
|
export DISTGITROOTDIR=$SCRIPTPATH/../
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install files from 'files'
|
|
|
|
cp -rT $SCRIPTPATH/files /
|
|
|
|
|
|
|
|
# install stuff needed for the test
|
2020-05-16 18:08:18 +02:00
|
|
|
dnf -y install vagrant vagrant-libvirt rsync jq git wget fedpkg rpkg
|
2017-02-09 15:15:56 +01:00
|
|
|
|
|
|
|
# enable libvirtd for Vagrant (distgit)
|
|
|
|
systemctl enable libvirtd && systemctl start libvirtd
|
|
|
|
systemctl start virtlogd.socket # this is currently needed in f25 for vagrant to work with libvirtd
|
|
|
|
|
|
|
|
cd $DISTGITROOTDIR
|
2018-02-03 14:03:23 +01:00
|
|
|
|
2018-02-19 11:48:00 +01:00
|
|
|
if [ -z $DISTGIT_FLAVOR ]; then
|
2020-03-20 16:49:48 +01:00
|
|
|
DISTGIT_FLAVOR=dist-git
|
2018-02-19 11:48:00 +01:00
|
|
|
fi
|
|
|
|
|
2018-02-03 14:03:23 +01:00
|
|
|
DISTGITSTATUS=`mktemp`
|
2018-11-15 15:49:17 +01:00
|
|
|
vagrant status $DISTGIT_FLAVOR | tee $DISTGITSTATUS
|
2018-02-03 14:03:23 +01:00
|
|
|
if grep -q 'not created' $DISTGITSTATUS; then
|
2018-02-19 11:48:00 +01:00
|
|
|
vagrant up $DISTGIT_FLAVOR
|
2018-02-03 14:03:23 +01:00
|
|
|
else
|
2018-02-19 11:48:00 +01:00
|
|
|
vagrant reload $DISTGIT_FLAVOR
|
2018-02-03 14:03:23 +01:00
|
|
|
fi
|
|
|
|
rm $DISTGITSTATUS
|
2017-02-09 15:15:56 +01:00
|
|
|
|
2018-02-19 11:48:00 +01:00
|
|
|
IPADDR=`vagrant ssh -c "ifconfig eth0 | grep -E 'inet\s' | sed 's/\s*inet\s*\([0-9.]*\).*/\1/'" $DISTGIT_FLAVOR`
|
2017-02-11 14:27:19 +01:00
|
|
|
echo "$IPADDR pkgs.example.org" >> /etc/hosts
|
2017-02-09 15:50:33 +01:00
|
|
|
|
2017-02-10 23:29:25 +01:00
|
|
|
if ! [ -f ~/.ssh/id_rsa ]; then
|
|
|
|
mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
|
|
|
ssh-keygen -f ~/.ssh/id_rsa -N '' -q
|
|
|
|
fi
|
2017-02-09 15:50:33 +01:00
|
|
|
|
2017-02-10 12:58:09 +01:00
|
|
|
PUBKEY=`cat ~/.ssh/id_rsa.pub`
|
2018-02-19 11:48:00 +01:00
|
|
|
vagrant ssh -c "echo $PUBKEY > /tmp/id_rsa.pub.remote" $DISTGIT_FLAVOR
|
2017-02-09 15:50:33 +01:00
|
|
|
|
|
|
|
vagrant ssh -c '
|
|
|
|
sudo mkdir -p /home/clime/.ssh
|
2018-02-06 21:15:24 +01:00
|
|
|
sudo cp /tmp/id_rsa.pub.remote /home/clime/.ssh/authorized_keys
|
2017-02-09 15:50:33 +01:00
|
|
|
sudo chown -R clime:clime /home/clime/.ssh
|
|
|
|
sudo chmod 700 /home/clime/.ssh
|
|
|
|
sudo chmod 600 /home/clime/.ssh/authorized_keys
|
2018-02-19 11:48:00 +01:00
|
|
|
' $DISTGIT_FLAVOR
|
2017-02-09 15:15:56 +01:00
|
|
|
|
2018-02-06 21:15:24 +01:00
|
|
|
vagrant ssh -c '
|
|
|
|
sudo mkdir -p /root/.ssh
|
|
|
|
sudo cp /tmp/id_rsa.pub.remote /root/.ssh/authorized_keys
|
|
|
|
sudo chmod 700 /root/.ssh
|
|
|
|
sudo chmod 600 /root/.ssh/authorized_keys
|
2018-02-19 11:48:00 +01:00
|
|
|
' $DISTGIT_FLAVOR
|
2018-02-06 21:15:24 +01:00
|
|
|
|
2017-02-09 15:15:56 +01:00
|
|
|
cd $SCRIPTPATH
|