2020-09-26 12:07:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-10-29 06:15:14 +00:00
|
|
|
NFPM_VERSION=2.34.0
|
2020-11-07 18:29:16 +00:00
|
|
|
NFPM_ARCH=${NFPM_ARCH:-amd64}
|
2020-09-26 12:07:24 +00:00
|
|
|
if [ -z ${SFTPGO_VERSION} ]
|
|
|
|
then
|
|
|
|
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
|
|
|
NUM_COMMITS_FROM_TAG=$(git rev-list ${LATEST_TAG}.. --count)
|
|
|
|
VERSION=$(echo "${LATEST_TAG}" | awk -F. -v OFS=. '{$NF++;print}')-dev.${NUM_COMMITS_FROM_TAG}
|
|
|
|
else
|
|
|
|
VERSION=${SFTPGO_VERSION}
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir dist
|
|
|
|
echo -n ${VERSION} > dist/version
|
|
|
|
cd dist
|
|
|
|
BASE_DIR="../.."
|
|
|
|
|
2021-04-07 13:12:09 +00:00
|
|
|
if [ -f "${BASE_DIR}/output/bash_completion/sftpgo" ]
|
|
|
|
then
|
|
|
|
cp ${BASE_DIR}/output/bash_completion/sftpgo sftpgo-completion.bash
|
|
|
|
else
|
|
|
|
$BASE_DIR/sftpgo gen completion bash > sftpgo-completion.bash
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "${BASE_DIR}/output/man/man1" ]
|
|
|
|
then
|
|
|
|
cp -r ${BASE_DIR}/output/man/man1 .
|
|
|
|
else
|
|
|
|
$BASE_DIR/sftpgo gen man -d man1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f ${BASE_DIR}/sftpgo ]
|
|
|
|
then
|
|
|
|
cp ${BASE_DIR}/output/sftpgo ${BASE_DIR}/sftpgo
|
|
|
|
chmod 755 ${BASE_DIR}/sftpgo
|
|
|
|
fi
|
|
|
|
|
2020-09-28 10:51:19 +00:00
|
|
|
cp ${BASE_DIR}/sftpgo.json .
|
2020-10-06 16:03:55 +00:00
|
|
|
sed -i "s|sftpgo.db|/var/lib/sftpgo/sftpgo.db|" sftpgo.json
|
2020-10-14 05:46:36 +00:00
|
|
|
sed -i "s|\"users_base_dir\": \"\",|\"users_base_dir\": \"/srv/sftpgo/data\",|" sftpgo.json
|
|
|
|
sed -i "s|\"backups\"|\"/srv/sftpgo/backups\"|" sftpgo.json
|
2022-05-27 05:39:55 +00:00
|
|
|
sed -i "s|\"certs\"|\"/var/lib/sftpgo/certs\"|" sftpgo.json
|
2020-10-06 16:03:55 +00:00
|
|
|
|
2020-09-26 12:07:24 +00:00
|
|
|
cat >nfpm.yaml <<EOF
|
|
|
|
name: "sftpgo"
|
2020-11-07 18:29:16 +00:00
|
|
|
arch: "${NFPM_ARCH}"
|
2020-09-26 12:07:24 +00:00
|
|
|
platform: "linux"
|
|
|
|
version: ${VERSION}
|
|
|
|
release: 1
|
2020-11-07 18:29:16 +00:00
|
|
|
section: "net"
|
2020-11-14 12:54:14 +00:00
|
|
|
priority: "optional"
|
2020-09-26 12:07:24 +00:00
|
|
|
maintainer: "Nicola Murino <nicola.murino@gmail.com>"
|
|
|
|
description: |
|
2020-10-08 14:02:04 +00:00
|
|
|
Fully featured and highly configurable SFTP server
|
2021-11-29 16:58:10 +00:00
|
|
|
SFTPGo has optional HTTP, FTP/S and WebDAV support.
|
2020-10-25 07:18:48 +00:00
|
|
|
It can serve local filesystem, S3 (Compatible) Object Storage,
|
2021-02-06 11:23:26 +00:00
|
|
|
Google Cloud Storage, Azure Blob Storage, SFTP.
|
2020-09-26 12:07:24 +00:00
|
|
|
vendor: "SFTPGo"
|
|
|
|
homepage: "https://github.com/drakkan/sftpgo"
|
2021-02-26 18:47:48 +00:00
|
|
|
license: "AGPL-3.0"
|
2020-12-26 18:14:12 +00:00
|
|
|
provides:
|
|
|
|
- sftpgo
|
|
|
|
contents:
|
|
|
|
- src: "${BASE_DIR}/sftpgo${BIN_SUFFIX}"
|
|
|
|
dst: "/usr/bin/sftpgo"
|
|
|
|
|
|
|
|
- src: "./sftpgo-completion.bash"
|
|
|
|
dst: "/usr/share/bash-completion/completions/sftpgo"
|
|
|
|
|
|
|
|
- src: "./man1/*"
|
|
|
|
dst: "/usr/share/man/man1/"
|
|
|
|
|
|
|
|
- src: "${BASE_DIR}/init/sftpgo.service"
|
|
|
|
dst: "/lib/systemd/system/sftpgo.service"
|
|
|
|
|
|
|
|
- src: "${BASE_DIR}/templates/*"
|
2022-11-20 14:23:45 +00:00
|
|
|
dst: "/usr/share/sftpgo/templates"
|
2020-12-26 18:14:12 +00:00
|
|
|
|
2021-06-14 12:18:15 +00:00
|
|
|
- src: "${BASE_DIR}/static/*"
|
2022-11-20 14:23:45 +00:00
|
|
|
dst: "/usr/share/sftpgo/static"
|
2020-12-26 18:14:12 +00:00
|
|
|
|
2021-11-21 08:32:51 +00:00
|
|
|
- src: "${BASE_DIR}/openapi/*"
|
2022-11-20 14:23:45 +00:00
|
|
|
dst: "/usr/share/sftpgo/openapi"
|
2021-11-21 08:32:51 +00:00
|
|
|
|
2020-12-26 18:14:12 +00:00
|
|
|
- src: "./sftpgo.json"
|
|
|
|
dst: "/etc/sftpgo/sftpgo.json"
|
|
|
|
type: "config|noreplace"
|
|
|
|
|
2021-11-14 15:23:33 +00:00
|
|
|
- dst: "/srv/sftpgo"
|
|
|
|
type: dir
|
2020-09-26 12:07:24 +00:00
|
|
|
|
2021-11-14 15:23:33 +00:00
|
|
|
- dst: "/var/lib/sftpgo"
|
|
|
|
type: dir
|
2020-09-26 12:07:24 +00:00
|
|
|
|
2022-10-13 16:43:58 +00:00
|
|
|
- dst: "/etc/sftpgo/env.d"
|
|
|
|
type: dir
|
|
|
|
|
2020-09-26 12:07:24 +00:00
|
|
|
overrides:
|
|
|
|
deb:
|
|
|
|
recommends:
|
|
|
|
- bash-completion
|
2020-11-14 08:10:45 +00:00
|
|
|
- mime-support
|
2020-09-26 12:07:24 +00:00
|
|
|
scripts:
|
|
|
|
postinstall: ../scripts/deb/postinstall.sh
|
|
|
|
preremove: ../scripts/deb/preremove.sh
|
|
|
|
postremove: ../scripts/deb/postremove.sh
|
|
|
|
rpm:
|
|
|
|
recommends:
|
|
|
|
- bash-completion
|
2020-10-11 14:23:50 +00:00
|
|
|
- mailcap
|
2020-09-26 12:07:24 +00:00
|
|
|
scripts:
|
|
|
|
postinstall: ../scripts/rpm/postinstall
|
|
|
|
preremove: ../scripts/rpm/preremove
|
|
|
|
postremove: ../scripts/rpm/postremove
|
|
|
|
|
|
|
|
rpm:
|
2021-10-13 07:15:04 +00:00
|
|
|
compression: xz
|
|
|
|
|
|
|
|
deb:
|
|
|
|
compression: xz
|
2020-09-26 12:07:24 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
curl --retry 5 --retry-delay 2 --connect-timeout 10 -L -O \
|
|
|
|
https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz
|
2020-11-04 18:11:40 +00:00
|
|
|
tar xvf nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz nfpm
|
2020-09-26 12:07:24 +00:00
|
|
|
chmod 755 nfpm
|
2020-11-14 08:10:45 +00:00
|
|
|
mkdir rpm
|
|
|
|
./nfpm -f nfpm.yaml pkg -p rpm -t rpm
|
2020-09-26 12:07:24 +00:00
|
|
|
mkdir deb
|
|
|
|
./nfpm -f nfpm.yaml pkg -p deb -t deb
|