2024-04-21 23:06:44 +01:00
|
|
|
#!/bin/bash
|
2023-12-18 14:52:18 +00:00
|
|
|
|
2025-03-25 17:57:17 +00:00
|
|
|
export JAVA_TOOL_OPTIONS="${JAVA_BASE_OPTS} ${JAVA_CUSTOM_OPTS}"
|
|
|
|
echo "running with JAVA_TOOL_OPTIONS ${JAVA_BASE_OPTS} ${JAVA_CUSTOM_OPTS}"
|
|
|
|
|
2024-03-08 20:49:19 +00:00
|
|
|
# Update the user and group IDs as per environment variables
|
|
|
|
if [ ! -z "$PUID" ] && [ "$PUID" != "$(id -u stirlingpdfuser)" ]; then
|
2024-03-10 14:00:00 +00:00
|
|
|
usermod -o -u "$PUID" stirlingpdfuser || true
|
2024-03-08 20:49:19 +00:00
|
|
|
fi
|
|
|
|
|
2024-04-21 23:06:44 +01:00
|
|
|
|
2024-03-09 14:03:46 +00:00
|
|
|
if [ ! -z "$PGID" ] && [ "$PGID" != "$(getent group stirlingpdfgroup | cut -d: -f3)" ]; then
|
2024-03-10 14:00:00 +00:00
|
|
|
groupmod -o -g "$PGID" stirlingpdfgroup || true
|
2024-03-08 20:49:19 +00:00
|
|
|
fi
|
2024-03-10 14:00:00 +00:00
|
|
|
umask "$UMASK" || true
|
2024-03-08 20:49:19 +00:00
|
|
|
|
2024-06-01 12:38:10 +01:00
|
|
|
if [[ "$INSTALL_BOOK_AND_ADVANCED_HTML_OPS" == "true" && "$FAT_DOCKER" != "true" ]]; then
|
2024-07-20 09:56:39 +01:00
|
|
|
echo "issue with calibre in current version, feature currently disabled on Stirling-PDF"
|
|
|
|
#apk add --no-cache calibre@testing
|
2024-03-04 20:51:49 +00:00
|
|
|
fi
|
|
|
|
|
2024-06-01 12:38:10 +01:00
|
|
|
if [[ "$FAT_DOCKER" != "true" ]]; then
|
refactor: move modules under app/ directory and update file paths (#3938)
# Description of Changes
- **What was changed:**
- Renamed top-level directories: `stirling-pdf` → `app/core`, `common` →
`app/common`, `proprietary` → `app/proprietary`.
- Updated all path references in `.gitattributes`, GitHub workflows
(`.github/workflows/*`), scripts (`.github/scripts/*`), `.gitignore`,
Dockerfiles, license files, and template settings to reflect the new
structure.
- Added a new CI job `check-generateOpenApiDocs` to generate and upload
OpenAPI documentation.
- Removed redundant `@Autowired` annotations from `TempFileShutdownHook`
and `UnlockPDFFormsController`.
- Minor formatting and comment adjustments in YAML templates and
resource files.
- **Why the change was made:**
- To introduce a clear `app/` directory hierarchy for core, common, and
proprietary modules, improving organization and maintainability.
- To ensure continuous integration and Docker builds continue to work
seamlessly with the reorganized structure.
- To automate OpenAPI documentation generation as part of the CI
pipeline.
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/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/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] 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/devGuide/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/devGuide/DeveloperGuide.md#6-testing)
for more details.
2025-07-14 21:53:11 +02:00
|
|
|
/scripts/download-security-jar.sh
|
2024-06-01 12:38:10 +01:00
|
|
|
fi
|
2023-12-18 14:52:18 +00:00
|
|
|
|
2024-04-21 23:06:44 +01:00
|
|
|
if [[ -n "$LANGS" ]]; then
|
2024-06-01 12:38:10 +01:00
|
|
|
/scripts/installFonts.sh $LANGS
|
2024-04-21 23:06:44 +01:00
|
|
|
fi
|
|
|
|
|
2024-03-13 22:09:56 +00:00
|
|
|
echo "Setting permissions and ownership for necessary directories..."
|
2025-06-25 18:32:28 +01:00
|
|
|
# Ensure temp directory exists and has correct permissions
|
|
|
|
mkdir -p /tmp/stirling-pdf || true
|
2024-04-21 23:06:44 +01:00
|
|
|
# Attempt to change ownership of directories and files
|
2025-06-25 18:32:28 +01:00
|
|
|
if chown -R stirlingpdfuser:stirlingpdfgroup $HOME /logs /scripts /usr/share/fonts/opentype/noto /configs /customFiles /pipeline /tmp/stirling-pdf /app.jar; then
|
|
|
|
chmod -R 755 /logs /scripts /usr/share/fonts/opentype/noto /configs /customFiles /pipeline /tmp/stirling-pdf /app.jar || true
|
2024-04-21 23:06:44 +01:00
|
|
|
# If chown succeeds, execute the command as stirlingpdfuser
|
2024-03-13 22:09:56 +00:00
|
|
|
exec su-exec stirlingpdfuser "$@"
|
|
|
|
else
|
|
|
|
# If chown fails, execute the command without changing the user context
|
|
|
|
echo "[WARN] Chown failed, running as host user"
|
|
|
|
exec "$@"
|
|
|
|
fi
|