From 35fd4f7b7fca5b836722fcfee938dc3ed25ea91a Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Thu, 29 May 2025 21:55:39 +0100 Subject: [PATCH] fix: apply CSS recovery mechanism to fresh installations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extended the CSS file recovery logic to fresh tarball installations, not just updates. The script now attempts to recover missing or corrupted CSS files during initial installations instead of failing and falling back to git clone. This ensures consistent CSS recovery behavior for both new installations and updates, preventing installation failures due to tarball extraction issues. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/install-pulse.sh | 45 +++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/scripts/install-pulse.sh b/scripts/install-pulse.sh index 6879a3a07..7e74a5da6 100755 --- a/scripts/install-pulse.sh +++ b/scripts/install-pulse.sh @@ -592,27 +592,44 @@ perform_tarball_install() { print_info "NPM dependencies already present in tarball." fi - # Always check if CSS assets need building for tarball installs + # Always check if CSS assets are valid after tarball extraction print_info "Verifying CSS assets in $PULSE_DIR..." # Check if output.css exists and is valid (not corrupted with HTML content) - css_needs_fix=false if [ ! -f "$PULSE_DIR/src/public/output.css" ]; then - print_warning "output.css file is missing - should be present in tarball" - css_needs_fix=true + print_error "Critical: output.css file is missing after tarball extraction. Attempting recovery..." + # Try to re-extract just the CSS file as a fallback + if curl -sL "https://github.com/rcourtman/Pulse/releases/download/$TARGET_TAG/pulse-${TARGET_TAG#v}.tar.gz" | tar -xzf - --to-stdout "pulse-${TARGET_TAG#v}/src/public/output.css" > "$PULSE_DIR/src/public/output.css" 2>/dev/null; then + print_success "CSS file recovered using direct extraction." + chown "$PULSE_USER":"$PULSE_USER" "$PULSE_DIR/src/public/output.css" + else + print_error "Failed to recover CSS file. Installation will continue but frontend may not display correctly." + fi elif [ ! -s "$PULSE_DIR/src/public/output.css" ]; then - print_warning "output.css file is empty - should contain CSS from tarball" - css_needs_fix=true + print_error "Critical: output.css file is empty after tarball extraction. Attempting recovery..." + # Try to re-extract just the CSS file as a fallback + if curl -sL "https://github.com/rcourtman/Pulse/releases/download/$TARGET_TAG/pulse-${TARGET_TAG#v}.tar.gz" | tar -xzf - --to-stdout "pulse-${TARGET_TAG#v}/src/public/output.css" > "$PULSE_DIR/src/public/output.css" 2>/dev/null; then + print_success "CSS file recovered using direct extraction." + chown "$PULSE_USER":"$PULSE_USER" "$PULSE_DIR/src/public/output.css" + else + print_error "Failed to recover CSS file. Installation will continue but frontend may not display correctly." + fi elif head -1 "$PULSE_DIR/src/public/output.css" 2>/dev/null | grep -q " "$PULSE_DIR/src/public/output.css" 2>/dev/null; then + # Verify the recovery worked + if [ -s "$PULSE_DIR/src/public/output.css" ] && ! head -1 "$PULSE_DIR/src/public/output.css" 2>/dev/null | grep -q "