mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-10-25 11:17:28 +02:00 
			
		
		
		
	# Description of Changes Introduces TempFileManager, registry, and scheduled cleanup service; aligns all Docker images and runtime scripts to use a dedicated /tmp/stirling-pdf directory; updates controllers, utilities, and tests to use the new API; adds configurable system.tempFileManagement section. Closes #(issue_number) --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: a <a>
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| # Copy the original tesseract-ocr files to the volume directory without overwriting existing files
 | |
| echo "Copying original files without overwriting existing files"
 | |
| mkdir -p /usr/share/tessdata
 | |
| cp -rn /usr/share/tessdata-original/* /usr/share/tessdata
 | |
| 
 | |
| if [ -d /usr/share/tesseract-ocr/4.00/tessdata ]; then
 | |
|         cp -r /usr/share/tesseract-ocr/4.00/tessdata/* /usr/share/tessdata || true;
 | |
| fi
 | |
| 
 | |
| if [ -d /usr/share/tesseract-ocr/5/tessdata ]; then
 | |
|         cp -r /usr/share/tesseract-ocr/5/tessdata/* /usr/share/tessdata || true;
 | |
| fi
 | |
| 
 | |
| # Check if TESSERACT_LANGS environment variable is set and is not empty
 | |
| if [[ -n "$TESSERACT_LANGS" ]]; then
 | |
|   # Convert comma-separated values to a space-separated list
 | |
|   SPACE_SEPARATED_LANGS=$(echo $TESSERACT_LANGS | tr ',' ' ')
 | |
|   pattern='^[a-zA-Z]{2,4}(_[a-zA-Z]{2,4})?$'
 | |
|   # Install each language pack
 | |
|   for LANG in $SPACE_SEPARATED_LANGS; do
 | |
|      if [[ $LANG =~ $pattern ]]; then
 | |
|       apk add --no-cache "tesseract-ocr-data-$LANG"
 | |
|      else
 | |
|       echo "Skipping invalid language code"
 | |
|      fi
 | |
|   done
 | |
| fi
 | |
| 
 | |
| # Ensure temp directory exists with correct permissions before running main init
 | |
| mkdir -p /tmp/stirling-pdf || true
 | |
| chown -R stirlingpdfuser:stirlingpdfgroup /tmp/stirling-pdf || true
 | |
| chmod -R 755 /tmp/stirling-pdf || true
 | |
| 
 | |
| /scripts/init-without-ocr.sh "$@" |