ogra1 / zoom-snap

75 stars 13 forks source link

Migrated to core22 and used kde-neon extension, but need help with configure #126

Open soumyaDghosh opened 1 year ago

soumyaDghosh commented 1 year ago

I have tried to migrate the snap to core22 and make use of kde-neon extension. It builds up, but when I try to install that snap it shows me a configure hook error. I guess a little more digging into this and we will have the zoom-snap more stable and ready for core22 (& core24 later on). This is the error log:

error: cannot perform the following tasks:
- Run configure hook of "zoom-client" snap if present (run hook "configure": 
-----
update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/boot /boot none bind,ro 0 0): permission denied
cannot update snap namespace: not a directory
snap-update-ns failed with code 1
-----)

This is the snapcraft.yaml

name: zoom-client
base: core22
version: 5.14.5.2430
summary: ZOOM Cloud Meetings
description: |
  Video conferencing with real-time messaging and content sharing

  https://zoom.us provides simplified video conferencing, whiteboard sharing
  and messaging across any device. This is an unofficial re-pack of the debian
  package provided by zoom.us

grade: stable
confinement: strict
compression: lzo
assumes:
  - snapd2.55

architectures:
  - build-on: amd64
#    run-on: amd64

apps:
  zoom-client:
    command: bin/launcher.sh
    extensions: [ kde-neon ]
    environment:
      ALWAYS_USE_PULSEAUDIO: 1
    desktop: usr/share/applications/Zoom.desktop
    plugs:
      - audio-playback
      - audio-record
      - browser-sandbox
      - camera
      - hardware-observe
      - home
      - network
      - network-bind
      - network-manager-observe
      - opengl
      - pulseaudio
      - removable-media
      - screencast-legacy
      - screen-inhibit-control
      - shared-memory
      - system-observe
      - unity7

plugs:
  browser-sandbox:
    interface: browser-support
    allow-sandbox: true

layout:
  /sbin/killall5:
    bind-file: $SNAP/sbin/killall5
  /usr/bin/lscpu:
    bind-file: $SNAP/usr/bin/lscpu
  #/usr/share/X11/xkb:
  #  bind: $SNAP/usr/share/X11/xkb
  #/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib:
  #  bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
  #/etc/os/release:
  #  symlink: $SNAP_DATA/os-release

