Unsquashfs and access to the specific directory

Hi there I have created snap file containing game. Most of the files to run a game are in snap file but cannot be accessed

I did squashfs on snap file to get directory of those files. squashfs-root/usr/local/lib/name_of_game/

Those files inside this dir I need access to. Is there any way to get them to work just fine or I need to make extra workaround to make it happen ?

PS: There is also bin dir in squashfs-root/usr/local/ which stores binaries to run a game and simply put I can launch a game just fine but those required file I need because it just error out about those files.

I have added aditional cmds into install hook but it did not seem to work.

cp -R $SNAP/usr/local/lib/etlegacy/legacy $SNAP_USER_DATA/.etlegacy
cp -R $SNAP/usr/local/lib/etlegacy/etmain $SNAP_USER_DATA/.etlegacy

Please be aware that the install hook really only runs at very first install of a snap … if you want to run additional commands on refresh of an already installed snap, use one of the refresh hooks instead …

Yes I learned about it.

But still no luck. It is like I need to run app after install to so it will create /.etlegacy dir for me

Here is updated section

mkdir $SNAP_USER_DATA/.etlegacy
cp -R $SNAP/usr/local/lib/etlegacy/legacy $SNAP_USER_DATA/.etlegacy
cp -R $SNAP/usr/local/lib/etlegacy/etmain $SNAP_USER_DATA/.etlegacy

Ah, hooks run as root, so they do indeed not have access to your SNAP_USER_DATA but will write to /root instead… so yeah, for copying user specific data you rather want to use a command-chain script that runs before start of the app

(Sorry, my brain kind of made me read SNAP_DATA when I looked at your code the first time)

Got it to copy stuff into dir but with some bugs [features included] :smiley:

apps:
etlegacy:
command-chain: &_command-chain
  - bin/graphics-core22-wrapper
  - bin/wayland-launch
  - bin/copy
command: &_command usr/local/bin/etl.x86_64

It is in /bin/copy Simple check for existing dirs and copying it over

But now I am not abble to run app.

1 Like

Got it working by moving bin/copy to command: &_command