Skip to content

Commit cfef425

Browse files
committed
Fix ImageMagick policy.xml path for version 7 support
The install script now detects whether ImageMagick 6 or 7 is installed and modifies the appropriate policy.xml file. This fixes installation failures on systems using ImageMagick 7 where the policy file is at /etc/ImageMagick-7/policy.xml instead of /etc/ImageMagick-6/policy.xml. Bump version to 1.1.0.
1 parent cc63a68 commit cfef425

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/imagemagick/NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This feature installs [ImageMagick](https://imagemagick.org/), a powerful image processing and manipulation library, along with Ghostscript for enhanced PDF support in container environments.
44

5+
**Supported Versions**: This feature supports both ImageMagick 6 and ImageMagick 7, automatically detecting and configuring the installed version.
6+
57
## Key Configuration
68

79
**PDF Processing Support**: The feature automatically configures ImageMagick to process PDF files by modifying the security policy, enabling PDF manipulation operations which are often restricted by default.

src/imagemagick/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "imagemagick",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"name": "imagemagick",
55
"description": "Installs imagemagick",
66
"options": {},

src/imagemagick/install.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ apt-get -y install --no-install-recommends ghostscript imagemagick
66
apt-get autoremove -y
77
rm -rf /var/lib/apt/lists/*
88

9-
# Enables ImageMagic to process PDF files
9+
# Enables ImageMagick to process PDF files
1010
# Ref. https://askubuntu.com/a/1181773
11-
sed -i 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml
11+
# Supports both ImageMagick 6 and 7
12+
if [ -f /etc/ImageMagick-6/policy.xml ]; then
13+
sed -i 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml
14+
elif [ -f /etc/ImageMagick-7/policy.xml ]; then
15+
sed -i 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' /etc/ImageMagick-7/policy.xml
16+
fi

0 commit comments

Comments
 (0)