跳到主要内容

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

浏览文件

35-setup-packages.sh

59 行 · 2.3 KB历史下载
1#!/bin/sh
2
3# SPDX-FileCopyrightText: Copyright The Lima Authors
4# SPDX-License-Identifier: Apache-2.0
5
6set -eux
7
8update_fuse_conf() {
9 # Modify /etc/fuse.conf (/etc/fuse3.conf) to allow "-o allow_root"
10 if [ "${LIMA_CIDATA_MOUNTS}" -gt 0 ]; then
11 fuse_conf="/etc/fuse.conf"
12 if [ -e /etc/fuse3.conf ]; then
13 fuse_conf="/etc/fuse3.conf"
14 fi
15 if ! grep -q "^user_allow_other" "${fuse_conf}"; then
16 echo "user_allow_other" >>"${fuse_conf}"
17 fi
18 fi
19
20 # Some distribution (since Ubuntu-25.04) has an apparmor rule for fusermount3. It causes SSHFS mount failed.
21 # Related Issue: https://github.com/lima-vm/lima/issues/4908
22 # The profile only allows mounting under home, /mnt, /tmp and /media, but a mount point mirrors
23 # the host path, so it can be anywhere, such as /Users/USER from a macOS host or /c/Users/USER
24 # from a Windows one.
25 # Therefore, define a custom rule for each mount point to loosen the apparmor rule.
26 if [ -e "/etc/apparmor.d/fusermount3" ] && [ "${LIMA_CIDATA_MOUNTS}" -gt 0 ]; then
27 {
28 echo "# Lima overwrites this file on every boot."
29 # NOTE: Busybox sh does not support `for ((i=0;i<$N;i++))` form
30 for f in $(seq 0 $((LIMA_CIDATA_MOUNTS - 1))); do
31 mountpointvar="LIMA_CIDATA_MOUNTS_${f}_MOUNTPOINT"
32 mountpoint="$(eval echo \$"$mountpointvar")"
33 # The trailing slash matters because apparmor matches the mount point as a directory.
34 echo "mount fstype=@{fuse_types} options=(nosuid,nodev) options in (ro,rw,noatime,dirsync,nodiratime,noexec,sync) -> \"${mountpoint}/\","
35 echo "umount \"${mountpoint}/\","
36 done
37 } >"/etc/apparmor.d/local/fusermount3"
38 apparmor_parser -r /etc/apparmor.d/fusermount3
39 fi
40}
41
42# update_fuse_conf has to be called after installing all the packages,
43# otherwise apt-get fails with conflict
44if [ "${LIMA_CIDATA_MOUNTTYPE}" = "reverse-sshfs" ]; then
45 update_fuse_conf
46 echo "${LIMA_CIDATA_IID}" >/run/lima-fuse-ready
47fi
48
49SETUP_DNS=0
50if [ -n "${LIMA_CIDATA_UDP_DNS_LOCAL_PORT}" ] && [ "${LIMA_CIDATA_UDP_DNS_LOCAL_PORT}" -ne 0 ]; then
51 SETUP_DNS=1
52fi
53if [ -n "${LIMA_CIDATA_TCP_DNS_LOCAL_PORT}" ] && [ "${LIMA_CIDATA_TCP_DNS_LOCAL_PORT}" -ne 0 ]; then
54 SETUP_DNS=1
55fi
56if [ "${SETUP_DNS}" = 1 ]; then
57 # Try to setup iptables rule again, in case we just installed iptables
58 "${LIMA_CIDATA_MNT}/boot.Linux/09-host-dns-setup.sh"
59fi