Flatpak包管理使用

# 编辑配置文件,进行开启即可
# /etc/nixos/configuration.nix
services.flatpak.enable = true;

# rebuild一下
sudo nixos-rebuild switch
  • flathub源

# 官方源
# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# 推荐国内源
flatpak remote-add --if-not-exists flathub https://mirror.sjtu.edu.cn/flathub/flathub.flatpakrepo
flatpak remote-add --if-not-exists lenghub http://flathub2.test.upcdn.net/hub-leng.flatpakrepo


# 变更源地址, 默认是: https://dl.flathub.org/repo/ 不验证gpg,--no-gpg-verify
flatpak remote-modify flathub --url=https://mirror.sjtu.edu.cn/flathub --no-gpg-verify
# 添加gpg验证
flatpak remote-modify flathub --gpg-verify
flatpak remotes
# 导入flathub的gpg
wget https://mirror.sjtu.edu.cn/flathub/flathub.gpg
sudo flatpak remote-modify --gpg-import=flathub.gpg flathub

# 使用自己的服务器进行代理flathub,需要代理软件支持http2,caddy2测试不支持
server {
    listen 443 ssl;
    server_name dl.leng2011.icu;
    ssl_certificate /etc/nginx/conf.d/dl.leng2011.icu_bundle.crt;
    ssl_certificate_key /etc/nginx/conf.d/dl.leng2011.icu.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;

    location /repo/flathub.flatpakrepo {
       proxy_pass http://127.0.0.1:3312;
    }
    location / {
       proxy_pass https://dl.flathub.org;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "Upgrade";
       proxy_set_header Host "dl.flathub.org";
   }
}
server {
    # 创建文件: /home/jcleng/repo/flathub.flatpakrepo 替换Url
    listen 3312;
    root /home/jcleng/;
}

# 如果修改之后提示: Error: 无法从不信任的无 GPG 校验的远程仓库提取
# 全部使用sudo来操作
sudo

flatpak remote-modify flathub --url=https://dl.leng2011.icu/repo --no-gpg-verify
# 恢复
flatpak remote-modify flathub --url=https://mirror.sjtu.edu.cn/flathub

flatpak remotes --columns=name,url
# 名称               网址
# flathub            http://d.leng2011.icu/repo
# code-origin        https://dl.flathub.org/build-repo/68807
# finalshell-origin  https://dl.flathub.org/build-repo/47119
# finalshell1-origin https://dl.flathub.org/build-repo/67727

sudo flatpak remotes --columns=name,url
# 名称    网址
# flathub http://d.leng2011.icu/repo


# 测试
curl https://dl.leng2011.icu/repo/logo.svg
curl https://dl.leng2011.icu/repo/flathub.flatpakrepo
# 如果是安装.flatpak格式文件,提示不创建新增源,选择自己的源

# 如果安装软件导致地址还原; 需要编辑 /var/lib/flatpak/repo/config 或者 ~/.local/share/flatpak/repo/config 在 [remote "flathub"] 下面增加:
url-is-set=true

# --verbose输出debug信息
sudo flatpak install --verbose flathub org.gtk.Gtk3theme.Breeze
  • 仓库查看

# 已经配置的仓库
flatpak remotes --columns=name,url
# 删除仓库
flatpak remote-delete flathub
  • 安装软件

# 搜索包,习惯加上--columns参数,方便查看软件的application id,安装的时候需要
flatpak search --columns=name,application,description [key_words]
flatpak search --columns=name,application php
## 搜索包含gba的软件
flatpak search --columns=name,application,description gba

# 直接看remote的列表的软件, 比search快
flatpak remote-ls|grep music
flatpak install com.qq.QQmusic

# 安装,install后面的就是搜索的application id
flatpak install io.mgba.mGBA

# 手动运行已经安装的软件
## 默认安装的软件在菜单里面会直接显示,也可以进行手动启动
# 查看已经安装的软件
flatpak list
# 运行
flatpak run io.mgba.mGBA

# 安装指定版本
flatpak install org.freedesktop.Platform//21.08
flatpak install org.freedesktop.Sdk//21.08
  • 其他

# 查看实际安装的软件
ls $HOME/.var/app/
  • test build

# 测试构建, 会构建到.flatpak-builder目录
flatpak-builder --user --install --force-clean build-dir org.jcleng.wechat_dev_tool.yml
# 或者
flatpak-builder --user --install --force-clean build-dir manifest.json
# 增加构建缓存
flatpak-builder --repo=repo --disable-rofiles-fuse --install-deps-from=flathub --force-clean --default-branch=master --arch=x86_64 --ccache flatpak_app org.winehq.WineWechat.yml
# 运行
flatpak run org.jcleng.wechat_web_devtools_linux

# 沙盒权限说明
https://docs.flatpak.org/zh_CN/latest/sandbox-permissions-reference.html?

# 使用 org.flatpak.Builder 构建和打包
# 检查yml
flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest io.github.glaumar.QRookie.yml
# 打包安装
flatpak run org.flatpak.Builder --force-clean --sandbox --user --install --install-deps-from=flathub --ccache --mirror-screenshots-url=https://dl.flathub.org/media/ --repo=repo builddir io.github.glaumar.QRookie.yml
# 检查repo
flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo repo
# 检查.desktop
desktop-file-validate io.github.glaumar.QRookie.desktop
# 打正式包,打到repo里面, 会创建repo文件夹
flatpak-builder --repo=repo --force-clean build-dir manifest.json
# 本地新增leng-repo到repo文件夹
flatpak --user remote-add --no-gpg-verify leng-repo repo

