ivan-hc / AM

AppImage package manager to install, update and manage ALL of them, system-wide or locally, thanks to its ever-growing AUR-inspired database listing 2500+ portable apps and programs for GNU/Linux. The first, real centralized repository to manage your AppImages with the ease of APT and the power of PacMan.
https://portable-linux-apps.github.io
GNU General Public License v3.0
515 stars 41 forks source link

Signal #996

Closed Twig6943 closed 1 month ago

Twig6943 commented 1 month ago

To help us make adding AppImages quicker and easier, please try to follow the following two syntaxes.

If available on Github.com

ivan-hc commented 1 month ago

hi, I can't see the AppImage

Twig6943 commented 1 month ago

an appimage doesnt exist (I was wondering if u could pacakge it)

ivan-hc commented 1 month ago

I'm actually trying to get rid of as many repositories as possible (too much work)

Twig6943 commented 1 month ago

ooh :+1:

ivan-hc commented 1 month ago

anyway, have you tried to use Archimage? https://github.com/ivan-hc/ArchImage maybe I can help you in case you have doubts

ivan-hc commented 1 month ago

It is preferable that whoever builds it knows what is needed to make it work as it should. I have never used Signal. Skype yes (and I have a repo).

Twig6943 commented 1 month ago

failed w archimage

ivan-hc commented 1 month ago

let me do a test

ivan-hc commented 1 month ago

I created this script

signal-desktop-junest.sh.txt

Signal is in the arch linux repos https://archlinux.org/packages/extra/x86_64/signal-desktop/ not an AUR package

to create the above script:

  1. name: signal-desktop
  2. name binary: leave blank, its the same
  3. dependences: none
  4. include all dependences: y
  5. use defaults: y

video:

https://github.com/user-attachments/assets/06308a6d-24db-417f-917c-8e1a9d78fe0b

AppImage is 296 MB

here is what happens when I run it

https://github.com/user-attachments/assets/b0d6474c-c7bc-4df0-bc91-bcde8d764176

to fix it you can start to read the logs and see what files are missing, like this

https://github.com/user-attachments/assets/fed38d05-bf11-4804-9846-93e55e14e6b0

it is looking for a missing module, contained into a package to search on google (or in my case startpage), in this case the package is xapp

all you need to do is to take note of the missing package and then add to dependences, like this

https://github.com/user-attachments/assets/bbe35505-d8f9-489c-9e31-ef5713a7cc3c

and as you can see, xapp is downloaded and then it wil be extracted with all the other packages listed during this process in the "deps" directory

the appimage is increased of 0,1 MB, let we see if it works...

https://github.com/user-attachments/assets/5c832f45-e3fa-4a10-8b16-69f381492685

also this time it is not working, but I've found that there is a missing library "libgnomekbdui", contained in the "libgnomekbd" arch linux package... so I'll do the same as I did with xapp

now the package is 296,2 MB... let we see if it runs...

https://github.com/user-attachments/assets/bad4d6cc-a16c-498b-a9fa-528894c3cb8f

this time it is missing the library "libudev.so", I'll add the keyword "libudev" to $LIBSAVED, to fetch all files containing this word, for this will be added all depending libraries and it too will be bundled in the appimage

in case it is not saved, search the package containing that library as I did with xapp

now the package is 296,3 MB... let se again

https://github.com/user-attachments/assets/bf6ff485-80b7-4c33-a753-19e8c2a08d74

magic!

If the app works, you are good with it, but it is suggested to find missing libraries.

Also, now that you know that it works, you can start debloating (play by running the AppRun script in the AppDir directory, use Baobab or something else to find the size of packages, try to move them elsewhere and run the AppRun, and see if it works... if it is ok, take note of all files you can remove, and the package will be smaller once you add them to the list "ADDITIONAL REMOVALS"

ivan-hc commented 1 month ago

The working script I got in the final video is now here https://github.com/ivan-hc/ArchImage/blob/main/drafts/signal-desktop-junest.sh

Now you know how to build an archimage correctly :)

Twig6943 commented 1 month ago

@ivan-hc compiling rn (tysm for the script)

