-
Notifications
You must be signed in to change notification settings - Fork 13
/
install.sh
executable file
·47 lines (40 loc) · 1.24 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
#!/bin/sh
set -e
#
# This script provides a mechanism for easy installation of the
# cinder-docker-driver, use with curl or wget:
# 'curl -sSl https://raw.githubusercontent.com/j-griffith/cinder-docker-driver/master/install.sh | sh''
# or
# 'wget -qO- https://raw.githubusercontent.com/j-griffith/cinder-docker-driver/master/install.sh | sh'
VERSION=${1:-release}
BIN_NAME=cdd
DRIVER_URL="https://github.com/j-griffith/cinder-docker-driver/releases/download/v0.13/cinder-docker-driver"
SRC_BIN=./_bin/cdd
BIN_DIR="/usr/bin"
do_install() {
mkdir -p /var/lib/cinder/dockerdriver
mkdir -p /var/lib/cinder/mount
rm $BIN_DIR/$BIN_NAME || true
echo "Version is: ${VERSION}"
if [ "${VERSION}" = 'source' ]; then
cp ./_bin/cdd $BIN_DIR/$BIN_NAME
else
echo "Installing release from github repo..."
curl -sSL -o $BIN_DIR/$BIN_NAME $DRIVER_URL
chmod +x $BIN_DIR/$BIN_NAME
fi
echo "
[Unit]
Description=\"Cinder Docker Plugin daemon\"
Before=docker.service
Requires=cinder-docker-driver.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/cdd &
[Install]
WantedBy=docker.service" >/etc/systemd/system/cinder-docker-driver.service
chmod 644 /etc/systemd/system/cinder-docker-driver.service
systemctl daemon-reload
systemctl enable cinder-docker-driver
}
do_install