Commit Graph

52 Commits

Author SHA1 Message Date
deepsource-autofix[bot] f4277e2b74 style: format code with ClangFormat and Prettier
This commit fixes the style issues introduced in 941b502 according to the output
from ClangFormat and Prettier.

Details: None
2025-07-18 15:13:19 +08:00
myml 3cbe65dad1 refactor: simplify environment variable handling in systemd generator
1. Removed debug logging code that was checking for script readability
2. Changed from direct export to echo output for systemd environment
handling
3. Simplified the logic by removing redundant checks since systemd
generators expect echo output
4. The change aligns better with systemd's environment generator
expectations where variables should be echoed rather than exported
directly

refactor: 简化 systemd 生成器中的环境变量处理

1. 移除了检查脚本可读性的调试日志代码
2. 将直接导出改为 echo 输出以适配 systemd 环境处理
3. 通过移除冗余检查简化了逻辑,因为 systemd 生成器期望 echo 输出
4. 此变更更符合 systemd 环境生成器的预期,变量应该通过 echo 输出而非直接
导出
2025-07-07 22:26:54 +08:00
reddevillg c3d8c21aca fix: Isolate app-specific patches in dedicated directories
Previously, app-specific patches were identified by matching the patch
filename (without the extension) against the application ID. This
approach was flawed as it caused patch conflicts between different
applications. For example, a patch named `com.app.A.json`, intended
only for `com.app.A`, would be incorrectly applied as a global patch
to `com.app.B`.

This commit introduces a directory-based mechanism to correctly isolate
application-specific patches. All patches for a specific app must now
reside within a subdirectory named after the app ID.

Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-07-01 20:14:26 +08:00
ComixHe 6d5c1f1404 refactor: some scripts that export env 'XDG_DATA_DIRS'
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-23 16:02:44 +08:00
reddevillg fa063275db fix: remove unused old config
Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-06-19 17:40:18 +08:00
dengbo 51e373aa38 fix: failed to export XDG_DATA_DIRS enviroment
Path "/usr/local/share:/usr/share" must be set when XDG_DATA_DIRS is
empty.
2025-06-16 15:21:13 +08:00
dengbo b54fd561aa feat: add hooks features
Add hooks features for app install.
2025-06-06 17:33:22 +08:00
reddevillg c6386bdfe5 feat: modify the way container patches work
1. provide application level patches
2. application level patches will apply after global patches

move configure.h.in to src root, becasue lib utils depends on QT,
we don't want to introduce QT in certain scenarios.

Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-06-04 14:45:07 +08:00
dengbo 286d413070 fix: export desktop to a invalid export path
1. The custom desktop exported directory(CUSTOM_DATA_DIR) should only be in the share dir, not in the subdirectory;
2. LINGLONG_DATA_DIR should be exported;
3. need to update LINGLONG_EXPORT_VERSION to fix export.
2025-06-04 14:10:12 +08:00
ice909 d9d0a802c6 feat: support specifying the desktop installation directory
Specify 'LINGLONG_DESKTOP_EXPORT_PATH' during compilation.

Signed-off-by: ice909 <gaochang1@uniontech.com>
2025-04-27 14:21:10 +08:00
ComixHe 468466df1f chore: suppress error while executing systemd-generator
file or directory may not exist

Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-07 13:03:20 +08:00
myml 17276ba01d fix: adjust container mount items
在之前的提交中, 本应删除/tmp挂载, 却误删了/dev的挂载
2025-03-26 09:34:49 +08:00
myml a11b66d9e3 fix: no free space when installing dependencies
tmp目录被挂载成tmpfs并且设置了64M大小, 导致安装deb依赖时报错
现在会在宿主机的tmp目录创建新的临时文件夹做为容器的tmp目录
2025-03-18 20:09:59 +08:00
dengbo 845089d652 fix: app cannot be started immediately after exiting
Mount /tmp to tmpfs to prevent some files sharing.
2025-03-12 09:46:18 +08:00
reddevillg f26e6e5046 feat: ll-builder support install package via apt
Provide "build depends" and "depends" for apt build extension, build
phase seperate into build phase and prepare phase. "build depends"
to be installed in build environment before build phase starting, and
preserve in overlayfs. "depends" to be installed in prepare phase, and
will be merged to apps output.
2025-02-24 20:28:37 +08:00
reddevillg 21131d055e fix: Fix incorrect path when build prefix is /usr/local
Fix incorrect path when build prefix is /usr/local
2025-02-11 16:39:59 +08:00
myml 8544c5a0d6 feat: adjust systemd/user priority
XDG_DATA_DIRS下面的systemd优先级很高, 会影响系统systemd服务
将应用的systemd导出到其他地方, 再使用user-generator复制到优先级最低的generator.late目录
2024-12-25 17:31:40 +08:00
ComixHe bb25607b91 refactor(gen): change the way of uising generators
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-12-19 18:21:01 +08:00
ComixHe a39015081c refactor(gen): make all generator as a static library
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-12-18 15:28:04 +08:00
kamiyadm 429bd1cc7c refactor: adjust some cache generation and usage behaviors
The caches that have been processed are ld.so.cache and font cache.

