snap documentation for 'try' needs more details
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
The snap 'try' documentation is a bit light on.
From my first read I assumed that if I ran snap try that I could then edit files in the 'prime' directory and any changes would immediately affect the running snap.
On further reading it appears that snap try installs a write able copy at /snap/<package name>/current
Can we change the documentation.
Current doco:
The try command installs an unpacked snap into the system for testing purposes. The unpacked snap content continues to be used even after installation, so non-metadata changes there go live instantly. Metadata changes such as those performed in snap.yaml will require reinstallation to go live.
If snap-dir argument is omitted, the try command will attempt to infer it if either snapcraft.yaml file and prime directory or meta/snap.yaml file can be found relative to current working directory.
Once you are done testing the installed unpacked snap, it can be uninstalled with the remove option.
-------
Suggested changes - feel free to make any changes you feel appropriate.
The try command installs an unpacked snap into the the directory '/snap/<package name>/current'
for testing purposes.
You can then directly edit files in the /snap/<package name>/current directory to test changes without going through a full build cycle.
Metadata changes such as those performed in snap.yaml will require reinstallation to go live.
If your snap is a daemon, in most cases, you will need to restart the daemon for the changes to take affect.
snap restart <package name>
When running 'snap try', if the snap-dir argument is omitted, the try command will attempt to infer it by looking under the current working directory for either the snapcraft.yaml file and prime directory or meta/snap.yaml.
In most cases you want need to run:
cd <snap project>
snap try --devmode prime
Once you are done testing the installed unpacked snap, it can be uninstalled with the remove option.
snap remove <package name>
Running 'snap try prime' will cause your snap to be installed into:
/snap/<package name>/current
affects: | snap (Ubuntu) → snapd (Ubuntu) |
Actually, the content for snap try is bind-mounted (or at least it is now, I'm not sure if that was the case when this was first reported or not I think it has always been that way but I'm not sure).
You should still be able to edit files in the prime (or whatever dir is bind-mounted from `snap try <dir>`) and it should show up in the /snap/< snap-name> /current directory due to the bind-mount.
We could adjust the doc help to explain that it is bind-mounted, would that be helpful?