Skip to content

"AM" 11 - #3070

Merged
ivan-hc merged 47 commits into
mainfrom
dev
Dec 2, 2026
Merged

"AM" 11#3070
ivan-hc merged 47 commits into
mainfrom
dev

Conversation

@ivan-hc

@ivan-hc ivan-hc commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Rework of https://github.com/ivan-hc/AM/pull/3020/changes

Support has been introduced for AppImage packages, which can be renamed to .real if they are replaced by a script.

To-do (steps):

  • checksum support
  • option -f support
  • adding --env option to create and handle such scripts
  • option --sandbox support
    • sandbox AppImages without the need of root privileges
  • fix --env usage in management.am
    • option --rollback support
    • option nolibfuse support
    • options -H and -C support
  • consider potential use cases when an AppImage requires FUSE2:
    • apply the wrapper after an installation/reinstallation
  • add sub-options for --env, or refine it
  • write the documentation for --env
  • add --env to the help message and translations

Let’s hope this is the right time.

fix #2832

@ivan-hc

ivan-hc commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Now that the foundation is in place (checksums, the -f flag, and portable directories), we need to introduce:

  1. a template for the script to be used;
  2. a function to handle its creation (accounting for any "legacy" sandboxes and portable directories that may need renaming);
  3. use cases for this function (sandboxing, installing applications that depend on FUSE2, and a dedicated option that users can employ as they see fit).

@cheack @vishnu350 , would you like to lend a hand?

The function is now able to recognize the two types of installations.

Now it is time to take action.
@ivan-hc

ivan-hc commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

The function _use_env is now able to recognize if the AppImage is "$APPIMAGE" or "$APPIMAGE.real".

Its not much but it is a first step to recognize what file we have to check, in a way to apply the needed actions.

In first, I would like to recognize the AppImages involved with the "legacy" sandbox method.

@ivan-hc

ivan-hc commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

The option --env is now able to create the script: this is the content

	#!/bin/sh

	if [ -f $APPIMAGE.real ] && head -c10 $APPIMAGE.real 2>/dev/null | grep -qa '^.ELF....AI$' && head -c1000000 $APPIMAGE.real 2>/dev/null | grep -qa 'AppImages require FUSE to run'; then
	  export APPIMAGE_EXTRACT_AND_RUN=1
	fi

	[ -d $APPIMAGE.cache ] && export XDG_CACHE_HOME="$APPIMAGE.cache"
	[ -d $APPIMAGE.config ] && export XDG_CONFIG_HOME="$APPIMAGE.config"
	[ -d $APPIMAGE.home ] && export HOME="$APPIMAGE.home"
	[ -d $APPIMAGE.share ] && export XDG_DATA_HOME="$APPIMAGE.share"

	[ -f $APPIMAGE.env ] && . $APPIMAGE.env
	[ -f $APPIMAGE.sandbox ] && . $APPIMAGE.sandbox

	exec $APPIMAGE.real $@

of course, $APPIMAGE is replaced with the full path to the app.

The script is also able to run AppImages that require libfuse2.

Also, .home and .config directories are exported if present.

@Samueru-sama please see if the XDG settings are OK. Thanks.

@ivan-hc

ivan-hc commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

In my previous commits I added backup and reinstallation of .sandbox files that will be sourced by the AppImage's wrapper, during the reinstallation.

Now it is time to work on sandboxing. To do so I will need to rewrite the sandbox script.

As an approach, I will convert all main instructions to a function named exec, since the wrapper runs the .real AppImage using exec. This is not different from many functions we already use in APP-MANAGER (see sed, less or file).

The --env option is already able to avoid existing legacy sandboxes. The user will need to re-sandbox the AppImage if it will need to use the new approach. Old behavior is safe until the next reinstallation.

@ivan-hc

ivan-hc commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

@cheack @vishnu350 I think I finally managed to support both legacy and new sandboxing support.

Please take a look at it for confirm.

@ivan-hc

ivan-hc commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

f01f24a

This change also works with reinstall. The AppImage runs in a sandbox after this change, also if its status is executable.

@kazam0180 @Samueru-sama @fiftydinar

Every time the installed AppImage is detected as dependent from FUSE2, it will be replaced with the wrapper.

@ivan-hc

ivan-hc commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

Now its time for sub-options or flags for the new --env option.

  • I think that it would be easy to reset the .env file (all we need is to detect and remove it, so it will be re-created again with defaults). A flag can be named --reset
  • About editing it, the user can do it manually, I was thinking to include a condition to use vi, vim, nano or whatever. A flag can be named --edit

Any suggestion or contribute is welcome.

@ivan-hc ivan-hc changed the title Add support to .real AppImages "AM" 11 Nov 26, 2026
@ivan-hc

ivan-hc commented Nov 27, 2026

Copy link
Copy Markdown
Owner Author

49e454b

USAGE:

am --env appname

to add the .real extension to the AppImage and replace it with a wrapper, plus the creation of a .env file to be sourced.

am --env --reset appname

to recreate the .env file.

am --env --edit appname

to edit the .env file with vim or nano, if installed.

@ivan-hc

ivan-hc commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

I haven’t added any warning messages; instead, I’ve simply included the instructions in the help message.

If you have anything else to suggest or add, please let me know. I’d like to get this release out as soon as possible.

@cheack @kazam0180 @Shikakiben @vishnu350 @fiftydinar @Samueru-sama

ivan-hc and others added 11 commits November 29, 2026 03:14
@ivan-hc

ivan-hc commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

We are ready!

"AM" 11 will be released in less than 24 hours from now.

@ivan-hc
ivan-hc merged commit 8ea3aa2 into main Dec 2, 2026
@ivan-hc
ivan-hc deleted the dev branch December 2, 2026 05:08
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.

Request: Option to set environment variables per installed app

3 participants