Snap include gnome-terminal

Hello I have an interactive bash backup script that requires bash to stay open when clicked on the icon…

Therefore I need to run the following command

gnome-terminal --geometry=130x50 --title="SMALLTARBKP" --command="bash -c 'smalltarbkp; $SHELL'"

How can I include gnome-terminal in the snap package I am trying to create?

Sorry either include gnome-terminal in the package or access it when launching the script :slight_smile:

As far as I know there is a simpler way to run a command in a shell, no need to bundle a terminal:

It worked for me

The only thing I need to fix is the terminal to start maximized. Can it be done in the .desktop file?

Ah, good point. Not that I can see:
Desktop Entry Specification

The only relevant item I have found is deprecated:

TerminalOptions (if the program runs in a terminal, any options that should be passed to the terminal emulator before actually executing the program)

Perhaps using gnome-terminal --geometry=130x50 is indeed the only option here.

The problem with that of course is that it won’t work if you don’t have gnome-terminal installed.

Thank you, I know I can do that, unfortunately, I need the session to stay open after the script execute the menu, that is why I found a solution using the gnome-terminal and calling the script in the way I mentioned.

gnome-terminal --geometry=130x50 --title="SMALLTARBKP" --command="bash -c 'smalltarbkp; $SHELL'"

I have gnome-terminal installed as I use ubuntu but it always return an error saying file not found even if i specify the full path, SNA is not aware of the system executable.

thank you but that is not what I am trying to do, I want to keep the terminal open after the script runs.

I understand now: --command="bash -c 'smalltarbkp; $SHELL'"

You could still:

  • Use Terminal=true to obtain a terminal.
  • Find a way to first run smalltarbkp then open a shell in that terminal.

About the latter:

  • Indeed the command key does not support multiple successive commands as far as I can see.
  • Yet you may create and run a script that would perform the complex task you’re after, instead of running smalltarbkp directly:
  • The most straightforward solution, similar to yours, would be to start bash and get it to run smalltarbkp first, something like this:
    command: bash -c '$SNAP/bin/smalltarbkp; $SHELL'
1 Like

thank you that worked a treat and while I managed to create the snap package and launch the smalltarbkp script and stay open as expected, this won’t work for me as the script it self requires to be self updating and the snap is a readonly script so won’t work :slight_smile:

Anyway thank you very much I really appreciated your help.