From 077fbd7e8f601429f1a36d9b8ba132f5634469f3 Mon Sep 17 00:00:00 2001 From: Carlos Date: Fri, 24 Apr 2026 01:05:53 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20.deb=20source=20staging=20=E2=80=94=20pre?= =?UTF-8?q?serve=20app/=20subdir=20for=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit build-deb.sh used 'cp -r app/ source/' which renames app to source when source doesn't yet exist, dropping the app/ wrapper that the Dockerfile's COPY app/ /app/ depends on. The 2>/dev/null || true on the cp lines hid the resulting failures, so the .deb shipped a broken /opt/dupfinder/source/ that build-from-source could not use. Pre-create the source dir and copy each item to its explicit destination path. Bump package version to 1.0.1. Also rework dupfinder-setup.sh's image-prep step: prefer a local image, then a quiet registry pull, then build from the bundled source. Removes the loud registry-not-found error that scared users when the (unpublished) tocmo0nlord/dupfinder image wasn't on Docker Hub. --- debian/build-deb.sh | 16 ++++++---- debian/files/opt/dupfinder/dupfinder-setup.sh | 30 ++++++++++--------- .../usr/share/applications/dupfinder.desktop | 12 ++++++++ 3 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 debian/files/usr/share/applications/dupfinder.desktop diff --git a/debian/build-deb.sh b/debian/build-deb.sh index 3174229..3bb144b 100644 --- a/debian/build-deb.sh +++ b/debian/build-deb.sh @@ -13,7 +13,7 @@ BUILD_DIR="$REPO_ROOT/build/deb" # ── Config ──────────────────────────────────────────────────────────────────── PKG_NAME="dupfinder" -PKG_VERSION="1.0.0" +PKG_VERSION="1.0.1" PKG_ARCH="amd64" DEB_FILE="${PKG_NAME}_${PKG_VERSION}_${PKG_ARCH}.deb" @@ -64,11 +64,15 @@ cp -r "$DEBIAN_DIR/files/." "$PKG_STAGE/" mkdir -p "$PKG_STAGE/opt/dupfinder" cp "$REPO_ROOT/docker-compose.yml" "$PKG_STAGE/opt/dupfinder/docker-compose.yml" -# Copy source as fallback build path -cp -r "$REPO_ROOT/app" "$PKG_STAGE/opt/dupfinder/source/" 2>/dev/null || true -cp -r "$REPO_ROOT/templates" "$PKG_STAGE/opt/dupfinder/source/" 2>/dev/null || true -cp "$REPO_ROOT/Dockerfile" "$PKG_STAGE/opt/dupfinder/source/" 2>/dev/null || true -cp "$REPO_ROOT/requirements.txt" "$PKG_STAGE/opt/dupfinder/source/" 2>/dev/null || true +# Copy source as fallback build path. Preserve the app/ subdirectory layout +# so the Dockerfile's `COPY app/ /app/` resolves correctly when building from +# this staged source dir. +SRC_STAGE="$PKG_STAGE/opt/dupfinder/source" +mkdir -p "$SRC_STAGE" +cp -r "$REPO_ROOT/app" "$SRC_STAGE/app" +cp -r "$REPO_ROOT/templates" "$SRC_STAGE/templates" +cp "$REPO_ROOT/Dockerfile" "$SRC_STAGE/Dockerfile" +cp "$REPO_ROOT/requirements.txt" "$SRC_STAGE/requirements.txt" # ── Fix file permissions ────────────────────────────────────────────────────── find "$PKG_STAGE" -type f -name "*.sh" -exec chmod 755 {} \; diff --git a/debian/files/opt/dupfinder/dupfinder-setup.sh b/debian/files/opt/dupfinder/dupfinder-setup.sh index 1181779..3880fd0 100644 --- a/debian/files/opt/dupfinder/dupfinder-setup.sh +++ b/debian/files/opt/dupfinder/dupfinder-setup.sh @@ -128,22 +128,24 @@ read -rp " Web port [$APP_PORT]: " INPUT [[ -n "$INPUT" ]] && APP_PORT="$INPUT" ok "Port: $APP_PORT" -# ── Pull Docker image ───────────────────────────────────────────────────────── +# ── Build (or pull) Docker image ────────────────────────────────────────────── +# The .deb ships the full source tree, so building locally is the default. +# Registry pull is tried only as a quick path if the image happens to be +# published; failures are silent. echo "" -info "Pulling Docker image ($IMAGE_NAME)..." -if docker pull "$IMAGE_NAME"; then - ok "Image pulled" +info "Preparing Docker image ($IMAGE_NAME)..." + +if docker image inspect "$IMAGE_NAME" >/dev/null 2>&1; then + ok "Image already present locally" +elif docker pull "$IMAGE_NAME" >/dev/null 2>&1; then + ok "Image pulled from registry" +elif [[ -f "$COMPOSE_DIR/source/Dockerfile" ]]; then + echo " Building image from bundled source (one-time, ~5-10 min)..." + docker build -t "$IMAGE_NAME" "$COMPOSE_DIR/source" + ok "Image built from source" else - echo "" - echo " Could not pull from registry. Trying to build from source..." - if [[ -f "$COMPOSE_DIR/source/Dockerfile" ]]; then - docker build -t "$IMAGE_NAME" "$COMPOSE_DIR/source" - ok "Image built from source" - else - err "Neither pull nor local build succeeded." - echo " Make sure you have internet access or the source files are present." - exit 1 - fi + err "No image available and no source bundled. Reinstall the .deb." + exit 1 fi # ── Write config + override ─────────────────────────────────────────────────── diff --git a/debian/files/usr/share/applications/dupfinder.desktop b/debian/files/usr/share/applications/dupfinder.desktop new file mode 100644 index 0000000..3898df8 --- /dev/null +++ b/debian/files/usr/share/applications/dupfinder.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=DupFinder +GenericName=Duplicate Photo Finder +Comment=Find and review duplicate photos and videos +Exec=dupfinder open +Icon=dupfinder +Terminal=false +Categories=Graphics;Photography;Utility; +Keywords=duplicate;dedup;dedupe;photos;videos; +StartupNotify=false