# ╰─$ flatpak  remotes
# Name                             Options
# flathub                          system
# leng-repo                        user,no-gpg-verify
# wechat_web_devtools_linux-origin user,no-enumerate,no-gpg-verify

# 正式安装, 提示安装过了,直接卸载之前的安装
# flatpak remove org.jcleng.wechat_web_devtools_linux

# ╰─$ flatpak remotes
# Name      Options
# flathub   system
# leng-repo user,no-gpg-verify
flatpak --user install leng-repo org.jcleng.wechat_web_devtools_linux

# ╰─$ flatpak info org.jcleng.wechat_web_devtools_linux
#           ID: org.jcleng.wechat_web_devtools_linux
#          Ref: app/org.jcleng.wechat_web_devtools_linux/x86_64/master
#         Arch: x86_64
#       Branch: master
#       Origin: leng-repo
#   Collection:
# Installation: user
#    Installed: 1.5 GB
#      Runtime: org.freedesktop.Platform/x86_64/21.08
#          Sdk: org.freedesktop.Sdk/x86_64/21.08

#       Commit: 5f86af715551d103ac9eadcb220e54d885309ed59f7590cacc4059537a89f3b9
#      Subject: Export org.jcleng.wechat_web_devtools_linux
#         Date: 2022-08-29 14:21:32 +0000

# 如果不需要了,卸载
flatpak remote-delete leng-repo
# The following refs are installed from remote 'leng-repo':

#    1) app/org.jcleng.wechat_web_devtools_linux/x86_64/master

# Remove them? [y/n]:
  • 打包.flatpak文件

# repo是已经构建出来的文件夹
flatpak build-bundle repo wechat_web_devtools_linux.flatpak org.jcleng.wechat_web_devtools_linux

# 打出来也不大
ls -lah ./wechat_web_devtools_linux.flatpak
# -rw-r--r-- 1 jcleng users 229M  8月 29 22:39 ./wechat_web_devtools_linux.flatpak

# 从已经安装的本地进行打包离线文件
ls /var/lib/flatpak/repo/refs/heads/deploy/app/io.mgba.mGBA/x86_64/stable
flatpak build-bundle /var/lib/flatpak/repo gba.flatpak io.mgba.mGBA stable
ls -lah gba.flatpak
# .rw-r--r-- jcleng users 2.8 MB Fri May 12 14:43:22 2023  gba.flatpak

# 导出runtime运行时
# ls /var/lib/flatpak/repo/refs/heads/deploy/runtime/org.freedesktop.Sdk/x86_64/22.08
flatpak build-bundle --runtime /var/lib/flatpak/repo org.freedesktop.Sdk.flatpak org.freedesktop.Sdk 22.08
ls -lah org.freedesktop.Sdk.flatpak
# .rw-r--r-- jcleng users 351 MB Fri May 12 16:54:05 2023  org.freedesktop.Sdk.flatpak
  • 离线安装技巧

# 先下载依赖,然后直接--no-deps进行安装就不会再去加载.flatpakrepo远程依赖, 前提是知道.flatpak文件的依赖文件
flatpak install --no-deps ./wiliwili-Linux-x86_64.flatpak

分发自己的软件到仓库

  • 创建.flatpakrepo仓库说明文件

# 比如叫 hub-leng.flatpakrepo
# 最重要的Url路径就是构建软件的repo文件夹
[Flatpak Repo]
Title=Flathub
Url=http://flathub-jcleng.test.upcdn.net/flathub-jcleng
Homepage=https://flathub-jcleng.test.upcdn.net/
Comment=jclengs flathub
Description=jclengs flathub
  • 构建包

# 会生成flathub-jcleng文件夹,就是repo的文件夹
flatpak-builder --repo=flathub-jcleng --force-clean build-dir manifest.json

# sourcesdir常规配置:https://docs.flatpak.org/zh_CN/latest/flatpak-builder-command-reference.html#flatpak-manifest
"sources" : [
    {
        "type" : "dir",
        "path" : "./",
        "skip" : ".flatpak-builder"
    }
]

# 打patch;先commit再-1
git format-patch 243634a98a2913d09fda88c463c6861c412aaf07 -1
{
    "type": "patch",
    "path": "0001-int.patch"
}
  • 同步到云

# 把 hub-leng.flatpakrepo 文件和flathub-jcleng目录全量同步到云存储,测试用[又拍云]upx
# 打包指定repo文件夹
flatpak-builder --repo=/root/wind/flathub-jcleng --force-clean build-dir manifest_dev.json
# 先进入线上的目录
upx mkdir flathub-jcleng
upx cd flathub-jcleng
# 确认到文件夹了
upx pwd
# /flathub-jcleng/
# 增量同步
upx sync flathub-jcleng
  • 安装存储库的软件

# 因为没有添加gpg密钥,所以--no-gpg-verify
# hub-leng.flatpakrepo文件的路径就是刚刚上传到云存储的文件路径
# flathub-jcleng repo是一个别名
flatpak remote-add --no-gpg-verify --if-not-exists flathub-jcleng http://flathub-jcleng.test.upcdn.net/hub-leng.flatpakrepo

# 安装,用别名指定repo仓库
flatpak install flathub-jcleng io.mgba.mGBA

# 构建其他的项目只要--repo同一个repo文件夹即可
flatpak-builder --repo=flathub-jcleng --force-clean build-dir org.flatpak.Hello.yml
## 然后增量更新到云存储
upx sync flathub-jcleng
## 就可以安装其他的软件了
flatpak install flathub-jcleng org.flatpak.Hello

