-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhost.pack.setup.sh
executable file
·67 lines (54 loc) · 1.42 KB
/
host.pack.setup.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# using : prepare packages will use
# author : [email protected]
# bash options
set -e
# libs
source config.sh
source util.sh
# variables
task_name="host.pack.setup"
host_packages=( \
util-linux \
e2fsprogs \
docker-engine \
qemu-kvm \
libvirt-bin \
virt-viewer \
)
# start
log "$task_name.start" 0
# install docker-engine repository
# if docker-engine is not installed
# for automated install below
if ! dpkg -s docker-engine > /dev/null 2>&1; then
sudo apt-get install apt-transport-https ca-certificates
sudo apt-key adv \
--keyserver hkp://p80.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo cp asset/docker.list /etc/apt/sources.list.d
apt-cache policy docker-engine
fi
# check for each packages
package_ok=true
for package in "${host_packages[@]}"; do
if dpkg -s $package > /dev/null 2>&1; then
log "$package.verify" 0
else
# try install package
log "$package.install.start" 0
sudo apt-get install -y $package
# check error
# error mean that package is not installed
# successfull mean that package is avaiable on system
log "$package.install.finish" $?
fi
done
# libvirt.user.setup
sudo adduser $USER kvm
sudo adduser $USER libvirt
# libvirt.test
virsh --connect qemu:///system list --all
# successfull
log "$task_name.finish" 0
exit 0