跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

06-enable-mdns-on-systemd.sh

36 行 · 1.3 KB历史下载
1#!/bin/bash
2
3# SPDX-FileCopyrightText: Copyright The Lima Authors
4# SPDX-License-Identifier: Apache-2.0
5
6set -eux -o pipefail
7
8# Do nothing on OpenRC systems (e.g., Alpine Linux)
9if [[ -f /sbin/openrc-run ]]; then
10 exit 0
11fi
12
13# It depends on systemd-resolved
14command -v systemctl >/dev/null 2>&1 || exit 0
15command -v resolvectl >/dev/null 2>&1 || exit 0
16
17# Configure systemd-resolved to enable mDNS resolution globally
18enable_mdns_conf_path=/etc/systemd/resolved.conf.d/00-lima-enable-mdns.conf
19enable_mdns_conf_content="[Resolve]
20MulticastDNS=yes
21"
22# Create /etc/systemd/resolved.conf.d/00-lima-enable-mdns.conf if its content is different
23if [ "$(echo "${enable_mdns_conf_content}" | sha256sum)" != "$(sha256sum <"${enable_mdns_conf_path}" 2>/dev/null)" ]; then
24 mkdir -p "$(dirname "${enable_mdns_conf_path}")"
25 echo "${enable_mdns_conf_content}" >"${enable_mdns_conf_path}"
26 systemctl daemon-reload
27 systemctl restart systemd-resolved.service
28fi
29
30# On Ubuntu, systemd.network's configuration won't work.
31# See: https://unix.stackexchange.com/a/652582
32# So we need to enable mDNS per-link using resolvectl.
33for iface in $(resolvectl status | sed -n -E 's/^Link +[0-9]+ \(([^)]+)\)/\1/p'); do
34 # This setting is volatile and will be lost on reboot, so we need to set it every time
35 resolvectl mdns "${iface}" yes
36done