ZwzIK.png

  • 管理共享外部磁盘/权限管理等 Flatseal

# 比如steam使用游戏盘的数据
flatpak install flathub com.github.tchx84.Flatseal
# 选择第一个[全部应用程序]->[FileSystem]
# ro=只读,rw=可读可写
/home/jcleng/sdb2:rw
# 会生成com.blackmagic.Resolve.flatpak文件
# 提示Error: request to .... failed, reason: read ECONNRESET
# 需要重新生成Releases name: https://github.com/softprops/action-gh-release/issues/187
name: RUN BUILD
jobs:
  flatpak:
    name: "Flatpak"
    runs-on: ubuntu-latest
    container:
      image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08
      options: --privileged
    steps:
    - name: Clone Source
      run: |
        git clone --depth=1 https://github.com/pobthebuilder/resolve-flatpak.git blackmagic --recursive
    - name: flatpak action
      uses: flatpak/flatpak-github-actions/flatpak-builder@v4
      with:
        bundle: com.blackmagic.Resolve.flatpak
        manifest-path: blackmagic/com.blackmagic.Resolve.yaml
        cache-key: flatpak-builder1811
  • 两种游戏wine兼容层, 手动安装

  • flatpak测试不支持兼容层手柄支持

# 关于兼容层的说明: https://www.reddit.com/r/linux_gaming/comments/uzrz2k/a_thread_about_using_protonge_and_winege_builds/
仅将 Proton-GE 用于 Steam 内的 Steam 游戏;
仅将 Wine-GE 用于非 Steam 游戏;

# steam客户端,flatpak兼容层的位置: ~/.var/app/com.valvesoftware.Steam/data/Steam/compatibilitytools.d/
flatpak install flathub com.valvesoftware.Steam
# epic 客户端, flatpak兼容层的位置: ~/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine
flatpak install flathub com.heroicgameslauncher.hgl



# Lutris客户端, 需要git连接
# flatpak install flathub org.gnome.Platform.Compat.i386 org.freedesktop.Platform.GL32.default org.freedesktop.Platform.GL.default
flatpak install flathub net.lutris.Lutris
# 安装提示github下载慢可以直接下载文件然后解压,然后设置wine,选择对应的[lutris-GE-Proton8-26-x86_64]名称
/home/jcleng/.var/app/net.lutris.Lutris/data/lutris/runners/wine/lutris-GE-Proton8-26-x86_64/
├── bin
├── lib
├── lib64
└── share

# 运行时 [Runtime updates] 里面进行更新, 或者手动更新
# dxvk/vkd3d 目录和文件都在runtime里面, 包含很多: https://github.com/TheCodeTherapy/OryxDotFiles/tree/e9f2c4d070e36243afd4e6abccb83be6abbffde5/lutris/runtime
# https://github.com/doitsujin/dxvk/releases/tag/v2.3.1
# 源码
# https://github.com/lutris/lutris/blob/50ee3af168b5363c1ad6f9bee4892a9673c28219/lutris/util/wine/dxvk.py
tree -L 1 /home/jcleng/.var/app/net.lutris.Lutris/data/lutris/runtime/
/home/jcleng/.var/app/net.lutris.Lutris/data/lutris/runtime/
├── battleye_runtime
├── d3d_extras
├── dgvoodoo2
├── dxvk
├── dxvk-cache-tool
├── dxvk-nvapi
├── eac_runtime
├── gamecontrollerdb
├── icons
├── innoextract-1.9-linux
├── network-tools
├── p7zip
├── Ubuntu-18.04-i686
├── Ubuntu-18.04-x86_64
├── vkd3d
└── winetricks


# wine兼容层管理软件ProtonUp-Qt,通过查看软件里面的地址,可以手动下载兼容层包,下载之后解压到对应目录即可
# https://github.com/DavidoTek/ProtonUp-Qt
flatpak install flathub net.davidotek.pupgui2
# 运行的时候加上代理环境变量,不然重github很难下载
# https://manpages.debian.org/unstable/flatpak/flatpak-run.1.en.html
flatpak run net.davidotek.pupgui2 --env=http_proxy=socks5://13.229.205.20:7890 --env=https_proxy=socks5://13.229.205.20:7890

# 从flathub安装一个兼容层
flatpak install com.valvesoftware.Steam.CompatibilityTool.Proton-GE


# 手动安装
steam https://github.com/luxtorpeda-dev/luxtorpeda#installation-using-tarball
tree
# .
# └── luxtorpeda
#     ├── compatibilitytool.vdf
#     ├── config.json
#     ├── libluxtorpeda.so
#     ├── LICENSE
#     ├── luxtorpeda.pck
#     ├── luxtorpeda.sh
#     ├── luxtorpeda.x86_64
#     ├── README.md
#     ├── toolmanifest.vdf
#     └── version

# 1 directory, 10 files

steam https://github.com/GloriousEggroll/proton-ge-custom
ls GE-Proton7-51
# protonfixes
# files
# version
# user_settings.sample.py
# toolmanifest.vdf
# proton_3.7_tracked_files
# proton
# PATENTS.AV1
# LICENSE.OFL
# LICENSE
# filelock.py
# compatibilitytool.vdf

lutris https://github.com/GloriousEggroll/wine-ge-custom
ls lutris-GE-diablo_4_beta-x86_64
# share
# lib64
# lib
# bin

heroicgameslauncher 以上两种都兼容
ls ~/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools
# proton就是proton-ge-custom
# wine就是wine-ge-custom
wine目录: wine-lutris-GE-Proton7-39-x86_64.tar.xz 解压之后
tree -L 2 wine
# wine
# └── Wine-GE-Proton7-39
#     ├── bin
#     ├── lib
#     ├── lib64
#     └── share

# 5 directories, 0 files


# steam使用右键游戏,强制使用兼容程序,选择即可
  • 调试相关

flatpak info -M com.valvesoftware.Steam
  • 错误

# Failed to register: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown
# 系统总线权限没有开
  • 摇杆测试

flatpak install flathub io.gitlab.jstest_gtk.jstest_gtk
  • 其他软件: https://fedoraproject.org/wiki/Flatpak:Easy

  • 软件回滚

flatpak remote-info --log flathub io.gitlab.jstest_gtk.jstest_gtk
# 显示运行时, 然后选择自己的运行时进行安装
flatpak remote-info flathub --log --show-runtime -c com.visualstudio.code
# 或者
flatpak history --columns=application,commit,old-commit|grep io.gitlab.jstest_gtk.jstest_gtk
# 更新版本
flatpak update io.dbeaver.DBeaverCommunity
# 指定commit,指定版本
flatpak update --commit=ec07ad6c54e803d1428e5580426a41315e50a14376af033458e7a65bfb2b64f0 io.gitlab.jstest_gtk.jstest_gtk
flatpak update --commit=f35aedd230a9 io.gitlab.jstest_gtk.jstest_gtk
  • vscode

# 说明文件
/app/share/vscode/flatpak-warning.txt

# 提示使用flatpak-spawn对执行的命令进行代理一遍,就可以执行flatpak实体机的命令了
{
  "terminal.integrated.defaultProfile.linux": "bash",
  "terminal.integrated.profiles.linux": {
    "bash": {
      "path": "/usr/bin/flatpak-spawn",
      "args": ["--host", "--env=TERM=xterm-256color", "bash"]
    }
  }
}

flatpak-spawn --host docker ps

# 也提供了环境依赖
flatpak search --columns=name,application,version org.freedesktop.Sdk.Extension
flatpak install org.freedesktop.Sdk.Extension.php74 -y
flatpak install org.freedesktop.Sdk.Extension.openjdk17 -y
flatpak install flathub org.freedesktop.Sdk.Extension.golang -y
# 设置变量环境 FLATPAK_ENABLE_SDK_EXT
FLATPAK_ENABLE_SDK_EXT=php74 flatpak run com.visualstudio.code
FLATPAK_ENABLE_SDK_EXT=php74,golang flatpak run com.visualstudio.code
# 或者使用 override;Flatseal
flatpak override --user --env=FLATPAK_ENABLE_SDK_EXT=openjdk17 com.jetbrains.IntelliJ-IDEA-Community
# ls /usr/lib/sdk/openjdk17/
# https://github.com/flathub/com.visualstudio.code/issues/344

# 或者使用内置的bash
"terminal.integrated.shell.linux": "/usr/bin/bash",
# 字体 fontFamily
JetBrainsMono Nerd Font,"思源黑体 HW"

echo $PATH
# 使用宿主机器的命令
#!/usr/bin/sh
export DOCKER_HOST=tcp://127.0.0.1:39012
/usr/bin/flatpak-spawn --host docker "$@"
  • 常用命令: 进入sandbox

# --command 参数,进入之后对容器数据进行修改
flatpak run --command=sh org.ppsspp.PPSSPP

# 详情,和依赖的sdk
flatpak info org.gimp.GIMP

# gnome/freedesktop 鼠标非常小
# freedesktop 需要挂载目录
/home/jcleng/.icons/:rw
/home/jcleng/.local/share/fonts/:rw
  • 字体

# 跟宿主机器样的路径
fc-list
ls ~/.local/share/fonts/
  • 关于sock控制软件

# 有的软件使用sock,需要权限才能使用sock
# 比如: com.github.sdv43.whaler/io.podman_desktop.PodmanDesktop
sudo chmod 777 /var/run/docker.sock
  • GNOME/KDE软件包

# https://wiki.gnome.org/Apps/Nightly
flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
flatpak remote-ls --app gnome-nightly
flatpak install gnome-nightly org.gtk.gtk4.NodeEditor


flatpak remote-add --if-not-exists kdeapps --from https://distribute.kde.org/kdeapps.flatpakrepo
flatpak remote-ls --app kdeapps
  • 其他技巧

在vnc运行flatpak提示错误:
(cobalt:2): cobalt-WARNING **: 13:33:04.933: Failed to get expose-pids state: Failed to get portal proxy: 执行子进程“dbus-launch”失败(没有那个文件或目录)
[2 zypak-helper] Failed to connect to session bus: [org.freedesktop.DBus.Error.NotSupported] Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
[2 zypak-helper] src/helper/main.cc:40(DetermineZygoteStrategy): Assertion failed: bus

# 运行
export $(dbus-launch)

# Firefox识别触摸屏上的多点触摸,设置环境变量
MOZ_USE_XINPUT2=1

国人开发的游戏助手,安装常用软件

sudo flatpak install flathub org.gnome.Platform.Compat.i386//42 org.freedesktop.Platform.GL32.default//21.08 org.freedesktop.Platform.GL.default//21.08 org.freedesktop.Platform.VulkanLayer.MangoHud//21.08 com.valvesoftware.Steam.Utility.gamescope

sudo flatpak remote-add --if-not-exists winegame https://file.winegame.net/flatpak/repo/winegame.flatpakrepo
sudo flatpak install winegame net.winegame.client -y

