diff --git a/contrib/README.md b/contrib/README.md new file mode 100644 index 00000000..d7645f76 --- /dev/null +++ b/contrib/README.md @@ -0,0 +1,15 @@ +### [`copyparty.bat`](copyparty.bat) +* launches copyparty with no arguments (anon read+write within same folder) +* intended for windows machines with no python.exe in PATH +* works on windows, linux and macos +* assumes `copyparty-sfx.py` was renamed to `copyparty.py` in the same folder as `copyparty.bat` + +### [`index.html`](index.html) +* drop-in redirect from an httpd to copyparty +* assumes the webserver and copyparty is running on the same server/IP +* modify `10.13.1.1` as necessary if you wish to support browsers without javascript + +# OS integration +init-scripts to start copyparty as a service +* [`systemd/copyparty.service`](systemd/copyparty.service) +* [`openrc/copyparty`](openrc/copyparty) diff --git a/contrib/copyparty.bat b/contrib/copyparty.bat new file mode 100644 index 00000000..919b80b2 --- /dev/null +++ b/contrib/copyparty.bat @@ -0,0 +1,33 @@ +exec python "$(dirname "$0")"/copyparty.py + +@rem on linux, the above will execute and the script will terminate +@rem on windows, the rest of this script will run + +@echo off +cls + +set py= +for /f %%i in ('where python 2^>nul') do ( + set "py=%%i" + goto c1 +) +:c1 + +if [%py%] == [] ( + for /f %%i in ('where /r "%localappdata%\programs\python" python 2^>nul') do ( + set "py=%%i" + goto c2 + ) +) +:c2 + +if [%py%] == [] set "py=c:\python27\python.exe" + +if not exist "%py%" ( + echo could not find python + echo( + pause + exit /b +) + +start cmd /c %py% "%~dp0\copyparty.py" diff --git a/contrib/index.html b/contrib/index.html new file mode 100644 index 00000000..7ad0b87b --- /dev/null +++ b/contrib/index.html @@ -0,0 +1,43 @@ + + + + + + ⇆🎉 redirect + + + + + you probably want copyparty + + + diff --git a/contrib/openrc/copyparty b/contrib/openrc/copyparty new file mode 100644 index 00000000..f7a06bc8 --- /dev/null +++ b/contrib/openrc/copyparty @@ -0,0 +1,18 @@ +#!/sbin/openrc-run + +# this will start `/usr/local/bin/copyparty-sfx.py` +# and share '/mnt' with anonymous read+write +# +# installation: +# cp -pv copyparty /etc/init.d && rc-update add copyparty +# +# you may want to: +# change '/usr/bin/python' to another interpreter +# change '/mnt::a' to another location or permission-set + +name="$SVCNAME" +command_background=true +pidfile="/var/run/$SVCNAME.pid" + +command="/usr/bin/python /usr/local/bin/copyparty-sfx.py" +command_args="-q -v /mnt::a" diff --git a/contrib/systemd/copyparty.service b/contrib/systemd/copyparty.service new file mode 100644 index 00000000..9802f296 --- /dev/null +++ b/contrib/systemd/copyparty.service @@ -0,0 +1,19 @@ +# this will start `/usr/local/bin/copyparty-sfx.py` +# and share '/mnt' with anonymous read+write +# +# installation: +# cp -pv copyparty.service /etc/systemd/system && systemctl enable --now copyparty +# +# you may want to: +# change '/usr/bin/python' to another interpreter +# change '/mnt::a' to another location or permission-set + +[Unit] +Description=copyparty file server + +[Service] +ExecStart=/usr/bin/python /usr/local/bin/copyparty-sfx.py -q -v /mnt::a +ExecStartPre=/bin/bash -c 'mkdir -p /run/tmpfiles.d/ && echo "x /tmp/pe-copyparty*" > /run/tmpfiles.d/copyparty.conf' + +[Install] +WantedBy=multi-user.target