-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_or_install_latest_dragonfly.sh
executable file
·29 lines (28 loc) · 1.46 KB
/
check_or_install_latest_dragonfly.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
#
# if the cache contains the latest dragonfly timestamp and the vm has already been build, then use it
# otherwise download the latest iso, create an image fs and setup a complete dragonfly OS in a kvm accelerated vmm
# the installation of the os is controlled via a python-pexpect script
#
# Created by: Diederik de Groot (2018)
#set -uexo pipefail
if [ -d $SEMAPHORE_CACHE_DIR ]; then
pushd $SEMAPHORE_CACHE_DIR
curl -s http://ftp.tu-clausthal.de/pub/DragonFly/snapshots/df_timestamp.txt -o df_timestamp.txt
if [ ! -f prev_timestamp.txt ] || [ ! -z "`diff df_timestamp.txt prev_timestamp.txt`" ]; then
[ -f image.qcow ] && rm image.qcow
sudo apt install -y python3-cairo python3-gi python3-gi-cairo python3-sqlalchemy python3-psutil python3-pip
sudo pip3 install pexpect
curl -s http://ftp.tu-clausthal.de/pub/DragonFly/snapshots/x86_64/DragonFly-x86_64-LATEST-ISO.iso.bz2 -o - |pbzip2 -d -c - >DragonFly-x86_64-LATEST-ISO.iso
qemu-img create -f qcow2 image.img 13G
ls -sl --block-size 1 image.img
sudo ../scripts/install_dfly.py;
ls -sl --block-size 1 image.img
cp df_timestamp.txt prev_timestamp.txt;
echo "DragonFly has been installed"
rm DragonFly-x86_64-LATEST-ISO.iso
else
echo "Latest version of DragonFly is already installed, no need to reinstall, using cached version"
fi
popd
fi