mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
d8167c5212
This reverts commit 491b736a49
.
If the _static_ linked version of busybox is installed, openSUSE doesn't need
any specific code.
A following commit will make sure that the static linked version of busybox is
installed in the busybox container.
61 lines
1.3 KiB
Bash
Executable File
61 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
set -u
|
|
set -o pipefail
|
|
|
|
root="${1:?Usage $0 container-root}"
|
|
mkdir -p "$root"
|
|
mkdir "$root/bin"
|
|
|
|
# On openSUSE the static linked version of busybox is named "busybox-static".
|
|
busybox="$(type -P busybox-static || type -P busybox)"
|
|
cp "$busybox" "$root/bin/busybox"
|
|
|
|
mkdir -p "$root/usr/lib"
|
|
touch "$root/usr/lib/os-release"
|
|
|
|
ln -s busybox "$root/bin/sh"
|
|
ln -s busybox "$root/bin/cat"
|
|
ln -s busybox "$root/bin/tr"
|
|
ln -s busybox "$root/bin/ps"
|
|
ln -s busybox "$root/bin/ip"
|
|
ln -s busybox "$root/bin/seq"
|
|
ln -s busybox "$root/bin/sleep"
|
|
ln -s busybox "$root/bin/usleep"
|
|
ln -s busybox "$root/bin/test"
|
|
|
|
mkdir -p "$root/sbin"
|
|
cat <<'EOF' >"$root/sbin/init"
|
|
#!/bin/sh
|
|
|
|
printf "ps aufx:\n"
|
|
ps aufx
|
|
|
|
printf "/proc/1/cmdline:\n"
|
|
printf "%s\n\n" "$(tr '\0' ' ' </proc/1/cmdline)"
|
|
|
|
printf "/proc/1/environ:\n"
|
|
printf "%s\n\n" "$(tr '\0' '\n' </proc/1/environ)"
|
|
|
|
printf "/proc/1/mountinfo:\n"
|
|
cat /proc/self/mountinfo
|
|
printf "\n"
|
|
|
|
printf "/proc/1/cgroup:\n"
|
|
printf "%s\n\n" "$(cat /proc/1/cgroup)"
|
|
|
|
printf "/proc/1/uid_map:\n"
|
|
printf "%s\n\n" "$(cat /proc/1/uid_map)"
|
|
|
|
printf "/proc/1/setgroups:\n"
|
|
printf "%s\n\n" "$(cat /proc/1/setgroups)"
|
|
|
|
printf "/proc/1/gid_map:\n"
|
|
printf "%s\n\n" "$(cat /proc/1/gid_map)"
|
|
|
|
printf "ip link:\n"
|
|
ip link
|
|
EOF
|
|
chmod +x "$root/sbin/init"
|