ivan-hc commented 1 month ago

@ivan-hc compiling rn (tysm for the script)

???

Twig6943 commented 1 month ago

I mean packaging****

(signal-desktop-junest.sh)

ivan-hc commented 1 month ago

Consider this script as a gift

Seriously, I don't want to open more repositories. I have too many to maintain, and each of them has problems.

PS: I posted my comment as a "tutorial", I can't do better than that https://github.com/ivan-hc/ArchImage#tutorial

I've been building them for years and trying to build easy alternatives to package AppImages, adding tutorials and videos. But I've gotten to the point where I've created so many of them, and it's hard to keep up with all of them. Especially when github changes the "workflow" mechanism. I'm doing everything I can to reduce the number of active repositories.

Twig6943 commented 1 month ago

@ivan-hc wayland doesnt work with the appimage package image image

ivan-hc commented 1 month ago

try to add "wayland" as a dependency, or as a keyword

I am still on X11 btw (XFCE4.18).

Twig6943 commented 1 month ago

DEPENDENCES="wayland ca-certificates xapp libgnomekbd"

Still the same result with the --ozone-platform=auto

Twig6943 commented 1 month ago

also https://github.com/Twig6943/Signal-AppImage/releases/tag/1.0 (WIP pkg) (WIP cuz wayland doesnt work like I said)

ivan-hc commented 1 month ago

run it with LD_DEBUG=libs and see the missing library

you need to read the whole log and see where there is an error message, for example, in the appimage you provided, I've found that it have not "libxklavier"

Istantanea_2024-10-12_01-06-22 png

note the side bar of my terminal, I'm in the middle of the log

ivan-hc commented 1 month ago

NOTE, to made this search may take a whole day, also for me.

You need to read and understand each line. The last one I have pointed, as all of them, mean that the program is looking for a library to load. In this case "libxklavier". If it is in "junest-backups" you can add "libxklavier" in LIBSAVED as a keyword, else add directly the dependency that brings that library with it (in this case "libxklavier").

ivan-hc commented 1 month ago

NOTE, to made this search may take a whole day, also for me.

You need to read and understand each line. The last one I have pointed, as all of them, mean that the program is looking for a library to load. In this case "libxklavier". If it is in "junest-backups" you can add "libxklavier" in LIBSAVED as a keyword, else add directly the dependency that brings that library with it (in this case "libxklavier").

I'm not sure if it is enough to solve the issue with wayland. You need to try and try and re-try until it works the way you want.

ivan-hc commented 1 month ago

uhm...just noticed that your script https://github.com/Twig6943/Signal-AppImage/blob/main/signal-desktop-junest.sh is different from this I linked at the end of my tutorial https://github.com/ivan-hc/ArchImage/blob/main/drafts/signal-desktop-junest.sh have you used the correct one?

Twig6943 commented 1 month ago

I tried your script last night but wayland didnt work w that one (app still works fine via xwayland tho) so I edited the script a bit to make wayland work but still no dice

ivan-hc commented 1 month ago

uhm... if you use other archimages I created and they work in wayland, you should check what I added in that scripts, it may help

for what I know, xwayland semms to be the easier way to made it work, but maybe I'm wrong, I don't use Wayland at all... I should wait in december or january I guess, for xfce4.20

Twig6943 commented 1 month ago

Well I'm too lazy to get the app to run with wayland could u add it to AM's main repo regardless? https://github.com/Twig6943/Signal-AppImage/releases

ivan-hc commented 1 month ago

Hi, create a /.github/workflows/CI.yml file in your repo with this content

name: Appimage
concurrency:
  group: build-${{ github.ref }}
  cancel-in-progress: true

