]>
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 os_release
=$
(test -e /etc
/os-release
&& echo /etc
/os-release ||
echo /usr
/lib
/os-release
)
13 ID_LIKE
=$
(awk -F= '$1=="ID_LIKE" { print $2 ;}' $os_release)
14 if [[ "$ID_LIKE" = *"suse"* ]]; then
16 mkdir
-p "$root/lib64"
17 for lib
in $
(find /lib
*/ld
*); do
18 [[ -d $root/$
(dirname $lib) ]] || mkdir
-p $root/$
(dirname $lib)
23 mkdir
-p "$root/usr/lib"
24 touch "$root/usr/lib/os-release"
26 ln -s busybox
"$root/bin/sh"
27 ln -s busybox
"$root/bin/cat"
28 ln -s busybox
"$root/bin/tr"
29 ln -s busybox
"$root/bin/ps"
30 ln -s busybox
"$root/bin/ip"
33 cat <<'EOF' >"$root/sbin/init"
39 printf "/proc/1/cmdline:\n"
40 printf "%s\n\n" "$(tr '\0' ' ' </proc/1/cmdline)"
42 printf "/proc/1/environ:\n"
43 printf "%s\n\n" "$(tr '\0' '\n' </proc/1/environ)"
45 printf "/proc/1/mountinfo:\n"
46 cat /proc/self/mountinfo
49 printf "/proc/1/cgroup:\n"
50 printf "%s\n\n" "$(cat /proc/1/cgroup)"
52 printf "/proc/1/uid_map:\n"
53 printf "%s\n\n" "$(cat /proc/1/uid_map)"
55 printf "/proc/1/setgroups:\n"
56 printf "%s\n\n" "$(cat /proc/1/setgroups)"
58 printf "/proc/1/gid_map:\n"
59 printf "%s\n\n" "$(cat /proc/1/gid_map)"
64 chmod +x
"$root/sbin/init"