Skip to content

Commit 3c6f0b1

Browse files
authored
add Debian packaging via MPR (#385)
* (scripts/prep.sh) prep mpr package at the same time as the arch package * (contrib/package/makedeb-mpr/) add MPR package i wanted this on my raspberry pi and i could've done it with docker but this gives me a systemd service. i haven't actually uploaded this at all --------- Signed-off-by: Beethoven <[email protected]>
1 parent 4fa7be2 commit 3c6f0b1

File tree

6 files changed

+140
-0
lines changed

6 files changed

+140
-0
lines changed

contrib/package/makedeb-mpr/PKGBUILD

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contributor: Beethoven <[email protected]>
2+
3+
4+
pkgname=copyparty
5+
pkgver=1.18.8
6+
pkgrel=1
7+
pkgdesc="File server with accelerated resumable uploads, dedup, WebDAV, FTP, TFTP, zeroconf, media indexer, thumbnails++"
8+
arch=("any")
9+
url="https://github.com/9001/${pkgname}"
10+
license=('MIT')
11+
depends=("bash" "python3" "lsof" "python3-jinja2")
12+
makedepends=("python3-wheel" "python3-setuptools" "python3-build" "python3-installer" "make" "pigz")
13+
optdepends=("ffmpeg: thumbnails for videos, images (slower) and audio, music tags"
14+
"golang-cfssl: generate TLS certificates on startup"
15+
"python3-mutagen: music tags (alternative)"
16+
"python3-pil: thumbnails for images"
17+
"python3-openssl: ftps functionality"
18+
"python3-zmq: send zeromq messages from event-hooks"
19+
"python3-argon2: hashed passwords in config"
20+
)
21+
source=("https://github.com/9001/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
22+
backup=("/etc/${pkgname}.d/init" )
23+
sha256sums=("5bbda1e67f20a4a7fc10887235dba441544642d33c6d918f8a46867cda684572")
24+
25+
build() {
26+
cd "${srcdir}/${pkgname}-${pkgver}/copyparty/web"
27+
make
28+
29+
cd "${srcdir}/${pkgname}-${pkgver}"
30+
python -m build --wheel --no-isolation
31+
}
32+
33+
package() {
34+
cd "${srcdir}/${pkgname}-${pkgver}"
35+
python -m installer --destdir="$pkgdir" dist/*.whl
36+
37+
install -dm755 "${pkgdir}/etc/${pkgname}.d"
38+
install -Dm755 "bin/prisonparty.sh" "${pkgdir}/usr/bin/prisonparty"
39+
install -Dm644 "contrib/package/makedeb-mpr/${pkgname}.conf" "${pkgdir}/etc/${pkgname}.d/init"
40+
install -Dm644 "contrib/package/makedeb-mpr/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
41+
install -Dm644 "contrib/package/makedeb-mpr/prisonparty.service" "${pkgdir}/usr/lib/systemd/system/prisonparty.service"
42+
install -Dm644 "contrib/package/makedeb-mpr/index.md" "${pkgdir}/var/lib/${pkgname}-jail/README.md"
43+
install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
44+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## import all *.conf files from the current folder (/etc/copyparty.d)
2+
% ./
3+
4+
# add additional .conf files to this folder;
5+
# see example config files for reference:
6+
# https://github.com/9001/copyparty/blob/hovudstraum/docs/example.conf
7+
# https://github.com/9001/copyparty/tree/hovudstraum/docs/copyparty.d
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# this will start `/usr/bin/copyparty-sfx.py`
2+
# and read config from `/etc/copyparty.d/*.conf`
3+
#
4+
# you probably want to:
5+
# change "User=cpp" and "/home/cpp/" to another user
6+
#
7+
# unless you add -q to disable logging, you may want to remove the
8+
# following line to allow buffering (slightly better performance):
9+
# Environment=PYTHONUNBUFFERED=x
10+
11+
[Unit]
12+
Description=copyparty file server
13+
14+
[Service]
15+
Type=notify
16+
SyslogIdentifier=copyparty
17+
Environment=PYTHONUNBUFFERED=x
18+
WorkingDirectory=/var/lib/copyparty-jail
19+
ExecReload=/bin/kill -s USR1 $MAINPID
20+
21+
# user to run as + where the TLS certificate is (if any)
22+
User=cpp
23+
Environment=XDG_CONFIG_HOME=/home/cpp/.config
24+
25+
# stop systemd-tmpfiles-clean.timer from deleting copyparty while it's running
26+
ExecStartPre=+/bin/bash -c 'mkdir -p /run/tmpfiles.d/ && echo "x /tmp/pe-copyparty*" > /run/tmpfiles.d/copyparty.conf'
27+
28+
# run copyparty
29+
ExecStart=/usr/bin/python3 /usr/bin/copyparty -c /etc/copyparty.d/init
30+
31+
[Install]
32+
WantedBy=multi-user.target

contrib/package/makedeb-mpr/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
this is `/var/lib/copyparty-jail`, the fallback webroot when copyparty has not yet been configured
2+
3+
please add some `*.conf` files to `/etc/copyparty.d/`
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# this will start `/usr/bin/copyparty-sfx.py`
2+
# in a chroot, preventing accidental access elsewhere,
3+
# and read copyparty config from `/etc/copyparty.d/*.conf`
4+
#
5+
# expose additional filesystem locations to copyparty
6+
# by listing them between the last `cpp` and `--`
7+
#
8+
# `cpp cpp` = user/group to run copyparty as; can be IDs (1000 1000)
9+
#
10+
# unless you add -q to disable logging, you may want to remove the
11+
# following line to allow buffering (slightly better performance):
12+
# Environment=PYTHONUNBUFFERED=x
13+
14+
[Unit]
15+
Description=copyparty file server
16+
17+
[Service]
18+
SyslogIdentifier=prisonparty
19+
Environment=PYTHONUNBUFFERED=x
20+
WorkingDirectory=/var/lib/copyparty-jail
21+
ExecReload=/bin/kill -s USR1 $MAINPID
22+
23+
# stop systemd-tmpfiles-clean.timer from deleting copyparty while it's running
24+
ExecStartPre=+/bin/bash -c 'mkdir -p /run/tmpfiles.d/ && echo "x /tmp/pe-copyparty*" > /run/tmpfiles.d/copyparty.conf'
25+
26+
# run copyparty
27+
ExecStart=/bin/bash /usr/bin/prisonparty /var/lib/copyparty-jail cpp cpp \
28+
/etc/copyparty.d \
29+
-- \
30+
/usr/bin/python3 /usr/bin/copyparty -c /etc/copyparty.d/init
31+
32+
[Install]
33+
WantedBy=multi-user.target

scripts/prep.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,31 @@ update_arch_pkgbuild() {
2222
rm -rf x
2323
}
2424

25+
update_mpr_pkgbuild() {
26+
cd "$self/../contrib/package/makedeb-mpr"
27+
rm -rf x
28+
mkdir x
29+
30+
sha=$(sha256sum "$self/../dist/copyparty-$ver.tar.gz" | awk '{print$1}')
31+
32+
# awk -v ver=$ver -v sha=$sha '
33+
# /^pkgver=/{sub(/[0-9\.]+/,ver)};
34+
# /^sha256sums=/{sub(/[0-9a-f]{64}/,sha)};
35+
# 1' PKGBUILD >a
36+
# mv a PKGBUILD
37+
38+
echo thing 1
39+
sed -s -i "s/pkgver=\"\"/pkgver=\"$ver\"/" PKGBUILD
40+
sed -s -i "s/sha256sums=(\".*\")/sha256sums=(\"$sha\")/" PKGBUILD
41+
42+
rm -rf x
43+
}
44+
2545
update_nixos_pin() {
2646
( cd $self/../contrib/package/nix/copyparty;
2747
./update.py $self/../dist/copyparty-sfx.py )
2848
}
2949

3050
update_arch_pkgbuild
51+
update_mpr_pkgbuild
3152
update_nixos_pin

0 commit comments

Comments
 (0)