on:
  schedule:
    - cron: "0 21 * * 0"
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v3

    - name: build
      if: always()
      run: |
        sudo apt update
        sudo apt install libfuse2 desktop-file-utils
        chmod a+x ./*junest.sh
        ./*junest.sh
        mkdir dist
        mv *AppImage* dist/

    - name: Upload artifact
      uses: actions/upload-artifact@v4.4.0
      with:
        name: AppImage
        path: 'dist'

  release:
      needs: [build]
      permissions: write-all
      runs-on: ubuntu-latest

      steps:
        - uses: actions/download-artifact@v4.1.8
          with:
            name: AppImage

        - name: release
          uses: marvinpinto/action-automatic-releases@latest
          with:
            title: Continuous build
            automatic_release_tag: continuous
            prerelease: false
            draft: false
            files: |
              *.AppImage*
            repo_token: ${{ secrets.GITHUB_TOKEN }}

and then go in the "Actions" tab of your repo and run it, it should update the build every day in authomatic, to tag "continuous"

EDIT: this is the kind of workflow I use in all my repos

Twig6943 commented 1 month ago

@ivan-hc done

ivan-hc commented 1 month ago

@Twig6943 I've done too https://github.com/ivan-hc/AM/commit/e3117228e87a4b4e2a47d69b866bf95e704f830a lol

ivan-hc commented 1 month ago

and also this https://github.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io/commit/70c4004156a18df86911e95b24fd2729955c3d5d

ivan-hc commented 1 month ago

Now its time to debloat the AppImage

https://github.com/user-attachments/assets/a02e54c9-e81f-4aa9-9d73-85ffd9f98cf8

directories "man" and "gir*" in .junest/usr/share an already save 20+ MB

fun fact, here is what happens when I run the content of the big one, under .junest/usr/lib

https://github.com/user-attachments/assets/49e4de4e-3519-463f-9f0a-c7c1ce779a1c

essentially, instead of running the /usr/bin/signal-desktop reference, it would be enough to run /usr/lib/signal-desktop/signal-desktop, being it an electron app

so other big files can be also removed... but this needs a deeper search

libraries into that directories are against container's glibc, this means that on a recent distro such as Arch Linux or my Debian Testing, such files work without problems... while on an old distro like Debian Stable and Oldstable the app should not work at all.

So it is important to keep the structure of the JuNest container for this.

Jou can start to get note of the libraries you may not need, and then add them to the list of removable files, like this

https://github.com/user-attachments/assets/f7b19567-5041-443f-b683-3596aa4dbf5e

in this case I've found that libgo* is not needed

until now I have found that you can edit this part of the script

function _enable_mountpoints_for_the_inbuilt_bubblewrap() {
    mkdir -p ./"$APP".AppDir/.junest/home
    mkdir -p ./"$APP".AppDir/.junest/media
    mkdir -p ./"$APP".AppDir/.junest/usr/lib/locale
    mkdir -p ./"$APP".AppDir/.junest/usr/share/fonts
    mkdir -p ./"$APP".AppDir/.junest/usr/share/themes
    mkdir -p ./"$APP".AppDir/.junest/run/user
    rm -f ./"$APP".AppDir/.junest/etc/localtime && touch ./"$APP".AppDir/.junest/etc/localtime
    [ ! -f ./"$APP".AppDir/.junest/etc/asound.conf ] && touch ./"$APP".AppDir/.junest/etc/asound.conf
}

like this

function _enable_mountpoints_for_the_inbuilt_bubblewrap() {
    mkdir -p ./"$APP".AppDir/.junest/home
    mkdir -p ./"$APP".AppDir/.junest/media
    mkdir -p ./"$APP".AppDir/.junest/usr/lib/locale
    mkdir -p ./"$APP".AppDir/.junest/usr/share/fonts
    mkdir -p ./"$APP".AppDir/.junest/usr/share/themes
    mkdir -p ./"$APP".AppDir/.junest/run/user
    rm -f ./"$APP".AppDir/.junest/etc/localtime && touch ./"$APP".AppDir/.junest/etc/localtime
    [ ! -f ./"$APP".AppDir/.junest/etc/asound.conf ] && touch ./"$APP".AppDir/.junest/etc/asound.conf
    mkdir -p ./"$APP".AppDir/.junest/usr/share/man
    mkdir -p ./"$APP".AppDir/.junest/usr/share/gir*
    mkdir -p ./"$APP".AppDir/.junest/usr/lib/libgo.so*
}

and NOTE, you can do this without editing the AppRun.

Do this test for all files you think that are not needed.

ivan-hc commented 1 month ago

PS: I have custom actions in Thunar to extract the AppImages and I use Baobab to find the big files. In thunar I just sorted by size all files and directories to find the big ones.

ivan-hc commented 1 month ago

And about electron apps, I have another method that mades it even easier to obtain a 155 MB AppImage.

Snap2AppImage: https://github.com/ivan-hc/Snap2AppImage

All it does is to download, extract and repack the Snap program into an AppImage.

You need "squashfs-tools" installed on your system, it is needed to extract Snap packages.

This is the script I wrote:

#!/bin/sh

APP=signal-desktop

# TEMPORARY DIRECTORY
mkdir -p tmp
cd ./tmp || exit 1

# WGET VERSION USAGE
_wget_version_usage() {
    if wget --version | head -1 | grep -q ' 1.'; then
        wget -q --show-progress "$@"
    else
        wget "$@"
    fi
}

# DOWNLOAD APPIMAGETOOL
if ! test -f ./appimagetool; then
    _wget_version_usage https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
    chmod a+x ./appimagetool
fi

# DOWNLOAD THE SNAP PACKAGE
if ! test -f ./*.snap; then
    _wget_version_usage "$(curl -H 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/signal-desktop --silent | sed 's/[()",{} ]/\n/g' | grep "^http" | head -1)"
fi

# EXTRACT THE SNAP PACKAGE
if ! test -d ./squashfs-root; then
    unsquashfs -f ./*.snap
fi

# FIND PACKAGE VERSION
VERSION=$(cat $(find . -name snapcraft.yaml | head -1) | grep "^version" | head -1 | cut -c 10- | sed 's/"//g; s/ /-/g')

# CREATE THE APPDIR AND COMPILE THE APPIMAGE
mkdir -p "$APP".AppDir
rm -Rf ./"$APP".AppDir/*

# FIND THE .DESKTOP FILE AND REPLACE THE "ICON" ENTRY
cp -r "$(find . -name "$APP".desktop | head -1)" ./"$APP".AppDir/
sed -i "s/^Icon=.*/Icon=$APP/g" ./"$APP".AppDir/*.desktop

