Yuri Marx · Jan 29, 2021

Is it possible do apt-get install using ZPM?

ZPM is a fantastic package management product. I have 7 apps published and these apps not using zpm because it need install external products using apt-get install.

Is it possible do apt-get install using ZPM?

Product version: IRIS 2020.4
0 145
Discussion (4)2
Log in or sign up to continue

Short answer: yes, ZPM can manage whatever you want other than ObjectScript, it just takes a little extra work.

Longer answer:

This "extra work" involves writing a class that extends %ZPM.PackageManager.Developer.Processor.Abstract and overrides OnBeforePhase or OnAfterPhase, then implementing whatever behavior you want. You can see a bunch of classes in the %ZPM.PackageManager.Developer.Processor package that do this.

I'd imagine being able to put something in the Resources element of module.xml like:

<Resource Name="/external-dependencies/some-package" ProcessorClass="MyPackage.AptGetInstall" />

Where MyPackage.AptGetInstall overrides OnAfterPhase and for the "Activate" phase runs apt-get install <name of resource following "/external-dependencies/"

The catch:

If you want to support all operating systems, think about what the Windows equivalent would be and/or add defensive coding to avoid trying to run the command on Windows.

My workaround was to place apt-get into Dockerfile as User root

This workaround is very common. My question is: if you run the zpm command from another iris instance is it works? 

I probably don't understand what you try to achieve.
To my understanding ZPM is targeted to IRIS and its applications and
NOT to the underlying operating system.
- Though I admit that a lot of "hacking" into the OS is possible from IRIS. 

With the broad range of operating systems supported by IRIS, 
I rate this as a rather questionable approach, that I wouldn't support.