Initial commit: snap using zen-bin
This commit is contained in:
13
snap/hooks/disconnect-plug-host-hunspell
Normal file
13
snap/hooks/disconnect-plug-host-hunspell
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Clean up old Firefox snap mount for host hunspell; we now use
|
||||||
|
# the system-files interface for host hunspell dictionaries.
|
||||||
|
|
||||||
|
# TODO: Drop this (along with the host-hunspell mount-control
|
||||||
|
# declaration in snapcraft.yaml) later in the future once a
|
||||||
|
# reasonable amount of time has passed and nearly all users
|
||||||
|
# have an updated version and were migrated to use system-files,
|
||||||
|
# and just about no new Ubuntu installations start with a
|
||||||
|
# Firefox snap that has the older mount-control interface.
|
||||||
|
snapctl umount $SNAP_COMMON/host-hunspell || true
|
||||||
|
rm -r $SNAP_COMMON/host-hunspell || true
|
1
snap/hooks/install
Normal file
1
snap/hooks/install
Normal file
@@ -0,0 +1 @@
|
|||||||
|
post-refresh
|
64
snap/hooks/post-refresh
Normal file
64
snap/hooks/post-refresh
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Copyright (C) 2022 Canonical Ltd.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License version 3, as
|
||||||
|
# published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
host_hunspell=/var/lib/snapd/hostfs/usr/share/hunspell
|
||||||
|
|
||||||
|
if [ ! -d $host_hunspell ]; then
|
||||||
|
echo "No host hunspell, skipping"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
DICPATH=$SNAP_COMMON/snap-hunspell
|
||||||
|
|
||||||
|
if [ -d $DICPATH ]; then
|
||||||
|
# Clean up on each refresh to ensure we have an up-to-date list
|
||||||
|
# of host dictionaries.
|
||||||
|
find $DICPATH -type l -name "*.dic" -or -name "*.aff" | xargs rm
|
||||||
|
else
|
||||||
|
mkdir -p $DICPATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We deliberately don't directly use the host dictionary files.
|
||||||
|
# Instead, we use their names to know which ones the user has
|
||||||
|
# installed on their system, and we use the corresponding ones
|
||||||
|
# we primed in '$SNAP/usr/share/hunspell' in our 'hunspell' part.
|
||||||
|
#
|
||||||
|
# - We don't set DICPATH=/var/lib/snapd/hostfs/usr/share/hunspell
|
||||||
|
# to avoid potential incompatibility due to different hunspell
|
||||||
|
# versions inside the snap and outside on the host. See:
|
||||||
|
# https://github.com/snapcore/snapd/pull/11025
|
||||||
|
#
|
||||||
|
# - We don't set DICPATH="$SNAP/usr/share/hunspell" because that
|
||||||
|
# would result in all available dictionaries we primed in our
|
||||||
|
# 'hunspell' part being displayed in Firefox's interface,
|
||||||
|
# presenting an overwhelming number of options to the user.
|
||||||
|
# So instead we only use those that were installed on the host.
|
||||||
|
# This way, the user could affect the dictionaries available to
|
||||||
|
# Firefox snap similarly to how they could for non-snap Firefox.
|
||||||
|
for dic in $(find $host_hunspell/ -name "*.dic"); do
|
||||||
|
dic_file=$(basename $dic)
|
||||||
|
aff_file="${dic_file%%.dic}.aff"
|
||||||
|
# Some dic,aff files in hunspell are themselves symlinks to other files,
|
||||||
|
# e.g. /usr/share/hunspell/fr_CH.dic -> fr.dic.
|
||||||
|
# That extra level of indirection somehow breaks spell checking.
|
||||||
|
# We therefore use readlink to link to the "real" file, not to a symlink.
|
||||||
|
if [ -e "$SNAP/usr/share/hunspell/${dic_file}" ]; then
|
||||||
|
ln -s "$(readlink -e $SNAP/usr/share/hunspell/${dic_file})" $DICPATH/${dic_file}
|
||||||
|
fi
|
||||||
|
if [ -e "$SNAP/usr/share/hunspell/${aff_file}" ]; then
|
||||||
|
ln -s "$(readlink -e $SNAP/usr/share/hunspell/${aff_file})" $DICPATH/${aff_file}
|
||||||
|
fi
|
||||||
|
done
|
221
snapcraft.yaml
Normal file
221
snapcraft.yaml
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
# zen-browser snap, (c) Valentin HAUDIQUET
|
||||||
|
# inspired from https://github.com/canonical/firefox-snap
|
||||||
|
# GNU General Public License version 3
|
||||||
|
|
||||||
|
name: zen-browser
|
||||||
|
version: 1.14.11b
|
||||||
|
license: MPL-2.0
|
||||||
|
summary: Zen Browser - Welcome to a calmer internet
|
||||||
|
description: |
|
||||||
|
Zen is a firefox-based browser with the aim of pushing your productivity to a new level!
|
||||||
|
confinement: strict
|
||||||
|
grade: stable
|
||||||
|
base: core24
|
||||||
|
source-code: https://github.com/zen-browser/desktop
|
||||||
|
compression: lzo
|
||||||
|
|
||||||
|
apps:
|
||||||
|
zen-browser:
|
||||||
|
command: zen-browser.launcher
|
||||||
|
desktop: usr/share/applications/zen-browser.desktop
|
||||||
|
extensions: [gnome]
|
||||||
|
environment:
|
||||||
|
DICPATH: "$SNAP_COMMON/snap-hunspell"
|
||||||
|
GTK_USE_PORTAL: 1
|
||||||
|
HOME: "$SNAP_USER_COMMON"
|
||||||
|
PIPEWIRE_CONFIG_NAME: "$SNAP/usr/share/pipewire/pipewire.conf"
|
||||||
|
PIPEWIRE_MODULE_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pipewire-0.3"
|
||||||
|
SPA_PLUGIN_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/spa-0.2"
|
||||||
|
SPEECHD_ADDRESS: "unix_socket:/run/user/$SNAP_UID/speech-dispatcher/speechd.sock"
|
||||||
|
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libproxy
|
||||||
|
slots:
|
||||||
|
- mpris
|
||||||
|
- dbus-daemon
|
||||||
|
plugs:
|
||||||
|
- alsa
|
||||||
|
- audio-playback
|
||||||
|
- audio-record
|
||||||
|
- avahi-observe
|
||||||
|
- browser-sandbox
|
||||||
|
- camera
|
||||||
|
- cups-control
|
||||||
|
- gsettings
|
||||||
|
- hardware-observe
|
||||||
|
- home
|
||||||
|
- host-hunspell
|
||||||
|
- host-usr-share-hunspell
|
||||||
|
- joystick
|
||||||
|
- login-session-observe
|
||||||
|
- mount-observe
|
||||||
|
- network
|
||||||
|
- network-observe
|
||||||
|
- opengl
|
||||||
|
- pcscd
|
||||||
|
- removable-media
|
||||||
|
- screen-inhibits-control
|
||||||
|
- system-packages-doc
|
||||||
|
- u2f-devices
|
||||||
|
- unity7
|
||||||
|
- upower-observe
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
amd64:
|
||||||
|
|
||||||
|
plugs:
|
||||||
|
browser-sandbox:
|
||||||
|
interface: browser-support
|
||||||
|
allow-sandbox: true
|
||||||
|
dot-zen:
|
||||||
|
interface: personal-files
|
||||||
|
read: [$HOME/.zen]
|
||||||
|
etc-zen:
|
||||||
|
interface: system-files
|
||||||
|
read: [/etc/zen]
|
||||||
|
host-hunspell:
|
||||||
|
interface: mount-control
|
||||||
|
mount:
|
||||||
|
- what: /usr/share/hunspell
|
||||||
|
where: $SNAP_COMMON/host-hunspell
|
||||||
|
persistent: true
|
||||||
|
options: [ro, bind, noatime, noexec]
|
||||||
|
host-usr-share-hunspell:
|
||||||
|
interface: system-files
|
||||||
|
read:
|
||||||
|
- /var/lib/snapd/hostfs/usr/share/hunspell
|
||||||
|
|
||||||
|
layout:
|
||||||
|
/usr/share/libdrm:
|
||||||
|
bind: $SNAP/gnome-platform/usr/share/libdrm
|
||||||
|
/usr/share/alsa:
|
||||||
|
bind: $SNAP/usr/share/alsa
|
||||||
|
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/opensc-pkcs11.so:
|
||||||
|
bind-file: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/opensc-pkcs11.so
|
||||||
|
|
||||||
|
parts:
|
||||||
|
# This is a temporary workaround to including the hunspell content
|
||||||
|
# snap, which would cause breakage in the Ubuntu desktop image build
|
||||||
|
# because of the Ubuntu policy. See:
|
||||||
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1792006
|
||||||
|
#
|
||||||
|
# The definition of this part is essentially a copy of the
|
||||||
|
# corresponding part in hunspell-dictionaries-1-7-2004 by
|
||||||
|
# Buo-ren, Lin.
|
||||||
|
hunspell:
|
||||||
|
plugin: nil
|
||||||
|
override-build: |
|
||||||
|
craftctl default
|
||||||
|
set -eu
|
||||||
|
apt download $(apt-cache search '^hunspell-.*$' |
|
||||||
|
awk '!/myspell|dbgsym|tools|transitional|dependency/{printf "%s ", $1}')
|
||||||
|
find . -name "*.deb" -exec dpkg-deb -x {} "$CRAFT_PART_INSTALL" \;
|
||||||
|
prime:
|
||||||
|
- usr/share/hunspell
|
||||||
|
|
||||||
|
zen-browser:
|
||||||
|
plugin: nil
|
||||||
|
after:
|
||||||
|
- launcher
|
||||||
|
- desktop
|
||||||
|
- icons
|
||||||
|
build-packages:
|
||||||
|
- curl
|
||||||
|
- tar
|
||||||
|
override-build: |
|
||||||
|
mkdir -p "$CRAFT_PART_INSTALL/usr/lib"
|
||||||
|
curl -L -O https://github.com/zen-browser/desktop/releases/download/$SNAPCRAFT_PROJECT_VERSION/zen.linux-x86_64.tar.xz
|
||||||
|
tar xf zen.linux-x86_64.tar.xz -C "$CRAFT_PART_INSTALL/usr/lib"
|
||||||
|
prime:
|
||||||
|
- usr/lib/zen
|
||||||
|
- usr/lib/*/libproxy
|
||||||
|
- usr/lib/*/opensc-pkcs11.so
|
||||||
|
- usr/lib/*/pkcs11/opensc-pkcs11.so
|
||||||
|
- usr/lib/*/libasn1.so.*
|
||||||
|
- usr/lib/*/libcurl.so.*
|
||||||
|
- usr/lib/*/libgssapi.so.*
|
||||||
|
- usr/lib/*/libhcrypto.so.*
|
||||||
|
- usr/lib/*/libheimbase.so.*
|
||||||
|
- usr/lib/*/libheimntlm.so.*
|
||||||
|
- usr/lib/*/libhogweed.so.*
|
||||||
|
- usr/lib/*/libhx509.so.*
|
||||||
|
- usr/lib/*/libkrb5.so.*
|
||||||
|
- usr/lib/*/liblber-2.4.so.*
|
||||||
|
- usr/lib/*/libldap_r-2.4.so.*
|
||||||
|
- usr/lib/*/libnettle.so.*
|
||||||
|
- usr/lib/*/libnghttp2.so.*
|
||||||
|
- usr/lib/*/libpci.so.*
|
||||||
|
- usr/lib/*/libpipewire*.so*
|
||||||
|
- usr/lib/*/libroken.so.*
|
||||||
|
- usr/lib/*/librtmp.so.*
|
||||||
|
- usr/lib/*/libsasl2.so.*
|
||||||
|
- usr/lib/*/libspeechd.so.*
|
||||||
|
- usr/lib/*/libssh.so.*
|
||||||
|
- usr/lib/*/libssl.so.*
|
||||||
|
- usr/lib/*/libvulkan*
|
||||||
|
- usr/lib/*/libVkLayer*
|
||||||
|
- usr/lib/*/libwind.so.*
|
||||||
|
- usr/lib/*/libXt.so.*
|
||||||
|
- usr/lib/*/pipewire-*
|
||||||
|
- usr/lib/*/spa-*
|
||||||
|
# alsa does not seem to be found
|
||||||
|
# - usr/share/alsa
|
||||||
|
- usr/share/pipewire
|
||||||
|
- usr/share/vulkan
|
||||||
|
stage-packages:
|
||||||
|
- libproxy1v5
|
||||||
|
- glib-networking
|
||||||
|
- libasound2
|
||||||
|
- libcurl4
|
||||||
|
- libpci3
|
||||||
|
- libpipewire-0.3-0
|
||||||
|
- libpipewire-0.3-modules
|
||||||
|
- libspa-0.2-modules
|
||||||
|
- libspeechd2
|
||||||
|
- libvulkan1
|
||||||
|
- libxt6
|
||||||
|
- mesa-vulkan-drivers
|
||||||
|
- pipewire-bin
|
||||||
|
- pipewire-pulse
|
||||||
|
- opensc-pkcs11
|
||||||
|
|
||||||
|
desktop:
|
||||||
|
plugin: dump
|
||||||
|
source: .
|
||||||
|
organize:
|
||||||
|
zen-browser.desktop: usr/share/applications/zen-browser.desktop
|
||||||
|
|
||||||
|
launcher:
|
||||||
|
plugin: nil
|
||||||
|
override-prime: |
|
||||||
|
cp "$CRAFT_PROJECT_DIR/zen-browser.launcher" "$CRAFT_PRIME/"
|
||||||
|
chmod a+rwx "$CRAFT_PRIME/zen-browser.launcher"
|
||||||
|
|
||||||
|
icons:
|
||||||
|
plugin: nil
|
||||||
|
build-packages:
|
||||||
|
- inkscape
|
||||||
|
- curl
|
||||||
|
override-build: |
|
||||||
|
curl -L -O https://raw.githubusercontent.com/zen-browser/desktop/refs/heads/dev/docs/assets/zen-dark.svg
|
||||||
|
inkscape -w 16 -h 16 "$SNAPCRAFT_PART_BUILD/zen-dark.svg" -o "$CRAFT_PART_INSTALL/16.png"
|
||||||
|
inkscape -w 32 -h 32 "$SNAPCRAFT_PART_BUILD/zen-dark.svg" -o "$CRAFT_PART_INSTALL/32.png"
|
||||||
|
inkscape -w 48 -h 48 "$SNAPCRAFT_PART_BUILD/zen-dark.svg" -o "$CRAFT_PART_INSTALL/48.png"
|
||||||
|
inkscape -w 64 -h 64 "$SNAPCRAFT_PART_BUILD/zen-dark.svg" -o "$CRAFT_PART_INSTALL/64.png"
|
||||||
|
inkscape -w 128 -h 128 "$SNAPCRAFT_PART_BUILD/zen-dark.svg" -o "$CRAFT_PART_INSTALL/128.png"
|
||||||
|
organize:
|
||||||
|
16.png: usr/share/icons/hicolor/16x16/apps/zen-browser.png
|
||||||
|
32.png: usr/share/icons/hicolor/32x32/apps/zen-browser.png
|
||||||
|
48.png: usr/share/icons/hicolor/48x48/apps/zen-browser.png
|
||||||
|
64.png: usr/share/icons/hicolor/64x64/apps/zen-browser.png
|
||||||
|
128.png: usr/share/icons/hicolor/128x128/apps/zen-browser.png
|
||||||
|
prime:
|
||||||
|
- usr/share/icons/*
|
||||||
|
|
||||||
|
slots:
|
||||||
|
dbus-daemon:
|
||||||
|
interface: dbus
|
||||||
|
bus: session
|
||||||
|
name: zen.desktop
|
||||||
|
|
||||||
|
hooks:
|
||||||
|
post-refresh:
|
||||||
|
plugs: [host-usr-share-hunspell]
|
26
zen-browser.desktop
Normal file
26
zen-browser.desktop
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Version=1.14.11b
|
||||||
|
Name=Zen Browser
|
||||||
|
GenericName=Web Browser
|
||||||
|
Comment=Welcome to a calmer internet
|
||||||
|
Keywords=Internet;WWW;Browser;Web;Explorer
|
||||||
|
Exec=/usr/lib/zen/zen-bin %U
|
||||||
|
Icon=/usr/share/icons/hicolor/128x128/apps/zen-browser.png
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
|
||||||
|
StartupWMClass=Zen Browser
|
||||||
|
Categories=Network;WebBrowser;
|
||||||
|
Actions=new-window;new-private-window;profile-manager-window;
|
||||||
|
|
||||||
|
[Desktop Action new-window]
|
||||||
|
Name=Open a New Window
|
||||||
|
Exec=/usr/lib/zen/zen-bin --new-window %u
|
||||||
|
|
||||||
|
[Desktop Action new-private-window]
|
||||||
|
Name=Open a New Private Window
|
||||||
|
Exec=/usr/lib/zen/zen-bin --private-window %u
|
||||||
|
|
||||||
|
[Desktop Action profile-manager-window]
|
||||||
|
Name=Open the Profile Manager
|
||||||
|
Exec=/usr/lib/zen/zen-bin --ProfileManager %u
|
1
zen-browser.launcher
Normal file
1
zen-browser.launcher
Normal file
@@ -0,0 +1 @@
|
|||||||
|
exec "$SNAP/usr/lib/zen/zen-bin" "$@"
|
Reference in New Issue
Block a user