diff --git a/cleanuparr/CHANGELOG.md b/cleanuparr/CHANGELOG.md new file mode 100644 index 000000000..b67829ba0 --- /dev/null +++ b/cleanuparr/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +## 2.7.7 + +- Initial release of Cleanuparr addon +- Based on upstream image `ghcr.io/cleanuparr/cleanuparr:2.7.7` +- Persistent config stored in HA addon config directory +- Supports amd64 and aarch64 architectures diff --git a/cleanuparr/Dockerfile b/cleanuparr/Dockerfile new file mode 100644 index 000000000..1820a7c30 --- /dev/null +++ b/cleanuparr/Dockerfile @@ -0,0 +1,112 @@ +#============================# +# ALEXBELGIUM'S DOCKERFILE # +#============================# +# _.------. +# _.-` ('>.-`"""-. +# '.--'` _'` _ .--.) +# -' '-.-';` ` +# ' - _.' ``'--. +# '---` .-'""` +# /` +#=== Home Assistant Addon ===# + +# ARGs used in FROM must be declared before any FROM instruction +ARG BUILD_UPSTREAM="2.7.7" + +################# +# 1 Build Image # +################# + +ARG BUILD_FROM +ARG BUILD_VERSION +FROM ghcr.io/cleanuparr/cleanuparr:${BUILD_UPSTREAM} + +################## +# 2 Modify Image # +################## + +USER root + +# Set S6 wait time env (not used but harmless, keeps pattern) +ENV S6_CMD_WAIT_FOR_SERVICES=1 \ + S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ + S6_SERVICES_GRACETIME=0 + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / +RUN find /. -type f \( -name "*.sh" \) -print -exec chmod +x {} \; + +# Install bashio standalone +RUN BASHIO_VERSION="0.14.3" && \ + mkdir -p /tmp/bashio && \ + curl -f -L -s -S "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" | tar -xzf - --strip 1 -C /tmp/bashio && \ + mv /tmp/bashio/lib /usr/lib/bashio && \ + ln -s /usr/lib/bashio/bashio /usr/bin/bashio && \ + rm -rf /tmp/bashio + +# Modules +ARG MODULES="00-banner.sh 01-custom_script.sh" + +# Automatic modules download +ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automodules.sh" "/ha_automodules.sh" +RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh + +################ +# 4 Entrypoint # +################ + +ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/bashio-standalone.sh" "/usr/local/lib/bashio-standalone.sh" +RUN chmod 0755 /usr/local/lib/bashio-standalone.sh + +# Bypass the original /entrypoint.sh (which mounts /config as VOLUME). +# Our wrapper symlinks /app/config → HA addon_config and starts ./Cleanuparr directly. +ENTRYPOINT ["/ha_entrypoint.sh"] +CMD ["./Cleanuparr"] + +############ +# 5 Labels # +############ + +ARG BUILD_ARCH +ARG BUILD_DATE +ARG BUILD_DESCRIPTION +ARG BUILD_NAME +ARG BUILD_REF +ARG BUILD_REPOSITORY +ARG BUILD_VERSION +ENV BUILD_VERSION="${BUILD_VERSION}" +LABEL \ + io.hass.name="${BUILD_NAME}" \ + io.hass.description="${BUILD_DESCRIPTION}" \ + io.hass.arch="${BUILD_ARCH}" \ + io.hass.type="addon" \ + io.hass.version=${BUILD_VERSION} \ + maintainer="alexbelgium (https://github.com/alexbelgium)" \ + org.opencontainers.image.title="${BUILD_NAME}" \ + org.opencontainers.image.description="${BUILD_DESCRIPTION}" \ + org.opencontainers.image.vendor="Home Assistant Add-ons" \ + org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.url="https://github.com/alexbelgium" \ + org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \ + org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \ + org.opencontainers.image.created=${BUILD_DATE} \ + org.opencontainers.image.revision=${BUILD_REF} \ + org.opencontainers.image.version=${BUILD_VERSION} + +################# +# 6 Healthcheck # +################# + +ENV HEALTH_PORT="11011" \ + HEALTH_URL="" +HEALTHCHECK \ + --interval=5s \ + --retries=5 \ + --start-period=30s \ + --timeout=25s \ + CMD curl -A "HealthCheck: Docker/1.0" -s -f "http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" &>/dev/null || exit 1 diff --git a/cleanuparr/README.md b/cleanuparr/README.md new file mode 100644 index 000000000..9637f0ade --- /dev/null +++ b/cleanuparr/README.md @@ -0,0 +1,39 @@ +# Home Assistant Add-on: Cleanuparr + +Automatically removes stuck, stalled, and unwanted downloads from your \*arr applications (Sonarr, Radarr, Lidarr, Readarr, Whisparr) and download clients (qBittorrent, Deluge, Transmission, NZBGet, SABnzbd). + +## About + +Cleanuparr monitors your download queues and applies configurable rules to: +- Remove stalled or stuck downloads +- Clean up unwanted files +- Notify via Apprise (Discord, Telegram, Slack, email, and 60+ more) + +Integrations supported: +- **\*arr**: Sonarr, Radarr, Lidarr, Readarr, Whisparr +- **Download clients**: qBittorrent, Deluge, Transmission, NZBGet, SABnzbd + +## Installation + +1. Add the repository to Home Assistant. +2. Install the **Cleanuparr** add-on. +3. Start the add-on. +4. Open the Web UI on port `11011`. + +## Configuration + +| Option | Description | +|--------|-------------| +| `TZ` | Timezone (e.g. `Europe/Paris`). Defaults to `Europe/London`. | +| `PUID` | User ID to run the process as. Defaults to `0` (root). | +| `PGID` | Group ID to run the process as. Defaults to `0` (root). | +| `env_vars` | Extra environment variables passed to the container. | + +## Data + +Persistent configuration is stored in the HA addon config directory and survives add-on updates and reinstalls. + +## Support + +- [Cleanuparr upstream project](https://github.com/Cleanuparr/Cleanuparr) +- [Addon repository issues](https://github.com/alexbelgium/hassio-addons/issues) diff --git a/cleanuparr/apparmor.txt b/cleanuparr/apparmor.txt new file mode 100644 index 000000000..84b2c153e --- /dev/null +++ b/cleanuparr/apparmor.txt @@ -0,0 +1,66 @@ +#include + +profile cleanuparr_addon flags=(attach_disconnected,mediate_deleted) { + #include + + capability, + file, + signal, + mount, + umount, + remount, + network udp, + network tcp, + network dgram, + network stream, + network inet, + network inet6, + network netlink raw, + network unix dgram, + + capability setgid, + capability setuid, + capability sys_admin, + capability dac_read_search, + # capability dac_override, + # capability sys_rawio, + +# S6-Overlay + /init ix, + /run/{s6,s6-rc*,service}/** ix, + /package/** ix, + /command/** ix, + /run/{,**} rwk, + /dev/tty rw, + /bin/** ix, + /usr/bin/** ix, + /usr/lib/bashio/** ix, + /etc/s6/** rix, + /run/s6/** rix, + /etc/services.d/** rwix, + /etc/cont-init.d/** rwix, + /etc/cont-finish.d/** rwix, + /init rix, + /var/run/** mrwkl, + /var/run/ mrwkl, + /dev/i2c-1 mrwkl, + # Files required + /dev/fuse mrwkl, + /dev/sda1 mrwkl, + /dev/sdb1 mrwkl, + /dev/nvme0 mrwkl, + /dev/nvme1 mrwkl, + /dev/mmcblk0p1 mrwkl, + /dev/* mrwkl, + /tmp/** mrkwl, + + # Data access + /data/** rw, + + # suppress ptrace denials when using 'docker ps' or using 'ps' inside a container + ptrace (trace,read) peer=docker-default, + + # docker daemon confinement requires explict allow rule for signal + signal (receive) set=(kill,term) peer=/usr/bin/docker, + +} diff --git a/cleanuparr/build.json b/cleanuparr/build.json new file mode 100644 index 000000000..30d765c15 --- /dev/null +++ b/cleanuparr/build.json @@ -0,0 +1,6 @@ +{ + "build_from": { + "aarch64": "ghcr.io/cleanuparr/cleanuparr:latest", + "amd64": "ghcr.io/cleanuparr/cleanuparr:latest" + } +} diff --git a/cleanuparr/config.yaml b/cleanuparr/config.yaml new file mode 100644 index 000000000..3ddfed3f0 --- /dev/null +++ b/cleanuparr/config.yaml @@ -0,0 +1,95 @@ +arch: + - aarch64 + - amd64 +description: + Automatically removes stuck and unwanted downloads from your *arr and download clients +devices: + - /dev/dri + - /dev/dri/card0 + - /dev/dri/card1 + - /dev/dri/renderD128 + - /dev/vchiq + - /dev/video10 + - /dev/video11 + - /dev/video12 + - /dev/video13 + - /dev/video14 + - /dev/video15 + - /dev/video16 + - /dev/ttyUSB0 + - /dev/sda + - /dev/sdb + - /dev/sdc + - /dev/sdd + - /dev/sde + - /dev/sdf + - /dev/sdg + - /dev/nvme + - /dev/nvme0 + - /dev/nvme0n1 + - /dev/nvme0n1p1 + - /dev/nvme0n1p2 + - /dev/nvme0n1p3 + - /dev/nvme1n1 + - /dev/nvme1n1p1 + - /dev/nvme1n1p2 + - /dev/nvme1n1p3 + - /dev/nvme2n1 + - /dev/nvme2n1p1 + - /dev/nvme2n1p2 + - /dev/nvme2n3p3 + - /dev/mmcblk + - /dev/fuse + - /dev/sda1 + - /dev/sdb1 + - /dev/sdc1 + - /dev/sdd1 + - /dev/sde1 + - /dev/sdf1 + - /dev/sdg1 + - /dev/sda2 + - /dev/sdb2 + - /dev/sdc2 + - /dev/sdd2 + - /dev/sde2 + - /dev/sdf2 + - /dev/sdg2 + - /dev/sda3 + - /dev/sdb3 + - /dev/sda4 + - /dev/sdb4 + - /dev/sda5 + - /dev/sda6 + - /dev/sda7 + - /dev/sda8 + - /dev/nvme0 + - /dev/nvme1 + - /dev/nvme2 +image: ghcr.io/alexbelgium/cleanuparr-{arch} +ingress: true +ingress_stream: true +init: false +panel_icon: mdi:movie-search +map: + - addon_config:rw +name: Cleanuparr +options: + env_vars: [] + PGID: 0 + PUID: 0 + TZ: Europe/London +ports: + 11011/tcp: 11011 +ports_description: + 11011/tcp: Web interface +schema: + env_vars: + - name: match(^[A-Za-z0-9_]+$) + value: str? + PGID: int + PUID: int + TZ: str? +slug: cleanuparr +url: https://github.com/alexbelgium/hassio-addons/tree/master/cleanuparr +version: "2.7.7" +webui: "[PROTO:ssl]://[HOST]:[PORT:11011]" diff --git a/cleanuparr/icon.png b/cleanuparr/icon.png new file mode 100644 index 000000000..ff84ada61 Binary files /dev/null and b/cleanuparr/icon.png differ diff --git a/cleanuparr/logo.png b/cleanuparr/logo.png new file mode 100644 index 000000000..ff84ada61 Binary files /dev/null and b/cleanuparr/logo.png differ diff --git a/cleanuparr/rootfs/ha_entrypoint.sh b/cleanuparr/rootfs/ha_entrypoint.sh new file mode 100644 index 000000000..a177b39aa --- /dev/null +++ b/cleanuparr/rootfs/ha_entrypoint.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# shellcheck shell=bash +set -e + +############################################################################### +# Home Assistant Addon entrypoint for Cleanuparr +# The .NET app uses /app/config as its data directory. +# We symlink /app/config → /addon_configs/cleanuparr (HA persistent storage) +# and start ./Cleanuparr directly, bypassing the original /entrypoint.sh +# which would trigger the /config Docker VOLUME mount. +############################################################################### + +# ─── Source standalone bashio if available ─────────────────────────────────── +if [ -f /usr/local/lib/bashio-standalone.sh ]; then + # shellcheck disable=SC1091 + source /usr/local/lib/bashio-standalone.sh +fi + +# ─── Run cont-init.d scripts (banner, custom_script, ...) ──────────────────── +if [ -d /etc/cont-init.d ]; then + for script in /etc/cont-init.d/*.sh; do + [ -f "$script" ] || continue + echo "[Cleanuparr] Running init script: $script" + bash "$script" + done +fi + +# ─── Setup persistent data directory ───────────────────────────────────────── +HA_DATA_DIR="/addon_configs/cleanuparr" +echo "[Cleanuparr] Setting up data directory: $HA_DATA_DIR" +mkdir -p "$HA_DATA_DIR" + +# Symlink /app/config → HA persistent storage +# The .NET app uses /app/config, NOT /config at the filesystem root +if [ -d /app/config ] && [ ! -L /app/config ]; then + cp -rn /app/config/. "$HA_DATA_DIR/" 2>/dev/null || true + rm -rf /app/config +fi +ln -sfn "$HA_DATA_DIR" /app/config + +chown -R "${PUID:-0}:${PGID:-0}" "$HA_DATA_DIR" + +# ─── Start Cleanuparr directly (bypass original /entrypoint.sh) ────────────── +echo "[Cleanuparr] Starting application on port ${HTTP_PORTS:-11011}..." +cd /app +exec ./Cleanuparr diff --git a/cleanuparr/updater.json b/cleanuparr/updater.json new file mode 100644 index 000000000..171ff2612 --- /dev/null +++ b/cleanuparr/updater.json @@ -0,0 +1,8 @@ +{ + "last_update": "2026-03-03", + "repository": "alexbelgium/hassio-addons", + "slug": "cleanuparr", + "source": "github", + "upstream_repo": "Cleanuparr/Cleanuparr", + "upstream_version": "2.7.7" +}