Page 1 of 1

How to build the AppDir from snap package of cctv-viewer?

Posted: Wed Apr 24, 2024 6:19 pm
by dcung

So, I saw this and thought to try it with cctv-viewer
viewtopic.php?t=9043

I used fresh fugal install Bullseye DDOG (with sytemd)

Code: Select all

curl -H 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/cctv-viewer >> cctv-viewer.info

Download the snap package (approx 288MB), renamed as sfs, extract content (approx 735MB) to /usr/share/cctv-viewer

I copy Fred's script, substituted spotify with cctv-viewer.
Gave it execute permission.

Code: Select all

#!/bin/sh
LAUNCHDIR="$(dirname "$(readlink -f "$0")")"
export SNAP_LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LAUNCHDIR/command-chain:$LAUNCHDIR/usr/share/cctv-viewer:$LAUNCHDIR/lib:$LAUNCHDIR/usr/lib:$LAUNCHDIR/lib/x86_64-linux-gnu:$LAUNCHDIR/usr/lib/x86_64-linux-gnu"
export LD_LIBRARY_PATH="$LAUNCHDIR/lib/x86_64-linux-gnu:$LAUNCHDIR/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH
exec $LAUNCHDIR/usr/share/cctv-viewer/cctv-viewer "$@"

Got this when running script. The path doesn't look right...duplicated?
What did I do wrong?

2024-04-24-141816_797x155_scrot.png
2024-04-24-141816_797x155_scrot.png (25.92 KiB) Viewed 658 times

.
.

2024-04-24-141306_503x445_scrot.png
2024-04-24-141306_503x445_scrot.png (56.99 KiB) Viewed 658 times

Re: How to build the AppDir from snap package of cctv-viewer?

Posted: Wed Apr 24, 2024 6:30 pm
by fredx181

@dcung it's difficult, there's no general rule ,I think, how snaps are built, experimenting with different paths until it works (for portable) is probably the only way.
edit: perhaps last line without $LAUNCHDIR exec usr/share/cctv-viewer/cctv-viewer "$@"


Re: How to build the AppDir from snap package of cctv-viewer?

Posted: Wed Apr 24, 2024 6:37 pm
by dcung

Ah...okay... :D

I suspected that when I saw you wrote there

Code: Select all

...it's not a straight-forward thing... 

Ok...I'll try again when I'm really really really bored then... :lol:

Thanks Fred!


Re: How to build the AppDir from snap package of cctv-viewer?

Posted: Thu Apr 25, 2024 4:48 am
by wiak
dcung wrote: Wed Apr 24, 2024 6:37 pm

Ah...okay... :D

I suspected that when I saw you wrote there

Code: Select all

...it's not a straight-forward thing... 

Ok...I'll try again when I'm really really really bored then... :lol:

Nevertheless, perhaps the information in the following will help you (I used this for getting a cherrytree notebook snap package a long time ago):

https://unix.stackexchange.com/question ... -with-wget

and see related forum thread: viewtopic.php?t=219

Of course, if you don't want to ease the issue of downloading via snapd installed system, the curl followed by wget method described in that unix.stackexchange.com page is one way to go. Best to script that or make a user-friendly yad or gtkdialog GUI for that too (I'd suggest yad - since gtkdialog is going to die sooner or later).

The packagename.info file that the curl line downloads is one big annoying-to-read blob, though simply loading that in geany allows you to see the various https:// links for the .snap you can then use to wget -c https://package_whatever.snap or it can be filtered via sed/awk for example, though I've never bothered. The 'jq' program mentioned in that link, certainly makes the info file more readable (parses it) and jq is a tiny download (less than a couple of MB) on WeeDogLinux Arch 64 anyway.


Re: How to build the AppDir from snap package of cctv-viewer?

Posted: Thu Apr 25, 2024 6:12 am
by dcung
fredx181 wrote: Wed Apr 24, 2024 6:30 pm

edit: perhaps last line without $LAUNCHDIR exec usr/share/cctv-viewer/cctv-viewer "$@"

I did that when I saw the 'duplicate/path too long' error.
I should have mentioned it before...sorry.
When run w/o $LAUNCHDIR exec /usr/share/cctv-viewer/cctv-viewer "$@"

2024-04-25-160725_747x117_scrot.png
2024-04-25-160725_747x117_scrot.png (20.91 KiB) Viewed 577 times

Re: How to build the AppDir from snap package of cctv-viewer?

Posted: Thu Apr 25, 2024 6:17 am
by dcung
wiak wrote: Thu Apr 25, 2024 4:48 am

Nevertheless, perhaps the information in the following will help you (I used this for getting a cherrytree notebook snap package a long time ago):
https://unix.stackexchange.com/question ... -with-wget
and see related forum thread: viewtopic.php?t=219

Yes, I read that already - see my OP - it's the 'same link' to the thread.
That thread was what tickled my interest to begin with. :)

I can only get to download the snap package, turned it into sfs...but not able to make it run yet.

Thanks anyway @wiak


Re: How to build the AppDir from snap package of cctv-viewer?

Posted: Thu Apr 25, 2024 8:16 am
by fredx181
dcung wrote:

When run w/o $LAUNCHDIR exec /usr/share/cctv-viewer/cctv-viewer "$@"
...

The "segmentation fault" *possibly* indicates that you did right setting up the variables, paths etc.. (edit: but not sure, often the binary in in usr/bin, not in usr/share)
Anyway, problem is with the snaps that they often work only on Ubuntu (designed for, I think) , if some snap does work on Debian, you're just lucky, I guess.


Re: How to build the AppDir from snap package of cctv-viewer?

Posted: Thu Apr 25, 2024 9:08 am
by dcung
fredx181 wrote: Thu Apr 25, 2024 8:16 am

The "segmentation fault" *possibly* indicates that you did right setting up the variables, paths etc.. (edit: but not sure, often the binary in in usr/bin, not in usr/share)
Anyway, problem is with the snaps that they often work only on Ubuntu (designed for, I think) , if some snap does work on Debian, you're just lucky, I guess.

I have few 'proven' ways to run cctv-viewer.
Just thought to add one more when I came across that thread I referred to in OP and learn in the process.
Oh..well... :ugeek: