-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdistrobox-rootless.patch
More file actions
57 lines (55 loc) · 2.19 KB
/
distrobox-rootless.patch
File metadata and controls
57 lines (55 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
diff -ruN original/distrobox-create bin/distrobox-create
--- original/distrobox-create 2024-08-11 21:22:15.657104792 +0800
+++ bin/distrobox-create 2024-08-11 21:22:46.516753609 +0800
@@ -937,9 +937,9 @@
--entrypoint /usr/bin/entrypoint
${container_image}
--verbose
- --name \"${container_user_name}\"
- --user ${container_user_uid}
- --group ${container_user_gid}
+ --name root
+ --user 0
+ --group 0
--home \"${container_user_custom_home:-"${container_user_home}"}\"
--init \"${init}\"
--nvidia \"${nvidia}\"
diff -ruN original/distrobox-enter bin/distrobox-enter
--- original/distrobox-enter 2024-08-11 20:44:21.847629493 +0800
+++ bin/distrobox-enter 2024-08-11 22:41:50.913434073 +0800
@@ -83,7 +83,7 @@
# Defaults
container_command=""
# by default we use getent to get the login shell of the user and use that
-container_command_user="$(echo "${USER}" | sed 's|\\|\\\\|g')"
+container_command_user="$(echo root | sed 's|\\|\\\\|g')"
container_command_login="/bin/sh -c \"\\\$(getent passwd ${container_command_user} | cut -f 7 -d :) -l\""
container_image_default="registry.fedoraproject.org/fedora-toolbox:39"
container_manager="autodetect"
@@ -398,7 +398,7 @@
fi
else
result_command="${result_command}
- --user=\"${USER}\""
+ --user='root'"
fi
# For some usage, like use in service, or launched by non-terminal
@@ -441,7 +441,7 @@
set +o xtrace
# disable logging for this snippet, or it will be too talkative.
for i in $(printenv | grep '=' | grep -Ev ' |"|`|\$' |
- grep -Ev '^(CONTAINER_ID|HOST|HOSTNAME|HOME|PATH|PROFILEREAD|SHELL|XDG_SEAT|XDG_VTNR|XDG_.*_DIRS|^_)'); do
+ grep -Ev '^(CONTAINER_ID|HOST|HOSTNAME|HOME|PATH|PROFILEREAD|USER|LOGNAME|SHELL|XDG_SEAT|XDG_VTNR|XDG_.*_DIRS|^_)'); do
# We filter the environment so that we do not have strange variables,
# multiline or containing spaces.
# We also NEED to ignore the HOME variable, as this is set at create time
@@ -450,6 +450,10 @@
--env \"${i}\""
done
+ result_command="${result_command}
+ --env \"LOGNAME=root\"
+ --env \"USER=root\""
+
# Start with the $PATH set in the container's config
container_paths="${container_path:-""}"
# Ensure the standard FHS program paths are in PATH environment