Leveraging createfile to create a file in macOS to use as part of a relevance

Hey everyone, so I have a macOS application that it doesn’t install as .app and therefore I can’t get a file version from it, at least that’s how I understand it to be and I am no mac genius. :person_shrugging:

I have a custom fixlet that installs this application but I have no way of getting a mac from dropping off as it as being no longer relevant to this fixlet. I was thinking about using createfile to create a txt file that resides in the application path of this app and then use relevance to say that if the file exists then it’s no longer relevant to require this application.

This is what I want to use

delete __createfile
createfile until EOF_EOF_EOF
25.1.0.653
EOF_EOF_EOF

move __createfile opt/pi-v25.1.0.653.txt

Then I’ll have the fixlet check for the existence of the file, if exists then app is installed and fixlet is no longer relevant.

Is this the correct way of going about this?

Thanks!

So I just ended up trying it out and it worked as expected.

Just had to modify the path to include “/” before opt to

**/**opt/pi-v25.1.0.653.txt

Then modified my relevance

not exists file “/opt/pi-v25.1.0.653.txt”

and bazinga! macs dropping like flies when no longer relevant :slight_smile:

What I understand is, you don’t need to be an expert in everything, and you can’t be! Whenever I receive a packaging request or am tasked with building a package, my first question to the requester is, ‘How do we detect it?’ Based on that, we can create relevance detection criteria. Generally, the requester has to provide this information. If you are the initiator, then you should be looking into its documentation or searching for its detection criteria.

Creating a file to indicate whether installation is done or not is one approach, but it should be your last resort. The possibility exists that whatever you are trying to install might already be there with a different version or in a different location, which can lead to conflicts or multiple installations of the same app with different versions.

The best approach is to learn the basics of the app: where it’s going to be installed, where it stores version information, what processes will be running in the background, etc. and on top of that you can keep your installation file to say installed version or not exists file with specific label.

1 Like