-
Notifications
You must be signed in to change notification settings - Fork 5
/
install-ubbd.sh
executable file
·83 lines (66 loc) · 1.96 KB
/
install-ubbd.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
#!/bin/bash
set -xe
[ -z "$UBBD_KERNEL_VERSION" ] && UBBD_KERNEL_VERSION="0.1.4"
[ -z "$UBBD_VERSION" ] && UBBD_VERSION="0.1.7"
[ -z "$INSTALL_UBBD_KERNEL" ] && INSTALL_UBBD_KERNEL=1
[ -z "$INSTALL_UBBD" ] && INSTALL_UBBD=1
UBBD_KERNEL_DOWNLOAD_URL="https://github.com/DataTravelGuide/ubbd-kernel/releases/download/v${UBBD_KERNEL_VERSION}/ubbd-kernel-dkms-${UBBD_KERNEL_VERSION}.tar.gz"
UBBD_DOWNLOAD_URL="https://github.com/DataTravelGuide/ubbd/releases/download/v${UBBD_VERSION}/ubbd-${UBBD_VERSION}.tar.gz"
source /etc/os-release
install_kernel_dev() {
case "$ID" in
debian|ubuntu|devuan|elementary|softiron)
env DEBIAN_FRONTEND=noninteractive apt install -y linux-headers-$(uname -r)
;;
rocky|centos|fedora|rhel|ol|virtuozzo)
yum install -y kernel-devel
;;
*)
echo "$ID is unknown, kernel development package will have to be installed manually."
exit 1
;;
esac
}
PKG_PATH=""
# clear ubbd cache dir
rm -rf /var/cache/ubbd
mkdir -p /var/cache/ubbd
if [ ${INSTALL_UBBD_KERNEL} -eq 1 ]; then
# install kernel development package
install_kernel_dev
# install ubbd-kernel
tarball_name="ubbd-kernel.tar.gz"
# get the archive of ubbd-kernel
curl -sL -o /var/cache/ubbd/${tarball_name} ${UBBD_KERNEL_DOWNLOAD_URL}
cd /var/cache/ubbd
tar xzvf ${tarball_name} > tar_output
UBBD_KERNEK_DIR=`cat tar_output|head -n 1`
cd ${UBBD_KERNEK_DIR}
# build and install ubbd-kernel
make mod
make install
# post install
depmod -a
modprobe ubbd
fi
# install ubbd and ubbd-dev from source
if [ ${INSTALL_UBBD} -eq 1 ]; then
echo "install from source"
# install ubbd-kernel
tarball_name="ubbd.tar.gz"
# get the archive of ubbd-kernel
curl -sL -o /var/cache/ubbd/${tarball_name} ${UBBD_DOWNLOAD_URL}
cd /var/cache/ubbd
tar xzvf ${tarball_name} > tar_output
UBBD_DIR=`cat tar_output|head -n 1`
cd ${UBBD_DIR}
# install dependency
./install_dep.sh
# build and install
make
make install
# post install
ldconfig
systemctl daemon-reload
systemctl restart ubbdd
fi