[Share Experiences] 利用玲珑杀手Go(ll-killer-go)迁移QGIS
Tofloor
poster avatar
MeGusta
deepin
2025-03-09 14:38
Author

使用方法:

# 安装稳定版3.42.0
ll-cli install org.qgis.qgis.stable.linyaps_3.42.0.0_x86_64_binary.layer

# 修复linglong-installer产生的程序入口参数问题
sudo fix-qgis-desktop.sh

更新 2025.3.12:

1.更新ll-killer版本;

2.修复了QGIS无法联网的问题。

版本说明:

ll-cli1.7.5

ll-killer1.4.5

成果:

1.构建QGIS 3.42.0 Stable,并包含inkscape、saga、mdbtools、fcitx5-frontend-qt5组件的脚本 及 layer包:

build-qgis-stable-with-inkscape-saga-20250312.zip

org.qgis.qgis.stable.linyaps_3.42.0.0_x86_64_binary.layer

2.构建QGIS 3.40.4 LTR,并包含inkscape、saga、mdbtools、fcitx5-frontend-qt5组件的脚本 及 layer包:

build-qgis-ltr-with-inkscape-saga-20250312.zip

org.qgis.qgis.ltr.linyaps_3.40.4.0_x86_64_binary.layer

3.程序入口修复脚本:

fix-qgis-desktop.zip

当前存在的问题:

1.由于当前玲珑版本(1.7.5)中的未知因素,导致程序菜单中的QGIS Desktop不能启动程序,需要以sudo/root权限运行 fix-qgis-desktop.sh 进行修复。

2.在UOS v20环境中,由于玲珑版本号是旧版的1.6.3,无法正常构建及安装layer包。

正文:

之前在UOS/deepin平台使用QGIS,有两种方法,一种是使用ACE兼容环境,另一种是使用distrobox。

最近几天, 玲珑杀手Go 项目发布了,并且提供了迁移示例,在原来项目的基础上更易于使用。于是照葫芦画瓢,尝试了一下迁移QGIS,竟然成功了,现在分享出来,供大家参考。

以当前的最新稳定版分支,QGIS 3.42.0 Stable为例,软件源采用Ubuntu 24.04 LTS(代号 noble)。

说明1:我日常使用的QGIS插件需要 inkscapemdbtools两个组件,部分的地理分析也需要 saga,如果不需要这些组件,可以在脚本中去除,并自行构建:

# 安装qgis saga inkscape mdbtools
apt install qgis saga inkscape mdbtools

说明2:需要额外安装 fcitx5-frontend-qt5 以支持中文输入

# 安装fcitx5-frontend-qt5提供中文输入支持
apt install fcitx5-frontend-qt5 --no-install-recommends

脚本如下:

#!/bin/bash

# 使用时需定义的变量:

## 1.定义QGIS安装的分支:ltr为长期支持版,stable是最新稳定版
QGIS_BRANCH="stable"
## 2.定义版本号:仅支持安装QGIS的ltr或stable分支的最新版本号,请到 qgis.org/debian 查看。
QGIS_VERSION="3.42.0"

# 构建QGIS仓库后缀字符串
QGIS_SOURCE_SUFFIX=""

if [[ "$QGIS_BRANCH" == "ltr" ]]; then
    QGIS_SOURCE_SUFFIX="-$QGIS_BRANCH"
fi
  
# 创建工作目录并进入
mkdir -p $HOME/qgis-$QGIS_BRANCH

cd $HOME/qgis-$QGIS_BRANCH

# 生成辅助构建文件
ll-killer build-aux

cat >pkg.info <apt.conf.d/limit.conf <sources.list <&1 | tee -a create-project.log

echo "[将qgis及其他组件安装至构建环境]"
ll-killer build --ptrace -- apt install -y qgis saga mdbtools 2>&1 | tee -a apt-install-qgis.log

echo "[将中文输入法支持组件安装至构建环境]"
ll-killer build --ptrace -- apt install -y fcitx5-frontend-qt5 --no-install-recommends  2>&1 | tee -a apt-install-qgis.log

echo "[将python3-pip安装至构建环境]"
ll-killer build --ptrace -- apt install -y python3-pip 2>&1 | tee -a apt-install-pip.log

echo "[将inkscape安装至构建环境]"
ll-killer build --ptrace -- apt install -y inkscape --no-install-recommends  2>&1 | tee -a apt-install-inkscape.log

echo "[检查缺失库]"
ll-killer build -- build-aux/ldd-check.sh > ldd-check.log
echo "[搜索缺失库所在包]"
ll-killer apt -- build-aux/ldd-search.sh ldd-check.log ldd-found.log ldd-notfound.log;
echo "[安装找到的缺失库]"
ll-killer build --ptrace -- apt install -y $(cat ldd-found.log)

echo "[添加deepin的/persistent/home目录映射]"
mkdir -p linglong/filesystem/diff/persistent
if [ ! -L "linglong/filesystem/diff/persistent/home" ] && [ ! -e "linglong/filesystem/diff/persistent/home" ]; then
    ln -s /home linglong/filesystem/diff/persistent/home
fi

echo "[清理多余的程序入口]"
# 目标目录
entries_path="linglong/filesystem/diff/usr/share/applications"

# 遍历目录中的所有文件和子目录
for item in "$entries_path"/*; do
    # 获取文件或目录的名称
    name=$(basename "$item")

    # 检查名称是否包含关键字
    if [[ ! "$name" =~ qgis ]]; then
        rm -rf "$item"
        echo "已删除: $item" 2>&1 | tee -a entries-clean.log
    fi
done

# 更新python*.desktop的图标
for file in "$entries_path"/python*.desktop; do
    if [ -f "$file" ]; then
        sed -i 's|^Icon=.*|Icon=python|' "$file"
        echo "已修改: $file" 2>&1 | tee -a entries-clean.log
    fi
done

echo "[导出layer文件]"
ll-killer layer build



效果如下:

截图_选择区域_20250309145627.png

Reply Favorite View the author
All Replies
System233
deepin
2025-03-09 17:46
#1

测试了下build-qgis-stable-with-inkscape-saga-20250309.sh 脚本,只装到 qgis saga mdbtools fcitx5-frontend-qt5 (硬盘实在没空间了),没有出现 Exec中两次 --file %F的情况,所有desktop文件在容器内调用的命令都是entrypoint.sh打头,对应的setup-desktop.sh快捷方式处理脚本中也是仅在Exec开头追加指令,不应该出现在指令中间插入entrypoint.sh的情况。

考虑到以前手动打包时也遇过ll-builder乱替换Exec指令的情况,也是类似的在指令中重复插入某段代码,不过当时没能复现问题,不知道咋回事。

Exec=/usr/bin/ll-cli run org.qgis.qgis.stable.linyaps --file %F -- /opt/apps/org.qgis.qgis.stable.linyaps/files/entrypoint.sh qgis %%F

image.png

image.png

此外又要说一下玲珑或者DDE的老bug, 如果desktop内指定了 Terminal=true,那么双击打开是这玩意:

image.png

之前跟开发者讨论说这种情况要把Exec指令用引号引起来,但引起来的话在其他平台我感觉会直接打不开,都不是正常的命令了。

Reply View the author
neko
deepin
Ecological co-builder
2025-03-10 10:02
#2

Desktop打不开可能是启动命令多了--,是已知bug等推送更新修复。

Reply View the author
MeGusta
deepin
2025-03-10 12:59
#3
neko

Desktop打不开可能是启动命令多了--,是已知bug等推送更新修复。

Exec=/usr/bin/ll-cli run org.qgis.qgis.stable.linyaps --file %F

这里多了 --file %F

Reply View the author
New Thread

Popular Events

More
国际排名
WHLUG