diff --git a/README.md b/README.md index d7d5390d..61aef064 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Some Linux distro packages are available: - [sftpgo-bin](https://aur.archlinux.org/packages/sftpgo-bin/). This package follows stable releases downloading the prebuilt linux binary from GitHub. It does not require `git`, `gcc` and `go` to build. - [sftpgo-git](https://aur.archlinux.org/packages/sftpgo-git/). This package builds and installs the latest git master. It requires `git`, `gcc` and `go` to build. - Deb and RPM packages are built after each commit and for each release. -- An Ubuntu PPA is available [here](https://launchpad.net/~sftpgo/+archive/ubuntu/sftpgo). +- For Ubuntu a PPA is available [here](https://launchpad.net/~sftpgo/+archive/ubuntu/sftpgo). You can easily test new features selecting a commit from the [Actions](https://github.com/drakkan/sftpgo/actions) page and downloading the matching build artifacts for Linux, macOS or Windows. GitHub stores artifacts for 90 days. diff --git a/pkgs/debian/changelog b/pkgs/debian/changelog new file mode 100644 index 00000000..452b43cc --- /dev/null +++ b/pkgs/debian/changelog @@ -0,0 +1,11 @@ +sftpgo (1.0.1-dev.105-1ppa1) bionic; urgency=medium + + * New upstream release. + + -- Nicola Murino Thu, 08 Oct 2020 16:36:55 +0200 + +sftpgo (1.0.1-dev.102-1ppa1) bionic; urgency=medium + + * Initial release + + -- Nicola Murino Thu, 08 Oct 2020 13:15:04 +0200 diff --git a/pkgs/debian/compat b/pkgs/debian/compat new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/pkgs/debian/compat @@ -0,0 +1 @@ +10 diff --git a/pkgs/debian/control b/pkgs/debian/control new file mode 100644 index 00000000..fff1ee6e --- /dev/null +++ b/pkgs/debian/control @@ -0,0 +1,17 @@ +Source: sftpgo +Section: net +Priority: optional +Maintainer: Nicola Murino +Build-Depends: debhelper (>= 10) +Standards-Version: 4.1.2 +Homepage: https://github.com/drakkan/sftpgo +Vcs-Git: https://github.com/drakkan/sftpgo.git + +Package: sftpgo +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: bash-completion, python3-requests, python3-pygments +Description: Fully featured and highly configurable SFTP server + SFTPGo has optional FTP/S and WebDAV support. + It can serve local filesystem, S3 (Compatible) Object Storages + and Google Cloud Storage diff --git a/pkgs/debian/copyright b/pkgs/debian/copyright new file mode 100644 index 00000000..6aec9f68 --- /dev/null +++ b/pkgs/debian/copyright @@ -0,0 +1,11 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: SFTPGo +Source: https://github.com/drakkan/sftpgo/releases + +Files: * +Copyright: 2019-2020 Nicola Murino +License: GPL-3 + +License: GPL-3 + On Debian systems, the complete text of the GNU General Public License + version 3 can be found in `/usr/share/common-licenses/GPL- diff --git a/pkgs/debian/patches/config.diff b/pkgs/debian/patches/config.diff new file mode 100644 index 00000000..7742a790 --- /dev/null +++ b/pkgs/debian/patches/config.diff @@ -0,0 +1,43 @@ +Index: sftpgo/sftpgo.json +=================================================================== +--- sftpgo.orig/sftpgo.json ++++ sftpgo/sftpgo.json +@@ -69,7 +69,7 @@ + }, + "data_provider": { + "driver": "sqlite", +- "name": "sftpgo.db", ++ "name": "/var/lib/sftpgo/sftpgo.db", + "host": "", + "port": 5432, + "username": "", +@@ -80,14 +80,14 @@ + "manage_users": 1, + "track_quota": 2, + "pool_size": 0, +- "users_base_dir": "", ++ "users_base_dir": "/var/lib/sftpgo/users", + "actions": { + "execute_on": [], + "hook": "" + }, + "external_auth_hook": "", + "external_auth_scope": 0, +- "credentials_path": "credentials", ++ "credentials_path": "/var/lib/sftpgo/credentials", + "pre_login_hook": "", + "post_login_hook": "", + "post_login_scope": 0, +@@ -105,9 +105,9 @@ + "httpd": { + "bind_port": 8080, + "bind_address": "127.0.0.1", +- "templates_path": "templates", +- "static_files_path": "static", +- "backups_path": "backups", ++ "templates_path": "/usr/share/sftpgo/templates", ++ "static_files_path": "/usr/share/sftpgo/static", ++ "backups_path": "/var/lib/sftpgo/backups", + "auth_user_file": "", + "certificate_file": "", + "certificate_key_file": "" diff --git a/pkgs/debian/patches/series b/pkgs/debian/patches/series new file mode 100644 index 00000000..8d319f27 --- /dev/null +++ b/pkgs/debian/patches/series @@ -0,0 +1 @@ +config.diff diff --git a/pkgs/debian/postinst b/pkgs/debian/postinst new file mode 100644 index 00000000..da19af71 --- /dev/null +++ b/pkgs/debian/postinst @@ -0,0 +1,53 @@ +#!/bin/sh +set -e + +if [ "$1" = "configure" ]; then + # Add user and group + if ! getent group sftpgo >/dev/null; then + groupadd --system sftpgo + fi + if ! getent passwd sftpgo >/dev/null; then + useradd --system \ + --gid sftpgo \ + --no-create-home \ + --home-dir /var/lib/sftpgo \ + --shell /usr/sbin/nologin \ + --comment "SFTPGo user" \ + sftpgo + fi + + if [ -z "$2" ]; then + # 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 + 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 diff --git a/pkgs/debian/postrm b/pkgs/debian/postrm new file mode 100644 index 00000000..41558184 --- /dev/null +++ b/pkgs/debian/postrm @@ -0,0 +1,19 @@ +#!/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 diff --git a/pkgs/debian/prerm b/pkgs/debian/prerm new file mode 100644 index 00000000..a60145f2 --- /dev/null +++ b/pkgs/debian/prerm @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +if [ -d /run/systemd/system ] && [ "$1" = remove ]; then + deb-systemd-invoke stop sftpgo.service >/dev/null || true +fi diff --git a/pkgs/debian/rules b/pkgs/debian/rules new file mode 100755 index 00000000..12b6d47d --- /dev/null +++ b/pkgs/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +export DH_VERBOSE = 1 + +%: + dh $@ diff --git a/pkgs/debian/sftpgo-docs.docs b/pkgs/debian/sftpgo-docs.docs new file mode 100644 index 00000000..e69de29b diff --git a/pkgs/debian/sftpgo.dirs b/pkgs/debian/sftpgo.dirs new file mode 100644 index 00000000..c9cf0829 --- /dev/null +++ b/pkgs/debian/sftpgo.dirs @@ -0,0 +1 @@ +/var/lib/sftpgo diff --git a/pkgs/debian/sftpgo.install b/pkgs/debian/sftpgo.install new file mode 100644 index 00000000..9aeeaf77 --- /dev/null +++ b/pkgs/debian/sftpgo.install @@ -0,0 +1,8 @@ +sftpgo usr/bin +examples/rest-api-cli/sftpgo_api_cli usr/bin +sftpgo.json etc/sftpgo +init/sftpgo.service lib/systemd/system +bash_completion/sftpgo usr/share/bash-completion/completions +man/man1/* usr/share/man/man1 +templates usr/share/sftpgo +static usr/share/sftpgo diff --git a/pkgs/debian/source/format b/pkgs/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/pkgs/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt)