Hi,
I want to publish a new snap that needs
- block-devices
- mount-observe
To be able to list the utilisation of drives on a host:
Please have a look at the manual reviewHere is the snap’s home: https://snapcraft.io/list-filesystem
Hi,
I want to publish a new snap that needs
To be able to list the utilisation of drives on a host:
Please have a look at the manual reviewHere is the snap’s home: https://snapcraft.io/list-filesystem
+1 for use of and auto-connect of mount-observe
for list-filesystems
.
+1 for use of but not auto-connect of block-devices
for list-filesystems
as this effectively gives the ability to modify any storage device on the system hence grants device ownership to the snap publisher. If this is absolutely required you could try and detect whether it is connected via snapctl is-connected block-devices
and then prompt the user to manually connect it.
@alexmurray It does not need to automatically connect. Is there a guide explaining how to prompt users? I’ve in the past seen some snap installs prompt me. I usually add the commands as needed in the snap’s info section.
assuming lfs is a cli tool, you’d add a command-chain wrapper script like:
#! /bin/sh
if ! snapctl is-connected block-devices; then
echo "please run: sudo snap connect $SNAP_NAME:block-devices"
echo "without this permission $SNAP_NAME can not run"
exit 1
fi
exec $@
+1 from me as well for use and auto-connect of mount-observe
to list-filesystem
since its clearly required for listing drives utilization. +2 votes for, 0 votes against, granting auto-connect of mount-observe
to list-filesystem
. This is now live.
+1 from me as well for use but not auto-connect of block-devices
to list-filesystem
. +2 votes for, 0 votes against, granting use of of block-devices
to list-filesystem
. This is now live.
@faramirza could you please upload a new revision or request a manual review so the changes take effect? Thanks!
@emitorino @ogra I updated the snapcraft.yml
apps:
lfs:
command: bin/lfs
command-chain:
- local/lfs-wrapper
plugs:
- block-devices # Needed by lfs to read block devices
- mount-observe # Needed by lfs to read block devices
lfs-wrapper:
plugin: dump
source: snap/local/
organize: bin/
. Do you have an example how to implement a command-chain wrapper script? I’ve looked at how other snaps do it, like OBS, but I’m not 100% sure what is needed. Do I add the script in local and reference it like I’ve done here?
well, yu organize it to bin/ so it will end up inside bin/ in the snap … make your command-chain entry reflect tat and you should be good (and indeed dont forget t make the script executable)