[Topic discussion] 玲珑系列文章——命令行工具
Tofloor
default avatar
流浪的加菲
deepin
2024-03-07 06:38
Author

命令行工具ll-cli简介

ll-cli是一个包管理器前端,用于管理玲珑应用的安装、卸载、查看、启动、关闭、调试、更新等操作。

查看 ll-cli命令的帮助信息:

ll-cli --help

ll-cli命令的帮助信息如下:

Usage: ll-cli [options] subcommand [sub-option] Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. Arguments: subcommand run ps exec kill install uninstall update query list

列出已安装的应用

ll-cli list命令可以查看已安装的玲珑应用。

查看 ll-cli list命令的帮助信息:

ll-cli list --help

ll-cli list命令的帮助信息如下:

Usage: ll-cli [options] list Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. --type <--type=installed> query installed app --repo-point app repo type to use --nodbus execute cmd directly, not via dbus Arguments: list show installed application

查看已安装的 runtime 和应用,运行 ll-cli list命令:

ll-cli list

ll-cli list 输出如下:

appId name version arch channel module description org.deepin.Runtime runtime 20.5.0 x86_64 linglong runtime runtime of deepin org.deepin.calculator deepin-calculator 5.7.21.4 x86_64 linglong runtime calculator for deepin os org.deepin.camera deepin-camera 6.0.2.6 x86_64 linglong runtime camera for deepin os

从远程仓库查询应用

ll-cli query命令可以查询玲珑远程仓库中的应用信息。

查看 ll-cli query命令的帮助信息:

ll-cli query --help

ll-cli query命令的帮助信息如下:

Usage: ll-cli [options] query com.deepin.demo Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. --repo-point app repo type to use --force query from server directly, not from cache Arguments: query query app info appId application id

通过 ll-cli query命令可以从远程 repo 中查找应用程序信息:

ll-cli query <calculator>

加上 --force可以强制从远程 repo 中查询应用信息:

ll-cli query <calculator> --force

该命令将返回 appid(appid 是应用唯一标识) 中包含 calculator 关键词的所有应用程序信息,包含完整的 appid、应用程序名称、版本、平台及应用描述信息。

ll-cli query calculator --force输出如下:

appId name version arch channel module description org.deepin.calculator deepin-calculator 5.5.23 x86_64 linglong runtime Calculator for UOS org.deepin.calculator deepin-calculator 5.7.1 x86_64 linglong runtime Calculator for UOS

安装应用

ll-cli install命令用来安装玲珑应用。

查看 ll-cli install命令的帮助信息:

ll-cli install --help

ll-cli install命令的帮助信息如下:

Usage: ll-cli [options] install com.deepin.demo Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. --repo-point app repo type to use --nodbus execute cmd directly, not via dbus(only for root user) --channel <--channel=linglong> the channel of app --module <--module=runtime> the module of app Arguments: install install an application appId application id

运行 ll-cli install命令安装玲珑应用:

ll-cli install <org.deepin.calculator>

ll-cli install命令需要输入应用完整的 appid,若仓库有多个版本则会默认安装最高版本。

安装指定版本需在 appid后附加对应版本号:

ll-cli install <org.deepin.calculator/5.1.2>

ll-cli install org.deepin.calculator输出如下:

install org.deepin.calculator , please wait a few minutes... org.deepin.calculator is installing... message: install org.deepin.calculator, version:5.7.21.4 success

应用安装完成后,客户端会显示安装结果信息。

运行应用

ll-cli run命令可以启动一个玲珑应用。

查看 ll-cli run命令的帮助信息:

ll-cli run --help

ll-cli run命令的帮助信息如下:

Usage: ll-cli [options] run com.deepin.demo Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. --repo-point app repo type to use --exec </bin/bash> run exec --no-proxy whether to use dbus proxy in box --filter-name <--filter-name=com.deepin.linglong.A dbus name filter to use ppManager> --filter-path <--filter-path=/com/deepin/linglong/ dbus path filter to use PackageManager> --filter-interface <--filter-interface=com.deepin. dbus interface filter to linglong.PackageManager> use Arguments: run run application appId application id

当应用被正常安装后,使用 ll-cli run命令即可启动:

ll-cli run <org.deepin.calculator>

默认情况下执行run命令会启动最高版本的应用,若需运行指定版本应用,需在 appid后附加对应版本号:

ll-cli run <org.deepin.calculator/5.7.21.4>

默认情况下会使用 ll-dbus-proxy拦截转发 dbus消息,如果不想使用 ll-dbus-proxy,可以使用 --no-proxy参数:

ll-cli run <org.deepin.calculator> --no-proxy

使用 ll-cli run命令可以进入指定程序容器环境:

ll-cli run <org.deepin.calculator> --exec /bin/bash

进入后可执行 shell 命令,如 gdbstracelsfind等。

由于玲珑应用都是在容器内运行,无法通过常规的方式直接调试,需要在容器内运行调试工具,如 gdb

gdb /opt/apps/org.deepin.calculator/files/bin/deepin-calculator

该路径为容器内应用程序的绝对路径。

玲珑应用 release版本更多调试信息请参考:常见运行问题

卸载应用

ll-cli uninstall命令可以卸载玲珑应用。

查看 ll-cli uninstall命令的帮助信息:

ll-cli uninstall --help

ll-cli uninstall命令的帮助信息如下:

Usage: ll-cli [options] uninstall com.deepin.demo Options: -h, --help Displays this help. --default-config default config json filepath --nodbus execute cmd directly, not via dbus --repo-point app repo type to use Arguments: uninstall uninstall an application appId application id

使用 ll-cli uninstall命令卸载玲珑应用:

ll-cli uninstall <org.deepin.calculator>

ll-cli uninstall org.deepin.calculator命令输出如下:

uninstall org.deepin.calculator , please wait a few minutes... message: uninstall org.deepin.calculator, version:5.7.21.4 success

默认卸载最高版本,可以通过 appid后附加对应版本号卸载指定版本:

ll-cli uninstall <org.deepin.calculator/5.1.2>

该命令执行成功后,该玲珑应用将从系统中被卸载掉。

更新应用

ll-cli update命令可以更新玲珑应用。

查看 ll-cli update命令的帮助信息:

ll-cli update --help

ll-cli update命令的帮助信息如下:

Usage: ll-cli [options] update com.deepin.demo Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. --channel <--channel=linglong> the channel of app --module <--module=runtime> the module of app Arguments: update update an application appId application id

通过 ll-cli update命令将本地软件包版本更新到远端仓库中的最新版本,如:

ll-cli update <org.deepin.calculator>

ll-cli update org.deepin.calculator命令输出如下:

update org.deepin.calculator , please wait a few minutes... org.deepin.calculator is updating... message: update org.deepin.calculator success, version:5.7.16 --> 5.7.21.4

更新指定版本到最新版本:

ll-cli update <org.deepin.calculator/5.7.16>

查看运行中的应用

ll-cli ps命令可以查看正在运行的玲珑应用。

查看 ll-cli ps命令的帮助信息:

ll-cli ps --help

ll-cli ps 命令的帮助信息如下:

Usage: ll-cli [options] ps Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. --output-format <console> json/console Arguments: ps show running applications

查看正在运行的应用,运行 ll-cli ps命令:

ll-cli ps

ll-cli ps命令输出如下:

App ContainerID Pid Path org.deepin.calculator/5.7.21.4/x86_64 7c4299db7f5647428a79896658efa35c 1943975 /run/user/1000/linglong/7c4299db7f5647428a79896658efa35c

进入容器内部

ll-cli exec命令可以进入正在运行的容器内部。

查看 ll-cli exec命令的帮助信息:

ll-cli exec --help

ll-cli exec命令的帮助信息如下:

Usage: ll-cli [options] exec 9c41c0af2bad4617aea8485f5aaeb93a "bash" Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. -e, --env <env> extra environment variables splited by comma -d, --path <pwd> location to exec the new command Arguments: exec exec command in container containerId container id cmd command

新开一个终端,执行如下命令:

killall ll-service ll-service

使用 ll-cli exec进入正在运行的容器内部:

ll-cli exec 9c41c0af2bad4617aea8485f5aaeb93a /bin/bash

返回 ll-service终端界面,发现已进入应用容器。

ls -l / 查看根目录结构,输出如下:

lrwxrwxrwx 1 root root 8 7月 27 20:58 bin -> /usr/bin drwxr-xr-x 7 root root 420 7月 27 20:58 dev drwxr-xr-x 119 nobody nogroup 12288 7月 27 20:37 etc drwxr-xr-x 3 root root 60 7月 27 20:58 home lrwxrwxrwx 1 root root 8 7月 27 20:58 lib -> /usr/lib lrwxrwxrwx 1 root root 10 7月 27 20:58 lib32 -> /usr/lib32 lrwxrwxrwx 1 root root 10 7月 27 20:58 lib64 -> /usr/lib64 lrwxrwxrwx 1 root root 11 7月 27 20:58 libx32 -> /usr/libx32 drwxr-xr-x 2 root root 40 7月 27 20:58 ll-host drwxr-xr-x 3 root root 60 7月 27 20:58 opt dr-xr-xr-x 365 nobody nogroup 0 7月 27 20:58 proc drwxr-xr-x 6 root root 120 7月 27 20:58 run drwxr-xr-x 7 nobody nogroup 4096 1月 1 1970 runtime dr-xr-xr-x 13 nobody nogroup 0 7月 21 16:43 sys drwxr-xr-x 3 root root 4096 7月 27 20:58 tmp drwxr-xr-x 15 nobody nogroup 4096 6月 30 16:22 usr drwxr-xr-x 13 nobody nogroup 4096 6月 30 16:23 var

强制退出应用

ll-cli kill命令可以强制退出正在运行的玲珑应用。

查看 ll-cli kill命令的帮助信息:

ll-cli kill --help

ll-cli kill 命令的帮助信息如下:

Usage: ll-cli [options] kill container-id Options: -h, --help Displays this help. --default-config default config json filepath Arguments: kill kill container with id container-id container id

使用 ll-cli kill 命令可以强制退出正在运行的玲珑应用:

ll-cli kill <9c41c0af2bad4617aea8485f5aaeb93a>

ll-cli kill 9c41c0af2bad4617aea8485f5aaeb93a命令输出如下:

kill app:org.deepin.calculator/5.7.21.4/x86_64 success

原文:玲珑-命令行工具

其他:

玲珑官网:https://www.linglong.space/

玲珑系列文章——玲珑简介

玲珑系列文章——构建工具

玲珑系列文章——调试玲珑应用

Reply Favorite View the author
All Replies
流浪的加菲
deepin
2024-03-07 06:38
#1

搬砖的快乐blush

Reply View the author
阿尼樱奈奈
deepin
2024-03-07 06:44
#2

ll-cli query这个在新版已经改成ll-cli search了吧

Reply View the author
流浪的加菲
deepin
2024-03-07 07:03
#3
阿尼樱奈奈

ll-cli query这个在新版已经改成ll-cli search了吧

貌似是的,文档还没更新,哈哈😂

Reply View the author
New Thread

Popular Events

More
国际排名
WHLUG