mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 11:13:26 +00:00
fix: apply CSS recovery mechanism to fresh installations
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 <noreply@anthropic.com>
This commit is contained in:
+31
-14
@@ -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 "<!DOCTYPE\|<html\|<head"; then
|
||||
print_warning "output.css contains HTML instead of CSS (this should not happen in fresh tarball)"
|
||||
css_needs_fix=true
|
||||
fi
|
||||
|
||||
if [ "$css_needs_fix" = "true" ]; then
|
||||
print_error "CSS assets in tarball are invalid. This indicates a problem with the release tarball."
|
||||
return 1
|
||||
print_warning "output.css contains HTML instead of CSS - attempting to recover from tarball..."
|
||||
# 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
|
||||
# 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 "<!DOCTYPE\|<html\|<head"; then
|
||||
print_success "CSS file recovered and verified."
|
||||
chown "$PULSE_USER":"$PULSE_USER" "$PULSE_DIR/src/public/output.css"
|
||||
else
|
||||
print_error "CSS recovery failed. Installation will continue but frontend may not display correctly."
|
||||
fi
|
||||
else
|
||||
print_error "Failed to recover CSS file. Installation will continue but frontend may not display correctly."
|
||||
fi
|
||||
else
|
||||
print_info "CSS assets verified and ready."
|
||||
print_success "CSS assets verified and ready."
|
||||
fi
|
||||
|
||||
print_success "Tarball installation completed successfully."
|
||||
|
||||
Reference in New Issue
Block a user