[#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 <evgeniy@morphbits.ru>
This commit is contained in:
Dmitriy Zabolotskiy 2022-11-07 14:45:47 +03:00 committed by fyrchik
parent 660c38d07e
commit 98e6dc5ce8
4 changed files with 17 additions and 5 deletions

View file

@ -21,9 +21,12 @@ case "$1" in
USERNAME=ir 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 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 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 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 fi
USERDIR=$(getent passwd "neofs-$USERNAME" | cut -d: -f6) USERDIR=$(getent passwd "neofs-$USERNAME" | cut -d: -f6)
if ! dpkg-statoverride --list neofs-$USERDIR >/dev/null; then if ! dpkg-statoverride --list neofs-$USERDIR >/dev/null; then

View file

@ -1,2 +1,3 @@
/etc/neofs/storage /etc/neofs/storage
/srv/neofs /srv/neofs
/var/lib/neofs/storage

View file

@ -19,15 +19,23 @@ set -e
case "$1" in case "$1" in
configure) configure)
USERNAME=storage 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 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 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 fi
USERDIR=$(getent passwd "neofs-$USERNAME" | cut -d: -f6) USERDIR=$(getent passwd "neofs-$USERNAME" | cut -d: -f6)
if ! dpkg-statoverride --list neofs-$USERDIR >/dev/null; then if ! dpkg-statoverride --list neofs-$USERDIR >/dev/null; then
chown -f neofs-$USERNAME: $USERDIR chown -f neofs-$USERNAME: $USERDIR
fi 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) abort-upgrade|abort-remove|abort-deconfigure)

View file

@ -20,7 +20,7 @@ set -e
case "$1" in case "$1" in
purge) purge)
rm -rf /srv/neofs/* rm -rf /var/lib/neofs/storage/*
;; ;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)