mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-09 08:15:13 +03:00
Improve docker images
This commit is contained in:
@@ -19,10 +19,10 @@ BASE_DIR="../.."
|
||||
|
||||
cp ${BASE_DIR}/sftpgo.json .
|
||||
sed -i "s|sftpgo.db|/var/lib/sftpgo/sftpgo.db|" sftpgo.json
|
||||
sed -i "s|\"users_base_dir\": \"\",|\"users_base_dir\": \"/var/lib/sftpgo/users\",|" sftpgo.json
|
||||
sed -i "s|\"users_base_dir\": \"\",|\"users_base_dir\": \"/srv/sftpgo/data\",|" sftpgo.json
|
||||
sed -i "s|\"templates\"|\"/usr/share/sftpgo/templates\"|" sftpgo.json
|
||||
sed -i "s|\"static\"|\"/usr/share/sftpgo/static\"|" sftpgo.json
|
||||
sed -i "s|\"backups\"|\"/var/lib/sftpgo/backups\"|" sftpgo.json
|
||||
sed -i "s|\"backups\"|\"/srv/sftpgo/backups\"|" sftpgo.json
|
||||
sed -i "s|\"credentials\"|\"/var/lib/sftpgo/credentials\"|" sftpgo.json
|
||||
|
||||
$BASE_DIR/sftpgo gen completion bash > sftpgo-completion.bash
|
||||
@@ -61,6 +61,7 @@ config_files:
|
||||
|
||||
empty_folders:
|
||||
- /var/lib/sftpgo
|
||||
- /srv/sftpgo/data
|
||||
|
||||
overrides:
|
||||
deb:
|
||||
|
||||
@@ -17,37 +17,17 @@ if [ "$1" = "configure" ]; then
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
# if configure has no args this is the first installation
|
||||
# for upgrades the second arg is the previously installed version
|
||||
#
|
||||
# initialize data provider
|
||||
sftpgo initprovider -c /etc/sftpgo
|
||||
# ensure files and folders have the appropriate permissions
|
||||
chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo
|
||||
chmod 750 /etc/sftpgo /var/lib/sftpgo
|
||||
chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
|
||||
chmod 750 /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
|
||||
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"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||
# This will only remove masks created by d-s-h on package removal.
|
||||
deb-systemd-helper unmask sftpgo.service >/dev/null || true
|
||||
|
||||
# was-enabled defaults to true, so new installations run enable.
|
||||
if deb-systemd-helper --quiet was-enabled sftpgo.service; then
|
||||
# Enables the unit on first installation, creates new
|
||||
# symlinks on upgrades if the unit file has changed.
|
||||
deb-systemd-helper enable sftpgo.service >/dev/null || true
|
||||
deb-systemd-invoke start sftpgo.service >/dev/null || true
|
||||
else
|
||||
# Update the statefile to add new symlinks (if any), which need to be
|
||||
# cleaned up on purge. Also remove old symlinks.
|
||||
deb-systemd-helper update-state sftpgo.service >/dev/null || true
|
||||
fi
|
||||
|
||||
# Restart only if it was already started
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
if [ -n "$2" ]; then
|
||||
deb-systemd-invoke try-restart sftpgo.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
#DEBHELPER#
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
fi
|
||||
|
||||
if [ "$1" = "remove" ]; then
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
deb-systemd-helper mask sftpgo.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "purge" ]; then
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
deb-systemd-helper purge sftpgo.service >/dev/null || true
|
||||
deb-systemd-helper unmask sftpgo.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
|
||||
deb-systemd-invoke stop sftpgo.service >/dev/null || true
|
||||
fi
|
||||
@@ -1 +1,2 @@
|
||||
/var/lib/sftpgo
|
||||
/srv/sftpgo/data
|
||||
|
||||
@@ -17,37 +17,43 @@ if [ "$1" = "configure" ]; then
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
# if configure has no args this is the first installation
|
||||
# for upgrades the second arg is the previously installed version
|
||||
#
|
||||
# initialize data provider
|
||||
sftpgo initprovider -c /etc/sftpgo
|
||||
# ensure files and folders have the appropriate permissions
|
||||
chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo
|
||||
chmod 750 /etc/sftpgo /var/lib/sftpgo
|
||||
chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
|
||||
chmod 750 /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
|
||||
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"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||
# This will only remove masks created by d-s-h on package removal.
|
||||
deb-systemd-helper unmask sftpgo.service >/dev/null || true
|
||||
# This will only remove masks created by d-s-h on package removal.
|
||||
deb-systemd-helper unmask 'sftpgo.service' >/dev/null || true
|
||||
|
||||
# was-enabled defaults to true, so new installations run enable.
|
||||
if deb-systemd-helper --quiet was-enabled sftpgo.service; then
|
||||
# Enables the unit on first installation, creates new
|
||||
# symlinks on upgrades if the unit file has changed.
|
||||
deb-systemd-helper enable sftpgo.service >/dev/null || true
|
||||
deb-systemd-invoke start sftpgo.service >/dev/null || true
|
||||
else
|
||||
# Update the statefile to add new symlinks (if any), which need to be
|
||||
# cleaned up on purge. Also remove old symlinks.
|
||||
deb-systemd-helper update-state sftpgo.service >/dev/null || true
|
||||
fi
|
||||
|
||||
# Restart only if it was already started
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
if [ -n "$2" ]; then
|
||||
deb-systemd-invoke try-restart sftpgo.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
# was-enabled defaults to true, so new installations run enable.
|
||||
if deb-systemd-helper --quiet was-enabled 'sftpgo.service'; then
|
||||
# Enables the unit on first installation, creates new
|
||||
# symlinks on upgrades if the unit file has changed.
|
||||
deb-systemd-helper enable 'sftpgo.service' >/dev/null || true
|
||||
else
|
||||
# Update the statefile to add new symlinks (if any), which need to be
|
||||
# cleaned up on purge. Also remove old symlinks.
|
||||
deb-systemd-helper update-state 'sftpgo.service' >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
if [ -n "$2" ]; then
|
||||
_dh_action=restart
|
||||
else
|
||||
_dh_action=start
|
||||
fi
|
||||
deb-systemd-invoke $_dh_action 'sftpgo.service' >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
@@ -2,18 +2,17 @@
|
||||
set -e
|
||||
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
fi
|
||||
|
||||
if [ "$1" = "remove" ]; then
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
deb-systemd-helper mask sftpgo.service >/dev/null || true
|
||||
fi
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
deb-systemd-helper mask 'sftpgo.service' >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "purge" ]; then
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
deb-systemd-helper purge sftpgo.service >/dev/null || true
|
||||
deb-systemd-helper unmask sftpgo.service >/dev/null || true
|
||||
fi
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
deb-systemd-helper purge 'sftpgo.service' >/dev/null || true
|
||||
deb-systemd-helper unmask 'sftpgo.service' >/dev/null || true
|
||||
fi
|
||||
|
||||
@@ -16,8 +16,8 @@ if [ $1 -eq 1 ]; then
|
||||
# initialize data provider
|
||||
/usr/bin/sftpgo initprovider -c /etc/sftpgo
|
||||
# ensure files and folders have the appropriate permissions
|
||||
/usr/bin/chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo
|
||||
/usr/bin/chmod 750 /etc/sftpgo /var/lib/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 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"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user