# 软件列表
https://winegame.net/games?genres=26
# 微信
https://winegame.net/games/wechat/

使用流播放电脑的音频

flatpak install flathub de.haeckerfelix.AudioSharing
# 手机端的客户端可以使用vlc,rtsp协议

增加桌面图标目录到系统,增加 XDG_DATA_DIRS

  environment.extraInit="
export XDG_DATA_DIRS=$XDG_DATA_DIRS:/var/lib/flatpak/exports/share/
export DOCKER_HOST=tcp://0.0.0.0:39012
";
  • 关于vscode设置shell

// 设置默认的shell, 第一个视乎优先级高些
    "terminal.integrated.shell.linux": "/usr/bin/sh",
    "terminal.integrated.profiles.linux": {
        "bash": {
            "path": "/run/current-system/sw/bin/bash",
            "icon": "terminal-bash"
        },
        "zsh": {
            "path": "zsh"
        },
        "fish": {
            "path": "fish"
        },
        "tmux": {
            "path": "tmux",
            "icon": "terminal-tmux"
        },
        "pwsh": {
            "path": "pwsh",
            "icon": "terminal-powershell"
        }
    },
    "terminal.integrated.defaultProfile.linux": "zsh",
  • 定义alias常用命令

# 我的配置
if [ "$container" != "flatpak" ];then
  alias code=com.visualstudio.code
fi
  • dpi,freedesktop.Sdk和org.gnome.Sdk适用

# 使用freedesktop可以通过关于GTK 3高分屏: https://wiki.archlinux.org/title/HiDPI
# https://horstmann.com/unblog/2023-01-07/index.html
# 实际是配置的 ~/.Xresources 的 Xft.dpi: 96

# gtk2/3
flatpak override --user --env=GDK_SCALE=2
flatpak override --user --env=GDK_DPI_SCALE=0.5
# 可以尝试gnome应用里面设置
# gsettings set org.gnome.desktop.interface scaling-factor $GDK_SCALE
# gsettings set org.gnome.desktop.interface text-scaling-factor $GDK_DPI_SCALE

# GTK4有bug GDK_DPI_SCALE 不生效
  • gc

flatpak uninstall --unused
  • 构建技巧

在sources使用 "type": "extra-data", 的时候需要 使用一个脚本来执行 "type": "script", 且在build-commands  "install -D apply_extra -t /app/bin", 才能生效; 会安装到 /app/extra/ 文件夹

{
    "name": "desktop",
    "builddir": true,
    "buildsystem": "simple",
    "build-commands": [
        "install -D apply_extra -t /app/bin",
        "install -Dm755 run.sh /app/bin/run.sh",
        "install -Dm644 com.hostbuf.FinalShell.metainfo.xml -t $FLATPAK_DEST/share/metainfo",
        "install -Dm644 com.hostbuf.FinalShell.desktop /app/share/applications/com.hostbuf.FinalShell.desktop",
        "install -Dm644 com.hostbuf.FinalShell.png /app/share/icons/hicolor/scalable/apps/com.hostbuf.FinalShell.png",
        "install -Dm644 com.hostbuf.FinalShell.png /app/share/icons/hicolor/512x512/apps/com.hostbuf.FinalShell.png"
    ],
    "sources": [
        {
            "type": "dir",
            "path": "./",
            "skip": ".flatpak-builder"
        },
        {
            "type": "script",
            "dest-filename": "apply_extra",
            "commands": [
                "unzip finalshell_linux.zip",
                "ls",
                "chmod +x ./FinalShell/bin/FinalShell",
                "rm -rf finalshell_linux.zip"
            ]
        },
        {
            "type": "extra-data",
            "filename": "finalshell_linux.zip",
            "url": "http://dl.hostbuf.com/finalshell2/finalshell_linux.zip",
            "sha256": "ed56b988cc179d3a662cd92f0cec6128e91b062b8c892bdd8bb8a483e79c5aea",
            "size": 101653303
        }
    ]
}
  • 配置文件位置

cat $HOME/.local/share/flatpak/overrides/global

[Context]
filesystems=/home/jcleng/.Xresources:rw;~/.local/share/fonts:ro;~/.icons:ro;/home/jcleng/.icons;/home/jcleng/.themes

[Environment]
GTK_THEME=Fluent-Light
GTK_IM_MODULE=fcitx
GDK_DPI_SCALE=0.5
GLFW_IM_MODULE=ibus
SDL_IM_MODULE=fcitx
GDK_SCALE=2
XMODIFIERS=@im=fcitx
QT_IM_MODULE=fcitx
DOCKER_HOST=tcp://0.0.0.0:39012
  • 中文兼容性

--filesystem="xdg-config/fontconfig:ro"
# 然后新增 font.conf
~/.config/fontconfig/font.conf
  • 常用软件

