This commit is contained in:
wxybear 2024-11-20 16:25:54 -08:00 committed by GitHub
commit e445592f9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,6 +26,14 @@ if [ ! -f "/etc/debian_version" ]; then
fi
if [ "$1" = configure ] || [ -n "$not_deb_os" ]; then
# 'ii' means install and installed
# ('ic' for installed but configuration incomplete)
# If it is the first installation, we might encounter the 'ic' (configuration incomplete) status when executing the postinst script
installed=$(dpkg -l | grep -E '^ii\s+clickhouse-server\s')
# already installed, use the old "is-enabled" status
if [ -n "$installed" ]; then
status=$(systemctl is-enabled clickhouse-server 2>/dev/null)
fi
${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}"
@ -36,7 +44,10 @@ if [ "$1" = configure ] || [ -n "$not_deb_os" ]; then
fi
/bin/systemctl daemon-reload
/bin/systemctl enable clickhouse-server
# if service is not disabled, enable it
if [ $status != "disabled" ]; then
/bin/systemctl enable clickhouse-server
fi
else
# If you downgrading to version older than 1.1.54336 run: systemctl disable clickhouse-server
if [ -x "/etc/init.d/clickhouse-server" ]; then