rpm: set proper permissions for /var/lib/sftpgo and /srv/sftpgo

it seems we have to check the permissions after each update,
probably because nfpm defines these dirs as empty folders
This commit is contained in:
Nicola Murino 2020-10-15 10:01:31 +02:00
parent 555394b95e
commit f884447b26
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB
3 changed files with 17 additions and 17 deletions

View file

@ -29,14 +29,13 @@ if [ "$1" = "configure" ]; then
echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
fi
# check permissions for /srv/sftpgo and adjust them if needed
# we added /srv/sftpgo after 1.1.0, we should check if we are upgrading
# from this version but a non-recursive chmod/chown shouldn't hurt
if [ -d /srv/sftpgo ]; then
if [ $(stat -c '%U' /srv/sftpgo) != sftpgo ]; then
echo "Set permissions for /srv/sftpgo"
chown -R sftpgo:sftpgo /srv/sftpgo
chmod 750 /srv/sftpgo
fi
chown sftpgo:sftpgo /srv/sftpgo
chmod 750 /srv/sftpgo
fi
fi
#DEBHELPER#

View file

@ -29,14 +29,13 @@ if [ "$1" = "configure" ]; then
echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
fi
# check permissions for /srv/sftpgo and adjust them if needed
# we added /srv/sftpgo after 1.1.0, we should check if we are upgrading
# from this version but a non-recursive chmod/chown shouldn't hurt
if [ -d /srv/sftpgo ]; then
if [ $(stat -c '%U' /srv/sftpgo) != sftpgo ]; then
echo "Set permissions for /srv/sftpgo"
chown -R sftpgo:sftpgo /srv/sftpgo
chmod 750 /srv/sftpgo
fi
chown sftpgo:sftpgo /srv/sftpgo
chmod 750 /srv/sftpgo
fi
fi
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then

View file

@ -22,13 +22,15 @@ if [ $1 -eq 1 ]; then
/bin/echo "Please be sure to have the python requests library installed if you want to use the REST API CLI"
fi
# check permissions for /srv/sftpgo and adjust them if needed
# adjust permissions for /srv/sftpgo and /var/lib/sftpgo
if [ -d /srv/sftpgo ]; then
if [ $(/usr/bin/stat -c '%U' /srv/sftpgo) != sftpgo ]; then
/bin/echo "Set permissions for /srv/sftpgo"
/usr/bin/chown -R sftpgo:sftpgo /srv/sftpgo
/usr/bin/chown sftpgo:sftpgo /srv/sftpgo
/usr/bin/chmod 750 /srv/sftpgo
fi
fi
if [ -d /var/lib/sftpgo ]; then
/usr/bin/chown sftpgo:sftpgo /var/lib/sftpgo
/usr/bin/chmod 750 /var/lib/sftpgo
fi
# reload to pick up any changes to systemd files