diff --git a/dist/debian/rules.mustache b/dist/debian/rules.mustache index 6a1b41f068..9053a4ba8e 100755 --- a/dist/debian/rules.mustache +++ b/dist/debian/rules.mustache @@ -17,7 +17,7 @@ override_dh_auto_clean: override_dh_auto_install: dh_auto_install - ./install.sh --root "$(CURDIR)/debian/tmp" $(install_arg) --sysconfdir "/etc/default" + ./install.sh --packaging --root "$(CURDIR)/debian/tmp" $(install_arg) --sysconfdir "/etc/default" # don't use default sysconfig file, use Debian version cp dist/debian/sysconfig/scylla-housekeeping $(CURDIR)/debian/tmp/etc/default/ diff --git a/dist/redhat/scylla.spec.mustache b/dist/redhat/scylla.spec.mustache index 5a3da5b9a5..7d9c6ad672 100644 --- a/dist/redhat/scylla.spec.mustache +++ b/dist/redhat/scylla.spec.mustache @@ -68,7 +68,7 @@ defines=() {{#housekeeping}} install_arg="--housekeeping" {{/housekeeping}} -./install.sh --root "$RPM_BUILD_ROOT" $install_arg +./install.sh --packaging --root "$RPM_BUILD_ROOT" $install_arg %pre server getent group scylla || /usr/sbin/groupadd scylla 2> /dev/null || : diff --git a/install.sh b/install.sh index 6dce6b1eb8..a64b74fedf 100755 --- a/install.sh +++ b/install.sh @@ -33,6 +33,7 @@ Options: --housekeeping enable housekeeping service --nonroot install Scylla without required root priviledge --sysconfdir /etc/sysconfig specify sysconfig directory name + --packaging use install.sh for packaging --help this helpful message EOF exit 1 @@ -43,6 +44,7 @@ housekeeping=false python3=/opt/scylladb/python3/bin/python3 sysconfdir=/etc/sysconfig nonroot=false +packaging=false while [ $# -gt 0 ]; do case "$1" in @@ -70,6 +72,10 @@ while [ $# -gt 0 ]; do sysconfdir="$2" shift 2 ;; + "--packaging") + packaging=true + shift 1 + ;; "--help") shift 1 print_usage @@ -321,4 +327,33 @@ if $nonroot; then touch $rprefix/SCYLLA-NONROOT-FILE systemctl --user daemon-reload echo "Scylla non-root install completed." +elif ! $packaging; then + nousr= + nogrp= + getent passwd scylla || nousr=1 + getent group scylla || nogrp=1 + + # this handles both case group is not exist || group already exists + if [ $nousr ]; then + adduser --system \ + --quiet \ + --home /var/lib/scylla \ + --no-create-home \ + --disabled-password \ + --group scylla + # only group is not exist, create it and add user to the group + elif [ $nogrp ]; then + addgroup --system scylla + adduser scylla scylla + fi + chown -R scylla:scylla $rdata + chown -R scylla:scylla $rhkdata + + grep -v api_ui_dir /etc/scylla/scylla.yaml | grep -v api_doc_dir > /tmp/scylla.yaml + echo "api_ui_dir: /opt/scylladb/swagger-ui/dist/" >> /tmp/scylla.yaml + echo "api_doc_dir: /opt/scylladb/api/api-doc/" >> /tmp/scylla.yaml + mv /tmp/scylla.yaml /etc/scylla/scylla.yaml + + + $rprefix/scripts/scylla_post_install.sh fi