Code:
 * Add a new member ContainerBuilder to PackageManager. (package_manager)
 * Add a new scripts to gererate cache in container. (ld-cache-generator/font-cache-generator)
 * Add new func generateCache() to execute app-cache-generator. (pacakge_manager)
 * Add new func removeCache() to remove cache. (package_manager)
 * Mount the cache during running application. (cli)

Mount:(host->container)
 * Remove /var/cache/fontconfig -> /var/cache/fontconfig
 * Add /usr/local/share/fonts -> /usr/local/share/fonts
 * Add /var/lib/linglong/cache/[hash] -> /run/linglong/cache
 * Add /var/lib/linglong/cache/[hash]/fontconfig -> /var/cache/fontconfig

Config: (config.json)
 * Remove the hooks part.
 * Change env LINGLONG_LD_SO_CACHE to /run/linglong/cache/ld.so.cache.

Log:
2024-12-12 17:26:10 +08:00
ComixHe 032627936c feat: add syncing mecanism between ll-cli and ll-package-manager
ll-package-manager will delay the uninstall process of application
if there are running containers that are using the application that
will be uninstalled and ll-package-manager may not daemonlize anymore
in the future.

So we need a mecanism to sync states and let ll-package-manager to know
how many running container there are and whether container is building
or not.

ll-cli should touch a file under /run/linglong/UID which named
with current pid and left empty to present initialization of ll-cli is
incomplete, ll-package-manager should waiting until all file are valid
(or exit immediately) if ll-package-manager want to uninstalling
package.

Signed-off-by: ComixHe <heyuming@deepin.org>
2024-10-31 13:35:32 +08:00
ComixHe 6f7b243ec2 feat: add new dbus object for migrating underlying storage
Adding version '1' to dbus service 'org.deepin.linglong.PackageManager' and it's dbus object.

Signed-off-by: ComixHe <heyuming@deepin.org>
2024-10-08 17:40:34 +08:00
myml 847b2def61 fix: change the mount options of rootfs
Modify the mount permissions of a root filesystem, so that it allows applications to read and write files to the host file system.
For example, deepin calendar needs to create a systemd timer in the ~/.cache/systemd directory, but ~/.cache directory is overlay by linglong, you can use /run/hosts/rootfs/home/xxx/.cache/systemd.

Bug: https://pms.uniontech.com/bug-view-271647.html
2024-09-29 14:15:19 +08:00
black-desk 4b98ee7682 chore!: remove linglong-upgrade
This patch deprecate the linglong-upgrade script, linglong-upgrade
systemd service and systemd timer.

Check comments in linglong-upgrade.service for more information.
2024-09-10 17:45:20 +08:00
black-desk c3e109848f chore: adjust XDG_DATA_DIRS environment
This patch does two things:

- Adjust linglong data directory order in XDG_DATA_DIRS;

  See comments in
  /misc/lib/systemd/system-environment-generators/61-linglong
  for more information.

- Remove user level linglong data directory in XDG_DATA_DIRS;

  We are not going to implement user level installation in linyaps.

Signed-off-by: black-desk <me@black-desk.cn>
2024-09-05 16:28:00 +08:00
myml ebeae251da feat: do not use bash to execute ldconfig
在制作flatpak的base时发现, flatpak的动态链接器 (ld-linux-x86-64.so.2)
只包含了/usr/lib/x86_64-linux-gnu这一个动态库搜索路径, 导致bash在运行ldconfig之前是无法启动的
所以在容器钩子中不再通过bash运行ldconfig而是直接启动ldconfig, 以兼容复杂的base环境

note: org.gnome.Platform/x86_64/43 和 org.kde.Platform/x86_64/5.15-23.08 都有这个问题

Log:
2024-08-28 10:43:43 +08:00
kamiyadm 8526fae52f fix: the upgrade service affects system startup time
Start the upgrade service after defaults.target.

Log:
2024-08-06 06:27:36 -05:00
black-desk e5127668b7 fix: use d instead of D in tmpfiles.d config
systemd-tmpfiles-setup.service will call systemd-tmpfiles with --remove
at boot, which will remove all D directories.

