2016-02-07 20:02:44 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
2019-06-28 13:33:24 +00:00
|
|
|
# set -x
|
2016-02-07 20:02:44 +00:00
|
|
|
|
2020-10-19 12:34:34 +00:00
|
|
|
PROGRAM=clickhouse-server
|
2019-02-15 11:43:47 +00:00
|
|
|
CLICKHOUSE_USER=${CLICKHOUSE_USER:=clickhouse}
|
|
|
|
CLICKHOUSE_GROUP=${CLICKHOUSE_GROUP:=${CLICKHOUSE_USER}}
|
2019-12-07 18:47:59 +00:00
|
|
|
# Please note that we don't support paths with whitespaces. This is rather ignorant.
|
2019-02-15 11:43:47 +00:00
|
|
|
CLICKHOUSE_CONFDIR=${CLICKHOUSE_CONFDIR:=/etc/clickhouse-server}
|
|
|
|
CLICKHOUSE_DATADIR=${CLICKHOUSE_DATADIR:=/var/lib/clickhouse}
|
|
|
|
CLICKHOUSE_LOGDIR=${CLICKHOUSE_LOGDIR:=/var/log/clickhouse-server}
|
|
|
|
CLICKHOUSE_BINDIR=${CLICKHOUSE_BINDIR:=/usr/bin}
|
|
|
|
CLICKHOUSE_GENERIC_PROGRAM=${CLICKHOUSE_GENERIC_PROGRAM:=clickhouse}
|
2019-01-31 13:03:17 +00:00
|
|
|
EXTRACT_FROM_CONFIG=${CLICKHOUSE_GENERIC_PROGRAM}-extract-from-config
|
|
|
|
CLICKHOUSE_CONFIG=$CLICKHOUSE_CONFDIR/config.xml
|
2020-10-19 12:34:34 +00:00
|
|
|
CLICKHOUSE_PIDDIR=/var/run/$PROGRAM
|
2019-01-31 13:03:17 +00:00
|
|
|
|
2019-06-28 13:33:24 +00:00
|
|
|
[ -f /usr/share/debconf/confmodule ] && . /usr/share/debconf/confmodule
|
|
|
|
[ -f /etc/default/clickhouse ] && . /etc/default/clickhouse
|
2017-01-31 19:53:05 +00:00
|
|
|
|
2020-01-10 10:19:59 +00:00
|
|
|
if [ ! -f "/etc/debian_version" ]; then
|
|
|
|
not_deb_os=1
|
2019-06-25 13:55:31 +00:00
|
|
|
fi
|
|
|
|
|
2020-01-10 10:19:59 +00:00
|
|
|
if [ "$1" = configure ] || [ -n "$not_deb_os" ]; then
|
2021-04-11 19:07:23 +00:00
|
|
|
|
|
|
|
${CLICKHOUSE_GENERIC_PROGRAM} install --user "${CLICKHOUSE_USER}" --group "${CLICKHOUSE_GROUP}" --pid-path "${CLICKHOUSE_PIDDIR}" --config-path "${CLICKHOUSE_CONFDIR}" --binary-path "${CLICKHOUSE_BINDIR}" --log-path "${CLICKHOUSE_LOGDIR}" --data-path "${CLICKHOUSE_DATADIR}"
|
|
|
|
|
2018-01-19 18:54:40 +00:00
|
|
|
if [ -x "/bin/systemctl" ] && [ -f /etc/systemd/system/clickhouse-server.service ] && [ -d /run/systemd/system ]; then
|
|
|
|
# if old rc.d service present - remove it
|
2019-06-25 13:55:31 +00:00
|
|
|
if [ -x "/etc/init.d/clickhouse-server" ] && [ -x "/usr/sbin/update-rc.d" ]; then
|
|
|
|
/usr/sbin/update-rc.d clickhouse-server remove
|
2018-01-19 18:54:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
/bin/systemctl daemon-reload
|
|
|
|
/bin/systemctl enable clickhouse-server
|
|
|
|
else
|
|
|
|
# If you downgrading to version older than 1.1.54336 run: systemctl disable clickhouse-server
|
|
|
|
if [ -x "/etc/init.d/clickhouse-server" ]; then
|
2019-06-25 13:55:31 +00:00
|
|
|
if [ -x "/usr/sbin/update-rc.d" ]; then
|
|
|
|
/usr/sbin/update-rc.d clickhouse-server defaults 19 19 >/dev/null || exit $?
|
2018-04-16 21:03:35 +00:00
|
|
|
else
|
2021-04-11 19:07:23 +00:00
|
|
|
echo # Other OS
|
2018-04-16 21:03:35 +00:00
|
|
|
fi
|
2018-01-19 18:54:40 +00:00
|
|
|
fi
|
2017-10-11 15:00:34 +00:00
|
|
|
fi
|
2017-01-31 19:53:05 +00:00
|
|
|
fi
|