From e3a381d5a128ba0fc94130ae76ca14cfcb644d95 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Mon, 5 Oct 2020 18:15:19 +0900 Subject: [PATCH] install.sh: show warning nonroot mode when systemd does not support user mode On older distribution such as CentOS7, it does not support systemd user mode. On such distribution nonroot mode does not work, show warning message and skip running systemctl --user. See scylladb/scylla#7071 --- install.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 2d1fa9e..fca2ef6 100755 --- a/install.sh +++ b/install.sh @@ -74,6 +74,11 @@ while [ $# -gt 0 ]; do esac done +check_usermode_support() { + user=$(systemctl --help|grep -e '--user') + [ -n "$user" ] +} + if ! $packaging; then has_java=false if [ -x /usr/bin/java ]; then @@ -151,7 +156,9 @@ if $nonroot; then sed -i -e "s#/var/lib/scylla#$rprefix#g" "$rsysconfdir"/scylla-jmx sed -i -e "s#/etc/scylla#$rprefix/etc/scylla#g" "$rsysconfdir"/scylla-jmx sed -i -e "s#/opt/scylladb/jmx#$rprefix/jmx#g" "$rsysconfdir"/scylla-jmx - systemctl --user daemon-reload + if check_usermode_support; then + systemctl --user daemon-reload + fi echo "Scylla-JMX non-root install completed." elif ! $packaging; then systemctl --system daemon-reload