# FIND THE APPNAME
APPNAME="$(cat ./"$APP".AppDir/*.desktop | grep '^Name=' | head -1 | cut -c 6- | sed 's/ /-/g')"

# FIND THE ICON
cp -r "$(find . -name *.png | grep -i "$APP" | sort | head -1)" ./"$APP".AppDir/"$APP".png 2> /dev/null
cp -r "$(find . -name *.svg | grep -i "$APP" | sort | head -1)" ./"$APP".AppDir/"$APP".svg 2> /dev/null

# IMPORT COMMON LINUX DIRECTORIES
if test -d ./squashfs-root/etc; then cp -r ./squashfs-root/etc ./"$APP".AppDir/; fi
if test -d ./squashfs-root/lib; then cp -r ./squashfs-root/lib* ./"$APP".AppDir/; fi
if test -d ./squashfs-root/usr; then cp -r ./squashfs-root/usr ./"$APP".AppDir/; fi
if test -d ./squashfs-root/opt; then cp -r ./squashfs-root/opt ./"$APP".AppDir/; fi

# APPRUN
cat >> ./"$APP".AppDir/AppRun << 'EOF'
#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
export UNION_PRELOAD=/:"${HERE}"
export LD_LIBRARY_PATH="${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${LD_LIBRARY_PATH}"
export PATH="${HERE}"/usr/bin/:"${HERE}"/usr/sbin/:"${HERE}"/usr/games/:"${HERE}"/bin/:"${HERE}"/sbin/:"${PATH}"
export PYTHONPATH="${HERE}"/usr/share/pyshared/:"${HERE}"/usr/lib/python*/:"${PYTHONPATH}"
export PYTHONHOME="${HERE}"/usr/:"${HERE}"/usr/lib/python*/
export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}"
export PERLLIB="${HERE}"/usr/share/perl5/:"${HERE}"/usr/lib/perl5/:"${PERLLIB}"
export GSETTINGS_SCHEMA_DIR="${HERE}"/usr/share/glib-2.0/schemas/:"${GSETTINGS_SCHEMA_DIR}"
export QT_PLUGIN_PATH="${HERE}"/usr/lib/qt4/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib32/qt4/plugins/:"${HERE}"/usr/lib64/qt4/plugins/:"${HERE}"/usr/lib/qt5/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib32/qt5/plugins/:"${HERE}"/usr/lib64/qt5/plugins/:"${QT_PLUGIN_PATH}"
exec ${HERE}/opt/Signal/signal-desktop "$@"
EOF
chmod a+x ./"$APP".AppDir/AppRun