parts:
  #qt5:
  #  source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
  #  source-subdir: qt
  #  plugin: make
  #  make-parameters: ["FLAVOR=qt5"]
  #  build-packages:
  #    - qtbase5-dev
  #    - dpkg-dev
  #  stage-packages:
  #    - libxkbcommon0
  #    - fonts-ubuntu
  #    - dmz-cursor-theme
  #    - light-themes
  #    - adwaita-icon-theme
  #    - gnome-themes-standard
  #    - shared-mime-info
  #    - libqt5gui5
  #    - libgdk-pixbuf2.0-0
  #    - libgtk2.0-0
  #    - libqt5svg5 # for loading icon themes which are svg
  #    #- try: [appmenu-qt5] # not available on core18
  #    - locales-all
  #alsa-mixin:
  #  plugin: dump
  #  after: [ qt5 ]
  #  source: https://github.com/diddlesnaps/snapcraft-alsa.git
  #  source-subdir: snapcraft-assets
  #  build-packages:
  #    - libasound2-dev
  #  stage-packages:
  #    - libasound2
  #    - libasound2-plugins
  zoom:
    source: https://zoom.us/client/latest/zoom_amd64.deb
    source-type: deb
    plugin: nil
    #after: [ alsa-mixin ]
    override-build: |
      # unset hardcoded LD_LIBRARY_PATHs
      sed -i s/D_LIBRAR/XXXXXXXX/g opt/zoom/ZoomLauncher
      sed -i s/T_AUTO_S/XXXXXXXX/g opt/zoom/ZoomLauncher
      sed -i s/LD_LIBRARY_PATH/XXXXXXXXXX_PATH/g opt/zoom/Qt/lib/libQt5Network.so.* opt/zoom/zopen

      # try fixing hardcoded /etc/os-release to allow wayland screen sharing
      sed -i "s;/os-release;/os/release;" opt/zoom/zoom
      sed -i "s;/os-release;/os/release;" opt/zoom/Qt/lib/libQt5Core.so.*

      sed -i "s;Prefix=/opt;Prefix=/snap/$SNAPCRAFT_PROJECT_NAME/current;" opt/zoom/qt.conf
      cp -av opt/zoom $CRAFT_PART_INSTALL/
      cp -av usr $CRAFT_PART_INSTALL/

      # remove danging symlink
      rm -rf $CRAFT_PART_INSTALL/usr/bin/zoom

      # fix icon and exec lines in desktop file
      sed -i 's|Icon=.*|Icon=${SNAP}/usr/share/pixmaps/Zoom.png|g' \
        $CRAFT_PART_INSTALL/usr/share/applications/Zoom.desktop
      sed -i 's|Exec=.*|Exec=zoom-client %U|g' \
        $CRAFT_PART_INSTALL/usr/share/applications/Zoom.desktop

        #VER="$(strings $CRAFT_PART_INSTALL/zoom/zoom|grep \
        #     "($(cat $CRAFT_PART_INSTALL/zoom/version.txt|sed 's/^[0-9].[0-9].//'))" | \
        #     sed 's/(//;s/)//;s/ /-/')"
      #VER="$(strings $CRAFT_PART_INSTALL/zoom/zoom | \
      #     grep "[0-9].[0-9]*.[0-9] ([0-9]*)" | \
      #                                       head -1 | \
      #                                       sed 's/ (/./;s/)//')"
      #snapcraftctl set-version "$VER"
    build-packages:
      - binutils
    stage-packages:
      - ibus
      - libatk-bridge2.0-0
      - libatk1.0-0
      - libatspi2.0-0
      - libcairo-gobject2
      - libdbus-1-3
      - libegl1-mesa
      - libepoxy0
      - libgtk-3-0
      - libgl1-mesa-dri
      - libgl1-mesa-glx
      - libglib2.0-0
      - libgnutls30
      - libgnutls-openssl27
      - libgomp1
      - libnspr4
      - libnss3
      - libpcre3
      - libpulse0
      - libpulse-mainloop-glib0
      - libsm6
      - libsqlite3-0
      - libssl3
      - libtinfo5
      - libxcb-image0
      - libxcb-keysyms1
      - libxcb-randr0
      - libxcb-shape0
      - libxcb-shm0
      - libxcb-xfixes0
      - libxcb-xtest0
      - libxcomposite1
      - libxcursor1
      - libxinerama1
      - xkb-data
      - libxrandr2
      - libxrender1
      - libxslt1.1
      - libxtst6
      - pulseaudio-utils
      - sysvinit-utils
      - util-linux
      - x11-xserver-utils
  cleanup:
    source: .
    plugin: nil
    after: [ zoom ]
    build-snaps:
      - core22
      - kf5-5-105-qt-5-15-9-core22
    override-build: |
      mkdir -p $CRAFT_PART_INSTALL/bin
      cp -av launcher.sh $CRAFT_PART_INSTALL/bin/
    override-prime: |
      craftctl default
      # remove any duplicated libs
      for lib in $(find $CRAFT_PRIME/zoom/ -name 'lib*.so*'); do
        echo "checking duplicates: $(basename $lib)"
        if ! echo "$lib" | grep -Eq "^(libicuuc|libicui18n|libicudata)\.so"; then
          for file in $(find $CRAFT_PRIME/usr $CRAFT_PRIME/lib -name "$(basename $lib)*" -type f); do
            rm -fv $file
          done
        fi
      done
      # clean up unused cruft
      for CRUFT in bug lintian man themes; do
        rm -rf $CRAFT_PRIME/usr/share/$CRUFT
      done
      # drop unused icon themes (keep cursors)
      for icons in $(ls -d usr/share/icons/*); do
        ICONS="$(basename "$icons")"
        if [ "$ICONS" != "Yaru" ] && [ "$ICONS" != "DMZ-White" ] && [ "$ICONS" != "DMZ-Black" ]; then
          rm -rf usr/share/icons/$ICONS
        fi
      done
      find $CRAFT_PRIME/usr/share/doc/ -type f -not -name 'copyright' -delete
      find $CRAFT_PRIME/usr/share -type d -empty -delete
      rm -rf $CRAFT_PRIME/usr/lib/gcc
      # make sandbox suid root
      chown root.root $CRAFT_PRIME/zoom/cef/chrome-sandbox
      chmod 4755 $CRAFT_PRIME/zoom/cef/chrome-sandbox

      # Remove duplicate and unused libs
      set -eux
      find $CRAFT_PRIME/usr/share/doc/ -type f -not -name 'copyright' -delete
      find $CRAFT_PRIME/usr/share -type d -empty -delete