2

I am using a series of CURL request to create my package.

What I am doing currently: I created a new package, added filters to it and then built the package.

Create package:

curl -f -N -u ${USER}:${PASS} -d "packageName=${PACKAGE}&groupName=${GROUP}" "${CMS_HOST}/crx/packmgr/service/exec.json?cmd=create"

Apply Filters:

curl -f -N -u ${USER}:${PASS} -F "path=/etc/packages/${GROUP}/${PACKAGE}.zip" -F "packageName=${PACKAGE}" -F "groupName=${GROUP}" -F "version=" -F "description=" -F "thumbnail=" -F "filter=${FILTER}" -F "_charset_=UTF-8" "${CMS_HOST}/crx/packmgr/update.jsp"

Build Package:

curl -f -N -u ${USER}:${PASS} -d "cmd=build" "${CMS_HOST}/crx/packmgr/service/script.html/etc/packages/${GROUP}/$PACKAGE.zip"

What I want to do: Add more filters to this package and build it again.

I am wondering if there is a way to update an existing package. I have been searching around to see how we can do this but have failed. Can someone please help me?

Thanks.

Update: Added the CURL commands I am using.

VAr
  • 2,551
  • 1
  • 27
  • 40
Blueboye
  • 1,374
  • 4
  • 24
  • 49

2 Answers2

2

Here you go with an example where i have a package with two filters already Package with filters

Going to add another filter

CURL for Create a Filter Node

curl --data jcr:primaryType=nt:unstructured --user admin:admin http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2

Add the Filter properties

curl -u admin:admin -Froot="/content/geometrixx-outdoors/en/toolbar" http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2.rw.html

IF required add additional properties (i.e. "mode" & "rules") for the Default package behaviour

curl -u admin:admin -Fmode="replace" http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2.rw.html

curl -u admin:admin -Frules@TypeHint="String[]" -Frules=" " -Frules=" "http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2.rw.html

Finally build your package to affect additional filter to add to your existing package

curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/testcurl.zip?cmd=build

Final updated package

VAr
  • 2,551
  • 1
  • 27
  • 40
  • Thanks for your reply. This helped a lot :) – Blueboye Jan 17 '17 at 19:43
  • Now, I am writing a script in Ruby and converting the CURL commands to POST requests. I could get everything working except for curl -u admin:admin -Frules@TypeHint="String[]" -Frules=" " -Frules=" "http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2.rw.html. I am not able to pass the "rules" array. Any idea how can I do it? – Blueboye Jan 17 '17 at 19:50
1

All the packages are stored under /etc/packages/my_packages path which can be modified by standard curl commands for node management. All packages have filters as sub-nodes.

All package manager commands are available via /crx/packmgr/service.jsp?cmd=help

For example, in order to build a package use /crx/packmgr/service.jsp?cmd=build

Imran Saeed
  • 3,414
  • 1
  • 16
  • 27
  • Yes. I have been there. I have updated my question with the CURL commands I am using. Once I have built the package, if I want to add more filters to the SAME package how can I do it? Currently, if I run the above mentioned 'Apply filter' command, it overwrites the existing filters. It looks like it is in some kind of overwrite mode instead of update/append mode. – Blueboye Jan 16 '17 at 15:34
  • You can use curl data post like `curl --data "jcr:primaryType=nt:unstructured&mode=replace" --user : /etc/packages/my_packages/.zip/jcr:content/vlt:definition/filter/**f0**` where **f0** is the path of new filter you want to add. All new filters are added as f**N** where **N** is incremental – Imran Saeed Jan 16 '17 at 15:53