-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathinstall.sh
125 lines (114 loc) · 3.71 KB
/
install.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
export WASMEDGE_VERSION=""
export CRUN_VERSION=""
for opt in "$@"; do
case $opt in
-w=*|--wasmedge=*)
export WASMEDGE_VERSION="${opt#*=}"
shift
;;
-c=*|--crun=*)
export CRUN_VERSION="${opt#*=}"
shift
;;
*)
;;
esac
done
echo -e "Starting installation ..."
sudo apt update
export OS="xUbuntu_20.04"
export VERSION="1.21"
echo -e "OS: $OS"
echo -e "Version: $VERSION"
echo -e "Installing libseccomp2 ..."
sudo apt install -y libseccomp2
# Set download URL that we are adding to sources.list.d
export ADD1="deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /"
export DEST1="/etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
echo -e "Adding \n$ADD1 \nto \n$DEST1"
export ADD2="deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ /"
export DEST2="/etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.list"
echo -e "Adding \n$ADD2 \nto \n$DEST2"
sudo rm -rf "$DEST1"
sudo rm -rf "$DEST2"
sudo touch "$DEST1"
sudo touch "$DEST2"
if [ -f "$DEST1" ]
then
echo "$ADD1" | sudo tee -i "$DEST1"
echo "Success writing to $DEST1"
else
echo "Error writing to $DEST1"
exit 2
fi
if [ -f "$DEST2" ]
then
echo "$ADD2" | sudo tee -i "$DEST2"
echo "Success writing to $DEST2"
else
echo "Error writing to $DEST2"
exit 2
fi
echo -e "Installing wget"
sudo apt install -y wget
if [ -f Release.key ]
then
rm -rf Release.key
fi
echo -e "Fetching Release.key"
wget "https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key"
echo -e "Adding Release.key"
sudo apt-key add Release.key
echo -e "Deleting Release.key"
rm -rf Release.key
echo -e "Fetching Release.key"
wget "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key"
echo -e "Adding Release.key"
sudo apt-key add Release.key
echo -e "Removing Release.key"
rm -rf Release.key
sudo apt update
sudo apt install -y criu
sudo apt install -y libyajl2
sudo apt install -y cri-o
sudo apt install -y cri-o-runc
sudo apt install -y cri-tools
sudo apt install -y containernetworking-plugins
echo -e "Installing WasmEdge"
if [ -f install.sh ]
then
rm -rf install.sh
fi
wget -q https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh
sudo chmod a+x install.sh
if [[ "$WASMEDGE_VERSION" = "" ]]; then
echo -e "Use latest WasmEdge release"
sudo ./install.sh --path="/usr/local"
else
echo -e "Use WasmEdge: $WASMEDGE_VERSION"
sudo ./install.sh --path="/usr/local" --version="$WASMEDGE_VERSION"
fi
rm -rf install.sh
echo -e "Building and installing crun"
sudo apt install -y make git gcc build-essential pkgconf libtool libsystemd-dev libprotobuf-c-dev libcap-dev libseccomp-dev libyajl-dev go-md2man libtool autoconf python3 automake
if [[ "$CRUN_VERSION" = "" ]]; then
echo -e "Use latest master of Crun"
git clone https://github.com/containers/crun
else
echo -e "Use Crun: $CRUN_VERSION"
echo -e "Downloading crun-${CRUN_VERSION}.tar.gz"
wget https://github.com/containers/crun/releases/download/"${CRUN_VERSION}"/crun-"${CRUN_VERSION}".tar.gz
tar --no-overwrite-dir -xzf crun-"${CRUN_VERSION}".tar.gz
mv crun-"${CRUN_VERSION}" crun
fi
cd crun || exit
./autogen.sh
./configure --with-wasmedge
make
sudo make install
# Write config
echo -e "[crio.runtime]\ndefault_runtime = \"crun\"\n" | sudo tee -i /etc/crio/crio.conf
echo -e "\n# Add crun runtime here\n[crio.runtime.runtimes.crun]\nruntime_path = \"/usr/local/bin/crun\"\nruntime_type = \"oci\"\nruntime_root = \"/run/crun\"\n" | sudo tee -i -a /etc/crio/crio.conf.d/01-crio-runc.conf
sudo systemctl restart crio
echo -e "Finished"