Call for help, snap of a CLI software (client, and server)

I’m having a hard time snapping ruptime, here’s what I have

and here’s upstream: GitHub - alexmyczko/ruptime: poor man’s ruptime

Any help/pointers are welcome, patches preferred.

Best, Alex

2 Likes

Hello from Reddit. Welcome to the forum!

What specific problems you’ve encountered?

2 Likes

i think i even fail to provide a binary named ruptime when installing the snap…

Regarding the following snapcraft error message:

Command '['snap', 'pack', '--filename', 'ruptime_1.8_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1.                                                     

If you actually run the command in the build environment it will argue that it can’t find the bin/ruptime file in the prime tree:

../project# snap pack --filename ruptime_1.8_amd64.snap --compression xz /root/prime /root/project
2024/08/11 02:05:39.242382 container.go:393: in snap "ruptime": path "bin/ruptime" does not exist
2024/08/11 02:05:39.242441 container.go:393: in snap "ruptime": path "bin" does not exist
error: cannot pack "/root/prime": snap is unusable due to missing files

Your snapcraft.yaml specifies the ruptime app command to be bin/ruptime:

apps:
  ruptime:
    command: bin/ruptime

However, the path isn’t existed in the prime tree, which appears to have the ruptime executable in at the root directory:

../project# tree ~/prime/
/root/prime/
├── Dockerfile
├── LICENSE.md
├── README.md
├── etc
│   ├── cron.d
    ...stripped...

├── ruptime
├── ruptimed

    ...stripped...

10 directories, 18 files

You can either:

  • Fix the ruptime command’s executable path in the app stanza
  • Adjust your ruptime part to move the ruptime executable to the bin directory under the prime tree

Hope it helps!

1 Like

cool so i’ve changed bin/ruptime to ruptime in command: what about having symlinks for ruptime, called runame, rhw, rsw, rbench, rload, rdisk, rboot, rac, rwho? what about also providing manpage?

aha this might help: https://snapcraft.io/docs/snap-layouts

where and how would i define the depends? https://ftp-master.debian.org/new/ruptime_1.8-1.html Depends: acct, bc, cron, dmidecode, memtester, netcat-openbsd | netcat-traditional, openssl, ucf, xz-utils

once that client works, next step is the web version and the daemon, as well as its configuration…

The proper way to do so is probably:

  1. Create those symlinks in the snap
  2. Declare app commands for each of these commands, with the app.appname.command property set to these symlinks

With this configuration you’ll be able to call these commands via the snapname.appname commands, in order to call these commands without the snapname. prefix you’ll have to request automatic aliasing in the store-requests subforum, refer the Process for aliases, auto-connections and tracks forum topic for the details.

Via the stage-packages part property, refer Snapcraft parts metadata | Snapcraft documentation for the format.

1 Like

ok the alias part sounds complicated, i’m probably faster just creating the symlinks within upstream, and then just installing them.

thanks for the stage-packages hint, i guess i’ll be able to set that up

now for amd64 i have edge version and stable version. how can i make the edge version the stable version?

eh ok almost good, but no not good:

lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rac -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rbench -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rboot -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rdisk -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rhw -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rload -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rnet -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rsw -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.runame -> /usr/bin/snap
lrwxrwxrwx 1 root root   13 Aug 11 15:00 ruptime.rwho -> /usr/bin/snap