]>
git.ipfire.org Git - thirdparty/systemd.git/blob - test/create-busybox-container
7 root
="${1:?Usage $0 container-root}"
10 cp $
(type -P busybox
) "$root/bin"
12 ID_LIKE
=$
(awk -F= '$1=="ID_LIKE" { print $2 ;}' /etc
/os-release
)
13 if [[ "$ID_LIKE" = *"suse"* ]]; then
15 mkdir
-p "$root/lib64"
16 for lib
in $
(find /lib
*/ld
*); do
17 [[ -d $root/$
(dirname $lib) ]] || mkdir
-p $root/$
(dirname $lib)
22 mkdir
-p "$root/usr/lib"
23 touch "$root/usr/lib/os-release"
25 ln -s busybox
"$root/bin/sh"
26 ln -s busybox
"$root/bin/cat"
27 ln -s busybox
"$root/bin/tr"
28 ln -s busybox
"$root/bin/ps"
29 ln -s busybox
"$root/bin/ip"
32 cat <<'EOF' >"$root/sbin/init"
38 printf "/proc/1/cmdline:\n"
39 printf "%s\n\n" "$(tr '\0' ' ' </proc/1/cmdline)"
41 printf "/proc/1/environ:\n"
42 printf "%s\n\n" "$(tr '\0' '\n' </proc/1/environ)"
44 printf "/proc/1/mountinfo:\n"
45 cat /proc/self/mountinfo
48 printf "/proc/1/cgroup:\n"
49 printf "%s\n\n" "$(cat /proc/1/cgroup)"
51 printf "/proc/1/uid_map:\n"
52 printf "%s\n\n" "$(cat /proc/1/uid_map)"
54 printf "/proc/1/setgroups:\n"
55 printf "%s\n\n" "$(cat /proc/1/setgroups)"
57 printf "/proc/1/gid_map:\n"
58 printf "%s\n\n" "$(cat /proc/1/gid_map)"
63 chmod +x
"$root/sbin/init"