So we should use d to make --remove not effect on /var/lib/linglong
2024-07-24 15:17:57 +08:00
black-desk b37723d1d2 refact: remove create-linglong-dirs
1. Use tmpfiles.d to create /var/lib/linglong instead of ExecPre of
   systemd service;
2. Run wrap-and-sort;
3. Sort files to configure in misc/CMakeLists.txt.
2024-07-23 17:16:37 +08:00
wrj97 69140f3741
fix: hooks missing command args (#605)
容器hooks缺少命令参数

Log:
2024-07-22 17:40:59 +08:00
myml 9ef46f8ce7 fix: Error when running ldconfig
ldconfig会在生成缓存内容后,移动临时文件到缓存文件,所以不应该将临时文件做成挂载点
现在将缓存文件做成软链接, 软链接指向可读写的位置,可避免 /etc 只读的情况

Log:
2024-07-22 11:31:13 +08:00
black-desk b7fde13559 chore: clean package manager service file
Refer to manpage of systemd.service:

> For bus-activatable services,
> do not include a [Install] section in the systemd service file,
> but use the SystemdService= option
> in the corresponding DBus service file,
> for example ...

We should not have an Install section here.

Also remove some unused capability limit.
2024-07-18 16:23:11 +08:00
dengbo 7f96e5c9ee fix: linglong-session-helper.service not start when reboot
linglong-session-helper.service should WantedBy default.target rather than multi-user.target

Log:
2024-07-15 13:49:58 +08:00
black-desk 26f811a4a9 chore: use MemoryMax in systemd service
Signed-off-by: black-desk <me@black-desk.cn>
2024-07-15 13:07:25 +08:00
dengbo 61e4876269 Revert "fix: linglong-session-helper can not start normal"
This reverts commit 58fa49709f.
2024-07-12 14:01:06 +08:00
dengbo 58fa49709f fix: linglong-session-helper can not start normal
WantedBy should be multi-users in systemd service

Log:
2024-07-12 11:55:29 +08:00
bluesky a2937ea359 feat: add ll-session-helper monitor listening service
通过 ll-session-helper 服务,来监听宿主机上 /etc/resolv.conf ,/etc/localtime等文件的变化。
设置开机自启

Issue: https://github.com/linuxdeepin/developer-center/issues/8989
Log: add ll-session-helper service
2024-07-11 15:54:02 +08:00
myml f8cf372825 feat: Add static suffix to statically linked binaries
lintian检查要求静态链接的二进制, 文件名需要添加-static

Log:
2024-07-01 11:47:32 +08:00
kamiyadm ddea8b0667 refactor: add 25-host-env to generate env variables
Add new generator 25-host-env and use it.

Log:
2024-06-20 10:52:46 +08:00
dengbo 5f496c5e0a feat: org.deepin.linglong.PackageManager add security check
org.deepin.linglong.PackageManager add Capability_Check, Cgroup_Check
and Polkit_Check, it only used to skip DBus security check, it will be removed later

Log:
2024-06-19 10:33:16 +08:00
kamiyadm bc08c49339 fix: move ll-package-manager to /usr/libexec/linglong
close: https://github.com/linuxdeepin/linglong/issues/460

Log:
2024-05-27 16:48:48 +08:00
kamiyadm 9373b35a5f chore: add excutable permission for some config
-

Log:
2024-05-10 18:20:48 +08:00
ComixHe 7f513e0d21 refact(generators): mount to default location
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-05-06 16:40:16 +08:00
kamiyadm e624bbe0df chore: add systemd preset config to enable service
This is only used in the os which use rpm as package manager.
In debian, debhelper will do this job.

Log:
2024-04-26 16:01:39 +08:00
myml 197da7f88e feat: use tmpfs mount /run directory
/run应该是一个tmpfs类型的挂载点

Log:
2024-04-03 15:22:15 +08:00
black-desk ddd014d27a
fix: correct container configuration
Signed-off-by: black-desk <me@black-desk.cn>
2024-04-03 00:10:05 +08:00
black-desk aaab7c5c30
fix: make container config generators work
1. chmod +x
2. fix wrong path
3. skip entries not present on host

Signed-off-by: black-desk <me@black-desk.cn>
2024-04-03 00:10:01 +08:00
black-desk 4d11b4f3e4
fix: move basedir from annotation to "root"
Signed-off-by: black-desk <me@black-desk.cn>
2024-04-03 00:09:59 +08:00
ComixHe 7c345afe47 chore: change generator sequence
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-04-02 18:10:23 +08:00
ComixHe c9be53253f refactor: move some operation to a new generator
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-04-02 17:40:21 +08:00