Skip to content

Conversation

@oyarzun
Copy link
Contributor

@oyarzun oyarzun commented Sep 21, 2025

Adds an embedded tar script packager.

  • Installer run as normal user it defaults to ~/.local/appdir
  • Installer run with sudo it defaults to /usr/local/appdir
  • Install desktop file

Copy link
Member

@neilcsmith-net neilcsmith-net left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, interesting idea. Sorry for the delay. I've not got a lot of time for NetBeans things at the moment, but had a glance through. Few concerns, but nothing major.

We were discussing getting a first non-beta release out, which involves removing a few deprecated options first. Not sure if this should merge before or after that release.

I was wondering whether we could reduce duplication of some of these options by having some shared Linux options. That might require some thought given the current structure, and might not be worth the trouble. Depends if we might expect more Linux package types in future.

* @param template script template
* @return script with unescaped variables
*/
public static String unescapeScriptVars(String script)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be removed. It should be unnecessary. The API should give you the option to leave unmatched tokens in place already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still needed to avoid replacing bash variables that are used when the end user is using the installer script to install the software. Since the user is allowed to choose where to install the software some variables need to be interpreted as bash variables at runtime. e.g.
LAUNCHER=${{INSTALL_PATH}}/launcher/${APP_DIR} gets replaced with LAUNCHER=${INSTALL_PATH}/launcher/app_dir in the installer script.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I understand what you're trying to do, but that should happen anyway without this extra code as long as the token is not present during packaging - eg. see the test at

text = "${package.name} execution token ${EXEC}.";
processed = ctxt.replaceTokens(text);
assertEquals("Apache NetBeans execution token ${EXEC}.", processed);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, I did not realize only a preset list of tokens are replaced. I'll remove it and update the templates.

Copy link
Member

@neilcsmith-net neilcsmith-net Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's StringUtils::replaceTokens where you want to leave any unmatched tokens as they are, and StringUtils::replaceTokensOrFail for where all tokens must be pre-defined. It was done like this to allow shell scripts and other contexts where the same ${...} is needed.

Ideally, think about the naming in the script templates to make it clear which are replaced at build time though if you need both. Maybe the additional tokens like APP_DIR should be lower case in this one? Or make sure they all start with APP_?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I've switch to lowercase for local bash variables, used package.tar.* for tokens, and _var_ for sed regex replacements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants