forked from Altinity/clickhouse-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clickhouse-update.sh
executable file
·35 lines (27 loc) · 1.03 KB
/
clickhouse-update.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
#!/bin/bash
# settings
TARGET_VERSION="${TARGET_VERSION:-18.14.15}"
CH_PACKAGES="clickhouse-common-static clickhouse-server-common clickhouse-server clickhouse-client clickhouse-test clickhouse-debuginfo"
# check whether ClickHouse is installed at all
if ! yum list installed 'clickhouse*'; then
echo "No ClickHouse packages installed"
echo "Nothing to do. Exit"
exit 0
fi
# ensure Altinity clickhouse repo is installed
if [ $(yum repolist | grep -i altinity_clickhouse | wc -l) -gt 0 ]; then
# already installed, nothing to do here
echo "Altinity ClickHouse repo already installed."
else
echo "Can not find Altinity ClickHouse repo installed. Need to install it"
curl -s https://packagecloud.io/install/repositories/Altinity/clickhouse/script.rpm.sh | sudo bash
fi
set -e
UPDATE_PACKAGES_CMD=""
for p in $CH_PACKAGES; do
rpm -q $p >/dev/null 2>/dev/null || continue
UPDATE_PACKAGES_CMD="${UPDATE_PACKAGES_CMD} ${p}-${TARGET_VERSION}"
done
echo "Updating ${UPDATE_PACKAGES_CMD}"
set -x
sudo yum update-to $UPDATE_PACKAGES_CMD