名称                                   应用程序 ID                                      版本                     分支         架构   来源               安装RESP.app - GUI for Redis ®             app.resp.RESP                                    2022.4.2                 stable       x86_64 flathub            system
dingtalk                               com.alibabainc.dingtalk                                                   master       x86_64 dingtalk-origin    user
wine 平台                              com.deepin.wine.Platform                                                  2.18.1       i386   platform-origin    system
wine6 开发平台                         com.deepin.wine6.Sdk                                                      1.0.1        x86_64 sdk-origin         user
stable                                 com.deepinwine6.stable                                                    master       x86_64 stable-origin      user
Qv2ray                                 com.github.Qv2ray                                2.0.1                    stable       x86_64 flathub            system
Barrier                                com.github.debauchee.barrier                     2.4.0                    stable       x86_64 flathub            system
Pods                                   com.github.marhkb.Pods                           1.1.1                    stable       x86_64 flathub            system
EasySSH                                com.github.muriloventuroso.easyssh               1.7.8                    stable       x86_64 flathub            system
Give Me Lyrics                         com.github.muriloventuroso.givemelyrics          0.5.0                    stable       x86_64 flathub            system
Whaler                                 com.github.sdv43.whaler                          1.2.0                    stable       x86_64 flathub            system
Flatseal                               com.github.tchx84.Flatseal                       2.0.1                    stable       x86_64 flathub            system
Xournal++                              com.github.xournalpp.xournalpp                   1.1.3                    stable       x86_64 flathub            system
Screenkey                              com.gitlab.screenkey.screenkey                   1.1                      master       x86_64 screenkey1-origin  system
Heroic Games Launcher                  com.heroicgameslauncher.hgl                      v2.6.2                   stable       x86_64 flathub            system
FinalShell                             com.hostbuf.FinalShell                                                    master       x86_64 finalshell-origin  user
IntelliJ IDEA Community                com.jetbrains.IntelliJ-IDEA-Community            2023.1                   stable       x86_64 flathub            system
Microsoft Edge                         com.microsoft.Edge                               113.0.1774.42-1          stable       x86_64 flathub            system
Moonlight                              com.moonlight_stream.Moonlight                   4.3.1                    stable       x86_64 flathub            system
OBS Studio                             com.obsproject.Studio                            29.0.2                   stable       x86_64 flathub            system
Plexamp                                com.plexamp.Plexamp                              4.7.1                    stable       x86_64 flathub            system
Linux QQ                               com.qq.QQ                                        3.1.0-9572               stable       x86_64 flathub            system
Black Box                              com.raggesilver.BlackBox                         0.13.2                   stable       x86_64 flathub            system
Snes9x                                 com.snes9x.Snes9x                                1.61final                stable       x86_64 flathub            system
Peek                                   com.uploadedlobster.peek                         1.5.1                    stable       x86_64 flathub            system
Steam                                  com.valvesoftware.Steam                          1.0.0.75                 stable       x86_64 flathub            system
Proton-GE (community build)            …valvesoftware.Steam.CompatibilityTool.Proton-GE 7.51-1                   stable       x86_64 flathub            system
gamescope                              com.valvesoftware.Steam.Utility.gamescope        3.11.51                  stable       x86_64 flathub            system
Visual Studio Code                     com.visualstudio.code                            1.76.2-1678817801        stable       x86_64 flathub            system
soft                                   com.wine6.soft                                                            1.0.0        x86_64 soft-origin        user
soft 翻译                              com.wine6.soft.Locale                                                     master       x86_64 soft1-origin       user
WPS Office                             com.wps.Office                                   11.1.0.11691             stable       x86_64 flathub            system
Sunshine                               dev.lizardbyte.app.Sunshine                      0.19.1                   stable       x86_64 flathub            system
sunshine                               dev.lizardbyte.sunshine                                                   master       x86_64 sunshine3-origin   system
Immagini                               dev.salaniLeo.immagini                           0.1.0                    stable       x86_64 flathub            system
Fluffychat                             im.fluffychat.Fluffychat                         1.8.0                    stable       x86_64 flathub            system
Element                                im.riot.Riot                                     1.11.22                  stable       x86_64 flathub            system
Cemu                                   info.cemu.Cemu                                   2.0~experimental36       stable       x86_64 flathub            system
DBeaver Community                      io.dbeaver.DBeaverCommunity                      23.0.2                   stable       x86_64 flathub            system
Clash for Windows                      io.github.Fndroid.clash_for_windows              0.20.22                  stable       x86_64 flathub            system
AntiMicroX                             io.github.antimicrox.antimicrox                  3.3.3                    stable       x86_64 flathub            system
GPU-Viewer                             io.github.arunsivaramanneo.GPUViewer             1.43                     stable       x86_64 flathub            system
Porymap                                io.github.huderlem.porymap                       5.1.1                    stable       x86_64 flathub            system
PeaZip                                 io.github.peazip.PeaZip                          9.2.0                    stable       x86_64 flathub            system
peazip i386 addon                      io.github.peazip.PeaZip.Addon.i386               1.0.0                    stable       x86_64 flathub            system
AppImage Pool                          io.github.prateekmedia.appimagepool              5.1.0                    stable       x86_64 flathub            system
Kooha                                  io.github.seadve.Kooha                           2.2.3                    stable       x86_64 flathub            system
simple64                               io.github.simple64.simple64                      v2023.04.12              stable       x86_64 flathub            system
jstest-gtk                             io.gitlab.jstest_gtk.jstest_gtk                  8e84777                  stable       x86_64 flathub            system
mGBA                                   io.mgba.mGBA                                     0.10.2                   stable       x86_64 flathub            system
Podman Desktop                         io.podman_desktop.PodmanDesktop                  0.15.0                   stable       x86_64 flathub            system
Qt Designer                            io.qt.Designer                                   6.4                      stable       x86_64 flathub            system
Qt Creator                             io.qt.QtCreator                                  8.0.1                    stable       x86_64 flathub            system
Fluent Reader                          me.hyliu.fluentreader                            1.1.3                    stable       x86_64 flathub            system
Joplin                                 net.cozic.joplin_desktop                         2.9.17                   stable       x86_64 flathub            system
ProtonUp-Qt                            net.davidotek.pupgui2                            2.7.7                    stable       x86_64 flathub            system
melonDS                                net.kuribo64.melonDS                             0.9.5                    stable       x86_64 flathub            system
Lutris                                 net.lutris.Lutris                                0.5.12                   stable       x86_64 flathub            system
Shrew Soft VPN Access Manager          net.shrew.ike.qikea                              2.2.1                    stable       x86_64 flathub            system
Airshipper                             net.veloren.airshipper                           0.10.0                   stable       x86_64 flathub            system
Veloren                                net.veloren.veloren                              0.13.0-nightly           stable       x86_64 flathub            system
client                                 net.winegame.client                                                       master       x86_64 winegame           system
Chromium Web Browser                   org.chromium.Chromium                            111.0.5563.64            stable       x86_64 flathub            system
Codecs                                 org.chromium.Chromium.Codecs                                              stable       x86_64 flathub            system
Citra                                  org.citra_emu.citra                              nightly-1813             stable       x86_64 flathub            system
CoreKeyboard                           org.cubocore.CoreKeyboard                        4.4.0                    stable       x86_64 flathub            system
Eclipse IDE for Java Developers        org.eclipse.Java                                 4.26                     stable       x86_64 flathub            system
FileZilla                              org.filezillaproject.Filezilla                   3.64.0                   stable       x86_64 flathub            system
Flatpak Developer Demo                 org.flatpak.qtdemo                               1.1.3                    master       x86_64 qtdemo-origin      user
Freedesktop Platform                   org.freedesktop.Platform                         18.08.39                 18.08        x86_64 flathub            system
Freedesktop Platform                   org.freedesktop.Platform                         19.08.15                 19.08        x86_64 flathub            system
Freedesktop Platform                   org.freedesktop.Platform                         20.08.21                 20.08        x86_64 flathub            system
Freedesktop Platform                   org.freedesktop.Platform                         21.08.18                 21.08        x86_64 flathub            system
Freedesktop Platform                   org.freedesktop.Platform                         22.08.11                 22.08        x86_64 flathub            system
i386                                   org.freedesktop.Platform.Compat.i386                                      22.08        x86_64 flathub            system
default                                org.freedesktop.Platform.GL.default                                       19.08        x86_64 flathub            system
Mesa                                   org.freedesktop.Platform.GL.default              21.1.8                   20.08        x86_64 flathub            system
Mesa                                   org.freedesktop.Platform.GL.default              21.3.9                   21.08        x86_64 flathub            system
Mesa                                   org.freedesktop.Platform.GL.default              23.0.2                   22.08        x86_64 flathub            system
Mesa (Extra)                           org.freedesktop.Platform.GL.default              23.0.2                   22.08-extra  x86_64 flathub            system
default                                org.freedesktop.Platform.GL32.default                                     21.08        x86_64 flathub            system
Mesa                                   org.freedesktop.Platform.GL32.default            23.0.2                   22.08        x86_64 flathub            system
Mesa (Extra)                           org.freedesktop.Platform.GL32.default            22.3.5                   22.08-extra  x86_64 flathub            system
Intel                                  org.freedesktop.Platform.VAAPI.Intel                                      18.08        x86_64 flathub            system
Intel                                  org.freedesktop.Platform.VAAPI.Intel                                      19.08        x86_64 flathub            system
Intel                                  org.freedesktop.Platform.VAAPI.Intel                                      20.08        x86_64 flathub            system
Intel                                  org.freedesktop.Platform.VAAPI.Intel                                      21.08        x86_64 flathub            system
Intel                                  org.freedesktop.Platform.VAAPI.Intel                                      22.08        x86_64 flathub            system
i386                                   org.freedesktop.Platform.VAAPI.Intel.i386                                 22.08        x86_64 flathub            system
MangoHud                               org.freedesktop.Platform.VulkanLayer.MangoHud    0.6.8                    21.08        x86_64 flathub            system
ffmpeg-full                            org.freedesktop.Platform.ffmpeg-full                                      21.08        x86_64 flathub            system
ffmpeg-full                            org.freedesktop.Platform.ffmpeg-full                                      22.08        x86_64 flathub            system
i386                                   org.freedesktop.Platform.ffmpeg_full.i386                                 22.08        x86_64 flathub            system
html5-codecs                           org.freedesktop.Platform.html5-codecs                                     18.08        x86_64 flathub            system
openh264                               org.freedesktop.Platform.openh264                2.1.0                    2.0          x86_64 flathub            system
openh264                               org.freedesktop.Platform.openh264                2.1.0                    2.2.0        x86_64 flathub            system
openh264                               org.freedesktop.Platform.openh264                2.1.0                    2.2.0beta    x86_64 gnome-nightly      system
Freedesktop SDK                        org.freedesktop.Sdk                              18.08.39                 18.08        x86_64 flathub            system
Freedesktop SDK                        org.freedesktop.Sdk                              19.08.15                 19.08        x86_64 flathub            system
Freedesktop SDK                        org.freedesktop.Sdk                              20.08.21                 20.08        x86_64 flathub            system
Freedesktop SDK                        org.freedesktop.Sdk                              21.08.18                 21.08        x86_64 flathub            system
Freedesktop SDK                        org.freedesktop.Sdk                              22.08.11                 22.08        x86_64 flathub            system
i386                                   org.freedesktop.Sdk.Compat.i386                                           22.08        x86_64 flathub            system
Node.js 16.x                           org.freedesktop.Sdk.Extension.node16             16.18.1                  21.08        x86_64 flathub            system
Node.js 16.x                           org.freedesktop.Sdk.Extension.node16             16.20.0                  22.08        x86_64 flathub            system
OpenJDK 17 SDK Extension               org.freedesktop.Sdk.Extension.openjdk17                                   22.08        x86_64 flathub            system
OpenJdk 8 Sdk extension                org.freedesktop.Sdk.Extension.openjdk8                                    22.08        x86_64 flathub            system
PHP 7.4                                org.freedesktop.Sdk.Extension.php74              7.4.33                   22.08        x86_64 flathub            system
toolchain-i386                         org.freedesktop.Sdk.Extension.toolchain-i386                              22.08        x86_64 flathub            system
GNU 图像处理程序                       org.gimp.GIMP                                    2.10.34                  stable       x86_64 flathub            system
构建器                                 org.gnome.Builder                                44.2                     stable       x86_64 flathub            system
字体管理器                             org.gnome.FontManager                            0.8.8                    stable       x86_64 flathub            system
GNOME Application Platform version 42  org.gnome.Platform                                                        42           x86_64 flathub            system
GNOME Application Platform version 43  org.gnome.Platform                                                        43           x86_64 flathub            system
GNOME Application Platform version 44  org.gnome.Platform                                                        44           x86_64 flathub            system
GNOME Application Platform version Ni… org.gnome.Platform                                                        master       x86_64 gnome-nightly      system
i386                                   org.gnome.Platform.Compat.i386                                            42           x86_64 flathub            system
i386                                   org.gnome.Platform.Compat.i386                                            43           x86_64 flathub            system
GNOME Software Development Kit versio… org.gnome.Sdk                                                             43           x86_64 flathub            system
GNOME Software Development Kit versio… org.gnome.Sdk                                                             44           x86_64 flathub            system
磁盘占用分析器                         org.gnome.baobab                                 44.0                     stable       x86_64 flathub            system
Breeze GTK theme                       org.gtk.Gtk3theme.Breeze                         5.27.5                   3.22         x86_64 flathub            system
Deepin Gtk+ theme                      org.gtk.Gtk3theme.deepin                                                  3.22         x86_64 flathub            system
Deepin Gtk+ theme (dark)               org.gtk.Gtk3theme.deepin-dark                                             3.22         x86_64 flathub            system
GTK Node Editor                        org.gtk.gtk4.NodeEditor                                                   master       x86_64 gnome-nightly      system
Adwaita theme                          org.kde.KStyle.Adwaita                                                    5.15-21.08   x86_64 flathub            system
Adwaita theme                          org.kde.KStyle.Adwaita                                                    5.15-22.08   x86_64 flathub            system
Adwaita theme                          org.kde.KStyle.Adwaita                                                    6.4          x86_64 flathub            system
KDE Application Platform               org.kde.Platform                                                          5.15         x86_64 flathub            system
KDE Application Platform               org.kde.Platform                                                          5.15-21.08   x86_64 flathub            system
KDE Application Platform               org.kde.Platform                                                          5.15-22.08   x86_64 flathub            system
KDE Application Platform               org.kde.Platform                                                          6.4          x86_64 flathub            system
KDE Software Development Kit           org.kde.Sdk                                                               5.15-21.08   x86_64 flathub            system
KDE Software Development Kit           org.kde.Sdk                                                               6.4          x86_64 flathub            system
Krita                                  org.kde.krita                                    5.1.5                    stable       x86_64 flathub            system
Codecs                                 org.kde.krita.Codecs                                                      stable       x86_64 flathub            system
KWrite                                 org.kde.kwrite                                   23.04.1                  stable       x86_64 flathub            system
Okular                                 org.kde.okular                                   22.08.3                  stable       x86_64 flathub            system
MAME                                   org.mamedev.MAME                                 0.254                    stable       x86_64 flathub            system
Firefox                                org.mozilla.firefox                              111.0.1                  stable       x86_64 flathub            system
OpenAndroidInstaller                   org.openandroidinstaller.OpenAndroidInstaller    v0.4.2-beta              stable       x86_64 flathub            system
PPSSPP                                 org.ppsspp.PPSSPP                                1.14.4                   stable       x86_64 flathub            system
Remmina                                org.remmina.Remmina                              1.4.27                   stable       x86_64 flathub            system
Ryujinx                                org.ryujinx.Ryujinx                              1.1.798                  stable       x86_64 flathub            system
Tenacity                               org.tenacityaudio.Tenacity                       1.3-beta3                stable       x86_64 flathub            system
Wez's Terminal Emulator                org.wezfurlong.wezterm                           20230408-112425-69ae8472 stable       x86_64 flathub            system
Wine                                   org.winehq.Wine                                  8.0                      stable-22.08 x86_64 flathub            system
DXVK                                   org.winehq.Wine.DLLs.dxvk                        1.10.3                   stable-22.08 x86_64 flathub            system
Gecko                                  org.winehq.Wine.gecko                                                     stable-22.08 x86_64 flathub            system
Mono                                   org.winehq.Wine.mono                                                      stable-22.08 x86_64 flathub            system
WineWechat                             org.winehq.WineWechat                            0.1                      master       x86_64 winewechat1-origin system
yuzu                                   org.yuzu_emu.yuzu                                                         stable       x86_64 flathub            system
Insomnia                               rest.insomnia.Insomnia                           2023.1.0                 stable       x86_64 flathub            system
Yandex Browser                         ru.yandex.Browser                                23.3.1.912               stable       x86_64 flathub            system
q4wine                                 ua.org.brezblock.q4wine                          1.3.13                   stable       x86_64 flathub            system
PuTTY                                  uk.org.greenend.chiark.sgtatham.putty            0.78                     stable       x86_64 flathub            system