SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
About VERSION, ID, SNAP_VERSION, etc...
save it as snap-find.py
Thanks a lot!
I sent a mail to the slackbuild maintainer with the link of this thread. But I don't know how easy would be to maintain an updated slackbuild in the slackbuilds.org style (with a static "source" download link). For example, when a new version is released, the download link of the old version would still be valid or it will disappear?
import sys
import requests
import json
if len(sys.argv) != 2:
print("Usage: python snap-find.py <package>")
sys.exit(1)
snap_name = sys.argv[1]
url = f"https://api.snapcraft.io/api/v1/snaps/details/{snap_name}"
# hm...
headers = {
"X-Ubuntu-Series": "16"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
snap_details = response.json()
# Convert JSON to a more human-readable format
for key, value in snap_details.items():
if isinstance(value, list):
value = ', '.join(value)
elif value is None:
value = "None"
elif isinstance(value, bool):
value = "True" if value else "False"
print(f"{key}: {value}")
else:
print(f"Error: {response.status_code}")
import json in python (which I hate tbh...)
now we have a better output for example for minecraft
All infos are here (better format) this way for every snap package. Now if you can install it, thats other question...
But thats why we are here, to help each other #slack-rulles
I sent a mail to the slackbuild maintainer with the link of this thread. But I don't know how easy would be to maintain an updated slackbuild in the slackbuilds.org style (with a static "source" download link). For example, when a new version is released, the download link of the old version would still be valid or it will disappear?
I think thats up to every developer policy...
But now we dont speaking for general , but for 1-3 specific packages that we have to build from snap or no package...
In such case , I think there is a SlackBuild repo for source code old and abandonment or specially packages etc
If maintainer want and agree can store there the *.snap so even if new package exist in snap repo and old is deleted we have np...
But of cource we are speaking for a few maybe only one (skype) packages that there is a real problem because only snap exist and nothing else...
In any case that is "my opinion" but SBo people knows better than me and everything they decide that the correct...
EDIT:
Quote:
Originally Posted by theodore.s
Or you could just print the values needed for the slackbuild, without importing json:
import sys
import requests
# Slackware snap-find command :D
# Run python3 snap-find.py <package>
# First line is what you need:
# {'aliases': None, 'anon_download_url': 'https://api.snapcraft.io/api/v1/snaps/download/QRDEfjn4WJYnm0FzDKwqqRZZI77awQEV_348.snap', 'apps':
# If you see "Error: 404" means package has different name.
# και τώρα ξέρεις ;)
if len(sys.argv) != 2:
print("Usage: python snap-find.py <package>")
sys.exit(1)
snap_name = sys.argv[1]
url = f"https://api.snapcraft.io/api/v1/snaps/details/{snap_name}"
# hm...
headers = {
"X-Ubuntu-Series": "16"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
snap_details = response.json()
print(snap_details['version'])
print(snap_details['download_url'])
print(snap_details['snap_id'])
print(snap_details['revision'])
else:
print(f"Error: {response.status_code}")
And use this as skypeforlinux.SlackBuild:
Code:
#!/bin/bash
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=skypeforlinux
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
TAG=${TAG:-_snap}
PKGTYPE=${PKGTYPE:-tlz}
TMP=${TMP:-/tmp/snap}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
BUILD=${BUILD:-3}
declare RESULT=($(/usr/bin/python3 ./snap-find.py skype))
VERSION=${RESULT[0]}
DLINK=${RESULT[1]}
ID=${RESULT[2]}
SNAP_VERSION=${RESULT[3]}
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
if [ "$ARCH" != "x86_64" ]; then
echo "$ARCH is not supported."
exit 1
fi
set -e
rm -rf $TMP $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
wget -c "$DLINK"
unsquashfs "$ID"_"$SNAP_VERSION".snap
mkdir -p $PKG/opt
mkdir -p $PKG/usr/share/applications/
mkdir -p $PKG/usr/share/icons/"$PRGNAM"
mv $TMP/squashfs-root/usr/share/skypeforlinux -t $PKG/opt/
cp $TMP/squashfs-root/meta/gui/skypeforlinux.png $PKG/usr/share/icons/"$PRGNAM"/
cp $TMP/squashfs-root/meta/gui/skypeforlinux.desktop $PKG/usr/share/applications/
sed -i -E 's/^Exec=.*/Exec=\/opt\/skypeforlinux\/skypeforlinux/; s/^Icon=.*/Icon=skypeforlinux/' $PKG/usr/share/applications/skypeforlinux.desktop
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
mv squashfs-root/usr/share/doc/* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l n -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
...to build a Slackware package from the latest snap in one step.
I used to use skype a lot, but never bother to install a dedicated app. The web interface is good enough for my usage https://web.skype.com/, in case someone does not know about it. Besides, new skype is based on Electron, which basically is running a browser instance inside.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.