copyparty

This commit is contained in:
CanbiZ 2025-08-18 12:00:20 +02:00
parent 6b5f70b6e2
commit 120e5ac524
2 changed files with 15 additions and 28 deletions

View File

@ -13,7 +13,7 @@
"website": "https://github.com/9001/copyparty",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/copyparty.webp",
"config_path": "",
"description": "This script automatically adds IP address as tags to LXC containers using a Systemd service. The service also updates the tags if a LXC IP address is changed.",
"description": "Copyparty is a lightweight, portable HTTP file server with a browser-based interface. It supports drag-and-drop uploads, downloads, deduplication, media playback, and advanced search, making it ideal for quickly sharing and managing files.",
"install_methods": [
{
"type": "default",

View File

@ -64,7 +64,8 @@ function setup_user_and_dirs() {
if [[ "$OS" == "Debian" ]]; then
useradd -r -s /sbin/nologin -d "$DATA_PATH" "$SVC_USER"
else
adduser -D -H -h "$DATA_PATH" -s /sbin/nologin "$SVC_USER"
addgroup -S "$SVC_GROUP" 2>/dev/null || true
adduser -S -D -H -G "$SVC_GROUP" -h "$DATA_PATH" -s /sbin/nologin "$SVC_USER" 2>/dev/null || true
fi
fi
mkdir -p "$DATA_PATH" "$LOG_PATH"
@ -190,42 +191,28 @@ msg_ok "Config written"
# --- Systemd/OpenRC Service ---
msg_info "Creating service"
if [[ "$OS" == "Debian" ]]; then
cat <<EOF >"$SERVICE_PATH_DEB"
[Unit]
Description=CopyParty file server
[Service]
Type=simple
User=$SVC_USER
Group=$SVC_GROUP
WorkingDirectory=$USER_DATA_PATH
Environment=PYTHONUNBUFFERED=x
LogsDirectory=copyparty
ExecStart=/usr/bin/python3 $BIN_PATH -c $CONF_PATH
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now copyparty &>/dev/null
else
cat <<EOF >"$SERVICE_PATH_ALP"
cat <<'EOF' >"$SERVICE_PATH_ALP"
#!/sbin/openrc-run
command="/usr/bin/python3"
command_args="$BIN_PATH -c $CONF_PATH"
name="copyparty"
description="Copyparty file server"
command="$(command -v python3)"
command_args="/usr/local/bin/copyparty-sfx.py -c /etc/copyparty.conf"
command_background=true
directory="$USER_DATA_PATH"
pidfile="$USER_DATA_PATH/copyparty.pid"
directory="/var/lib/copyparty"
pidfile="/run/copyparty.pid"
output_log="/var/log/copyparty/copyparty.log"
error_log="/var/log/copyparty/copyparty.err"
depend() {
need net
}
EOF
chmod +x "$SERVICE_PATH_ALP"
rc-update add copyparty default &>/dev/null
rc-service copyparty start &>/dev/null
rc-service copyparty restart &>/dev/null
fi
msg_ok "Service created and started"