mirror of
https://github.com/9001/copyparty.git
synced 2025-08-16 00:22:13 -06:00
make rpm
This commit is contained in:
parent
0177a9b402
commit
6ccc9224f3
62
contrib/package/rpm/copyparty.spec
Normal file
62
contrib/package/rpm/copyparty.spec
Normal file
|
@ -0,0 +1,62 @@
|
|||
Name: copyparty
|
||||
Version: $pkgver
|
||||
Release: $pkgrel
|
||||
License: MIT
|
||||
Group: Utilities
|
||||
URL: https://github.com/9001/copyparty
|
||||
Source0: copyparty-$pkgver.tar.gz
|
||||
Summary: File server with accelerated resumable uploads, dedup, WebDAV, FTP, TFTP, zeroconf, media indexer, thumbnails++
|
||||
BuildArch: noarch
|
||||
BuildRequires: python3, python3-devel, pyproject-rpm-macros, python-setuptools, python-wheel, make
|
||||
Requires: python3, (python3-jinja2 or python-jinja2), lsof
|
||||
Recommends: ffmpeg, (golang-github-cloudflare-cfssl or cfssl), python-mutagen, python-pillow, python-pyvips
|
||||
Recommends: qm-vamp-plugins, python-argon2-cffi, (python-pyopenssl or pyopenssl), python-impacket
|
||||
|
||||
%description
|
||||
Portable file server with accelerated resumable uploads, dedup, WebDAV, FTP, TFTP, zeroconf, media indexer, thumbnails++ all in one file, no deps
|
||||
|
||||
See release at https://github.com/9001/copyparty/releases
|
||||
|
||||
%global debug_package %{nil}
|
||||
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
cd "copyparty/web"
|
||||
make
|
||||
cd -
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{_bindir}
|
||||
mkdir -p %{buildroot}%{_libdir}/systemd/{system,user}
|
||||
mkdir -p %{buildroot}/etc/%{name}
|
||||
mkdir -p %{buildroot}/var/lib/%{name}-jail
|
||||
mkdir -p %{buildroot}%{_datadir}/licenses/%{name}
|
||||
|
||||
%pyproject_install
|
||||
%pyproject_save_files copyparty
|
||||
|
||||
install -m 0755 bin/prisonparty.sh %{buildroot}%{_bindir}/prisonpary.sh
|
||||
install -m 0644 contrib/systemd/%{name}.conf %{buildroot}/etc/%{name}/%{name}.conf
|
||||
install -m 0644 contrib/systemd/%{name}@.service %{buildroot}%{_libdir}/systemd/system/%{name}@.service
|
||||
install -m 0644 contrib/systemd/%{name}-user.service %{buildroot}%{_libdir}/systemd/user/%{name}.service
|
||||
install -m 0644 contrib/systemd/prisonparty@.service %{buildroot}%{_libdir}/systemd/system/prisonparty@.service
|
||||
install -m 0644 contrib/systemd/index.md %{buildroot}/var/lib/%{name}-jail/README.md
|
||||
install -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
|
||||
|
||||
%files -n copyparty -f %{pyproject_files}
|
||||
%license LICENSE
|
||||
%{_bindir}/copyparty
|
||||
%{_bindir}/partyfuse
|
||||
%{_bindir}/u2c
|
||||
%{_bindir}/prisonpary.sh
|
||||
/etc/%{name}/%{name}.conf
|
||||
%{_libdir}/systemd/system/%{name}@.service
|
||||
%{_libdir}/systemd/user/%{name}.service
|
||||
%{_libdir}/systemd/system/prisonparty@.service
|
||||
/var/lib/%{name}-jail/README.md
|
61
scripts/make-rpm.sh
Executable file
61
scripts/make-rpm.sh
Executable file
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
#--localbuild to build webdeps and tar locally; otherwise just download prebuilt
|
||||
#--pm change packagemanager; otherwise default to dnf
|
||||
|
||||
while [ ! -z "$1" ]; do
|
||||
case $1 in
|
||||
local-build) local_build=1 ; ;;
|
||||
pm) shift;packagemanager="$1"; ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[ -e copyparty/__main__.py ] || cd ..
|
||||
[ -e copyparty/__main__.py ] ||
|
||||
{
|
||||
echo "run me from within the project root folder"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
packagemanager=${packagemanager:-dnf}
|
||||
ver=$(awk '/^VERSION/{gsub(/[^0-9]/," ");printf "%d.%d.%d\n",$1,$2,$3}' copyparty/__version__.py)
|
||||
releasedir="dist/temp_copyparty_$ver"
|
||||
sourcepkg="copyparty-$ver.tar.gz"
|
||||
|
||||
#make temporary directory to build rpm in
|
||||
mkdir -p $releasedir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||
trap "rm -rf $releasedir/" EXIT
|
||||
|
||||
# make/get tarball
|
||||
if [ $local_build ]; then
|
||||
if [ ! -f "copyparty/web/deps/mini-fa.woff" ]; then
|
||||
sudo $packagemanager update
|
||||
sudo $packagemanager install podman-docker docker
|
||||
make -C deps-docker
|
||||
fi
|
||||
if [ ! -f "dist/$sourcepkg" ]; then
|
||||
./$cppdir/scripts/make-tgz-release.sh "$ver"
|
||||
fi
|
||||
else
|
||||
if [ ! -f "dist/$sourcepkg" ]; then
|
||||
curl -OL https://github.com/9001/copyparty/releases/download/v$ver/$sourcepkg --output-dir dist
|
||||
fi
|
||||
fi
|
||||
|
||||
cp dist/$sourcepkg "$releasedir/SOURCES/$sourcepkg"
|
||||
|
||||
cp "contrib/package/rpm/copyparty.spec" "$releasedir/SPECS/"
|
||||
sed -i "s/\$pkgver/$ver/g" "$releasedir/SPECS/copyparty.spec"
|
||||
sed -i "s/\$pkgrel/1/g" "$releasedir/SPECS/copyparty.spec"
|
||||
|
||||
sudo $packagemanager update
|
||||
sudo $packagemanager install rpmdevtools python-wheel python-setuptools pyproject-rpm-macros
|
||||
cd "$releasedir/"
|
||||
rpmbuild --define "_topdir `pwd`" -bb SPECS/copyparty.spec
|
||||
cd -
|
||||
|
||||
rpm="copyparty-$ver-1.noarch.rpm"
|
||||
mv "$releasedir/RPMS/noarch/$rpm" dist/$rpm
|
Loading…
Reference in a new issue