浏览代码

Linux pkgs: move data directory to /srv/sftpgo

Nicola Murino 4 年之前
父节点
当前提交
555394b95e

+ 1 - 1
docker/sftpgo/alpine/README.md

@@ -1,6 +1,6 @@
 # SFTPGo with Docker and Alpine
 # SFTPGo with Docker and Alpine
 
 
-:warning: The recommended way to run SFTPGo on Docker is to use the official [images](https://github.com/users/drakkan/packages/container/package/sftpgo). The documentation here is now obsolete.
+:warning: The recommended way to run SFTPGo on Docker is to use the official [images](https://hub.docker.com/r/drakkan/sftpgo). The documentation here is now obsolete.
 
 
 This DockerFile is made to build image to host multiple instances of SFTPGo started with different users.
 This DockerFile is made to build image to host multiple instances of SFTPGo started with different users.
 
 

+ 1 - 1
docker/sftpgo/debian/README.md

@@ -1,6 +1,6 @@
 # Dockerfile based on Debian stable
 # Dockerfile based on Debian stable
 
 
-:warning: The recommended way to run SFTPGo on Docker is to use the official [images](https://github.com/users/drakkan/packages/container/package/sftpgo). The documentation here is now obsolete.
+:warning: The recommended way to run SFTPGo on Docker is to use the official [images](https://hub.docker.com/r/drakkan/sftpgo). The documentation here is now obsolete.
 
 
 Please read the comments inside the `Dockerfile` to learn how to customize things for your setup.
 Please read the comments inside the `Dockerfile` to learn how to customize things for your setup.
 
 

+ 1 - 1
pkgs/build.sh

@@ -61,7 +61,7 @@ config_files:
 
 
 empty_folders:
 empty_folders:
   - /var/lib/sftpgo
   - /var/lib/sftpgo
-  - /srv/sftpgo/data
+  - /srv/sftpgo
 
 
 overrides:
 overrides:
   deb:
   deb:

+ 10 - 1
pkgs/debian/postinst

@@ -28,6 +28,15 @@ if [ "$1" = "configure" ]; then
     chmod 640 /etc/sftpgo/sftpgo.json
     chmod 640 /etc/sftpgo/sftpgo.json
     echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
     echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
   fi
   fi
+
+  # check permissions for /srv/sftpgo and adjust them if needed
+  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
+  fi
 fi
 fi
 
 
-#DEBHELPER#
+#DEBHELPER#

+ 9 - 0
pkgs/scripts/deb/postinstall.sh

@@ -28,6 +28,15 @@ if [ "$1" = "configure" ]; then
     chmod 640 /etc/sftpgo/sftpgo.json
     chmod 640 /etc/sftpgo/sftpgo.json
 	  echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
 	  echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
   fi
   fi
+
+  # check permissions for /srv/sftpgo and adjust them if needed
+  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
+  fi
 fi
 fi
 
 
 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then

+ 1 - 0
pkgs/scripts/deb/postremove.sh

@@ -15,4 +15,5 @@ if [ "$1" = "purge" ]; then
 	if [ -x "/usr/bin/deb-systemd-helper" ]; then
 	if [ -x "/usr/bin/deb-systemd-helper" ]; then
 		deb-systemd-helper purge 'sftpgo.service' >/dev/null || true
 		deb-systemd-helper purge 'sftpgo.service' >/dev/null || true
 		deb-systemd-helper unmask 'sftpgo.service' >/dev/null || true
 		deb-systemd-helper unmask 'sftpgo.service' >/dev/null || true
+	fi
 fi
 fi

+ 11 - 1
pkgs/scripts/rpm/postinstall

@@ -19,7 +19,17 @@ if [ $1 -eq 1 ]; then
   /usr/bin/chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
   /usr/bin/chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
   /usr/bin/chmod 750 /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
   /usr/bin/chmod 750 /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
   /usr/bin/chmod 640 /etc/sftpgo/sftpgo.json
   /usr/bin/chmod 640 /etc/sftpgo/sftpgo.json
-  echo "Please be sure to have the python requests library installed if you want to use the REST API CLI"
+  /bin/echo "Please be sure to have the python requests library installed if you want to use the REST API CLI"
 fi
 fi
+
+# check permissions for /srv/sftpgo and adjust them if needed
+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/chmod 750 /srv/sftpgo
+  fi
+fi
+
 # reload to pick up any changes to systemd files
 # reload to pick up any changes to systemd files
 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 /bin/systemctl daemon-reload >/dev/null 2>&1 || :