# CONVERT THE APPDIR INTO AN APPIMAGE
ARCH=x86_64 ./appimagetool --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 20 ./"$APP".AppDir
cd ..
mv ./tmp/*.AppImage ./"$APPNAME"-"$VERSION"-x86_64.AppImage

and this is it in action:

https://github.com/user-attachments/assets/af83ebcb-43eb-48ba-8c3e-7f337cce6da9

if you compare the content of the script above with the original one, there is not much difference https://github.com/ivan-hc/Snap2AppImage/blob/main/snap2appimage.sh I only added the internal /opt directory containing Signal and changed the reference in the AppRun

@Samueru-sama take a look at this

ivan-hc commented 1 month ago

Snap2AppImage is the best one for electron apps, among my tools

Twig6943 commented 1 month ago

I'll give snap2appimage a shot soon

Samueru-sama commented 1 month ago

snap2appimage may not work here because iirc signal as a dependency to gtk3, so hopefully it comes already in the snap bundled.

karo-solutions commented 1 month ago

Not sure if this is helpful at this point, but just in case: Here is a simple and easy to follow guide on how to build the Signal-Desktop AppImage from the official source code: https://github.com/karo-solutions/Signal-Desktop-AppImage

The only prerequisite is docker or podman and the version of Signal can be specified. The latest stable (v7.29.0) AppImage has about 160 MB and can be found in Releases

Will try to keep the repository updated and might add a GitHub action in the future :+1:

Twig6943 commented 1 month ago

@karo-solutions does this package run with the "--ozone-platform-hint=wayland" flag on your system (It doesnt on me)

karo-solutions commented 1 month ago

@karo-solutions does this package run with the "--ozone-platform-hint=wayland" flag on your system (It doesnt on me)

The following command works on my system (Fedora 40; Gnome 46):
./Signal-7.29.0.AppImage --use-tray-icon --no-sandbox %U --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations Confirmed with xeyes that it is really using wayland :+1:

I found this solution in this comment: https://github.com/signalapp/Signal-Desktop/issues/3411#issuecomment-1763576244 There you can also find a more detailed description and possible implications of these flags. For me the App seem to be useable, the only two problems I have found are:

Btw. there is also a feature request for Signal to support Wayland and additional information: https://community.signalusers.org/t/support-wayland-natively/58021

Twig6943 commented 1 month ago

@ivan-hc please switch the package (the one thats downloaded when the user runs am -i signal) to @karo-solutions 's package (it works with wayland)

ivan-hc commented 1 month ago

@ivan-hc please switch the package (the one thats downloaded when the user runs am -i signal) to @karo-solutions 's package (it works with wayland)

done

Twig6943 commented 1 month ago

@karo-solutions does this package run with the "--ozone-platform-hint=wayland" flag on your system (It doesnt on me)

The following command works on my system (Fedora 40; Gnome 46): ./Signal-7.29.0.AppImage --use-tray-icon --no-sandbox %U --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations Confirmed with xeyes that it is really using wayland 👍

this got it working thanks :heart:

karo-solutions commented 4 weeks ago

this got it working thanks ❤️

You are very welcome!

Just for information: I added a GitHub Action that checks for a new Signal Version weekly, rebuilds the AppImage on demand and uploads it to Releases .

I also now re-pack the AppImage with a static appimage runtime and use zstd compression, which makes it "only" 144MiB. (see https://github.com/karo-solutions/Signal-Desktop-AppImage/issues/1)