From 98e6dc5ce8077eee8b1d97f1efb8bdeee5b2ce3f Mon Sep 17 00:00:00 2001 From: Dmitriy Zabolotskiy Date: Mon, 7 Nov 2022 14:45:47 +0300 Subject: [PATCH] [#409] debian: Refactor storage service paths Separate User data and Service data: - /var/lib/neofs/storage for service persistence - /srv/neofs for user data Signed-off-by: Evgenii Stratonikov --- debian/neofs-ir.postinst | 7 +++++-- debian/neofs-storage.dirs | 1 + debian/neofs-storage.postinst | 12 ++++++++++-- debian/neofs-storage.postrm | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/debian/neofs-ir.postinst b/debian/neofs-ir.postinst index 76c2f7c3fd..f8ad5ea9cb 100644 --- a/debian/neofs-ir.postinst +++ b/debian/neofs-ir.postinst @@ -21,9 +21,12 @@ case "$1" in USERNAME=ir id -u neofs-ir >/dev/null 2>&1 || useradd -s /usr/sbin/nologin -d /var/lib/neofs/ir --system -M -U -c "NeoFS InnerRing node" neofs-ir if ! dpkg-statoverride --list /etc/neofs/$USERNAME >/dev/null; then - chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME/* + chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME chmod -f 0750 /etc/neofs/$USERNAME - + chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME/config.yml + chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME/control.yml + chmod -f 0640 /etc/neofs/$USERNAME/config.yml || true + chmod -f 0640 /etc/neofs/$USERNAME/control.yml || true fi USERDIR=$(getent passwd "neofs-$USERNAME" | cut -d: -f6) if ! dpkg-statoverride --list neofs-$USERDIR >/dev/null; then diff --git a/debian/neofs-storage.dirs b/debian/neofs-storage.dirs index 8a686a9862..39bc449bc0 100644 --- a/debian/neofs-storage.dirs +++ b/debian/neofs-storage.dirs @@ -1,2 +1,3 @@ /etc/neofs/storage /srv/neofs +/var/lib/neofs/storage diff --git a/debian/neofs-storage.postinst b/debian/neofs-storage.postinst index a8257e93eb..a0a2de9652 100644 --- a/debian/neofs-storage.postinst +++ b/debian/neofs-storage.postinst @@ -19,15 +19,23 @@ set -e case "$1" in configure) USERNAME=storage - id -u neofs-storage >/dev/null 2>&1 || useradd -s /usr/sbin/nologin -d /srv/neofs --system -M -U -c "NeoFS Storage node" neofs-storage + id -u neofs-$USERNAME >/dev/null 2>&1 || useradd -s /usr/sbin/nologin -d /var/lib/neofs/$USERNAME --system -M -U -c "NeoFS Storage node" neofs-$USERNAME if ! dpkg-statoverride --list /etc/neofs/$USERNAME >/dev/null; then - chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME/* + chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME chmod -f 0750 /etc/neofs/$USERNAME + chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME/config.yml + chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME/control.yml + chmod -f 0640 /etc/neofs/$USERNAME/config.yml || true + chmod -f 0640 /etc/neofs/$USERNAME/control.yml || true fi USERDIR=$(getent passwd "neofs-$USERNAME" | cut -d: -f6) if ! dpkg-statoverride --list neofs-$USERDIR >/dev/null; then chown -f neofs-$USERNAME: $USERDIR fi + USERDIR=/srv/neofs + if ! dpkg-statoverride --list neofs-$USERDIR >/dev/null; then + chown -f neofs-$USERNAME: $USERDIR + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/neofs-storage.postrm b/debian/neofs-storage.postrm index 244ca7483b..e5a432858e 100644 --- a/debian/neofs-storage.postrm +++ b/debian/neofs-storage.postrm @@ -20,7 +20,7 @@ set -e case "$1" in purge) - rm -rf /srv/neofs/* + rm -rf /var/lib/neofs/storage/* ;; remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)