#!/bin/bash # # Copyright (C) 2018 ScyllaDB # # # This file is part of Scylla. # # Scylla is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Scylla is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Scylla. If not, see . # set -e print_usage() { cat < "$root/$prefix/bin/$bin" < "$retc"/systemd/system/scylla-server.service.d/sysconfdir.conf [Service] EnvironmentFile= EnvironmentFile=$sysconfdir/scylla-server EnvironmentFile=/etc/scylla.d/*.conf EOS for i in daily restart; do install -d -m755 "$retc"/systemd/system/scylla-housekeeping-$i.service.d cat << EOS > "$retc"/systemd/system/scylla-housekeeping-$i.service.d/sysconfdir.conf [Service] EnvironmentFile= EnvironmentFile=$sysconfdir/scylla-housekeeping EOS done fi install -m755 -d "$retc/security/limits.d" install -m755 -d "$rusr/bin" install -m755 -d "$rhkdata" install -m644 dist/common/limits.d/scylla.conf -Dt "$retc"/security/limits.d ln -srf "$rprefix/bin/scylla" "$rusr/bin/scylla" ln -srf "$rprefix/bin/iotune" "$rusr/bin/iotune" ln -srf "$rprefix/bin/scyllatop" "$rusr/bin/scyllatop" install -d "$rusr"/sbin for i in $SBINFILES; do ln -srf "$rprefix/scripts/$i" "$rusr/sbin/$i" done else install -m755 -d "$rdata"/saved_caches install -d -m755 "$retc"/systemd/system/scylla-server.service.d cat << EOS > "$retc"/systemd/system/scylla-server.service.d/nonroot.conf [Service] EnvironmentFile= EnvironmentFile=$rsysconfdir/scylla-server EnvironmentFile=$retc/scylla.d/*.conf ExecStartPre= ExecStart= ExecStart=$rprefix/bin/scylla \$SCYLLA_ARGS \$SEASTAR_IO \$DEV_MODE \$CPUSET ExecStopPost= User= EOS install -d -m755 "$retc"/systemd/system/node-exporter.service.d cat << EOS > "$retc"/systemd/system/node-exporter.service.d/nonroot.conf [Service] ExecStart= ExecStart=$rprefix/bin/node_exporter --collector.interrupts User= Group= EOS install -d "$rprefix"/sbin for i in $SBINFILES; do ln -srf "$rprefix/scripts/$i" "$rprefix/sbin/$i" done if [ ! -d ~/.config/systemd/user/scylla-server.service.d ]; then mkdir -p ~/.config/systemd/user/scylla-server.service.d fi ln -srf $rsystemd/scylla-server.service ~/.config/systemd/user/ ln -srf "$retc"/systemd/system/scylla-server.service.d/nonroot.conf ~/.config/systemd/user/scylla-server.service.d if [ ! -d ~/.config/systemd/user/node-exporter.service.d ]; then mkdir -p ~/.config/systemd/user/node-exporter.service.d fi ln -srf $rsystemd/node-exporter.service ~/.config/systemd/user/ ln -srf "$retc"/systemd/system/node-exporter.service.d/nonroot.conf ~/.config/systemd/user/node-exporter.service.d fi install -m755 scylla-gdb.py -Dt "$rprefix"/scripts/ PYSCRIPTS=$(find dist/common/scripts/ -maxdepth 1 -type f -exec grep -Pls '\A#!/usr/bin/env python3' {} +) for i in $PYSCRIPTS; do ./relocate_python_scripts.py \ --installroot $rprefix/scripts/ --with-python3 "$rpython3" $i done ./relocate_python_scripts.py \ --installroot $rprefix/scripts/ --with-python3 "$rpython3" \ seastar/scripts/perftune.py seastar/scripts/seastar-addr2line seastar/scripts/perftune.py ./relocate_python_scripts.py \ --installroot $rprefix/scyllatop/ --with-python3 "$rpython3" \ tools/scyllatop/scyllatop.py fi if $nonroot; then sed -i -e "s#/var/lib/scylla#$rprefix#g" $retc/scylla/scylla.yaml sed -i -e "s/^# hints_directory/hints_directory/" $retc/scylla/scylla.yaml sed -i -e "s/^# view_hints_directory/view_hints_directory/" $retc/scylla/scylla.yaml sed -i -e "s/^# saved_caches_directory/saved_caches_directory/" $retc/scylla/scylla.yaml sed -i -e "s#/var/lib/scylla#$rprefix#g" $rsysconfdir/scylla-server sed -i -e "s#/etc/scylla#$retc/scylla#g" $rsysconfdir/scylla-server touch $rprefix/SCYLLA-NONROOT-FILE systemctl --user daemon-reload echo "Scylla non-root install completed." fi