| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# SPDX-License-Identifier: LGPL-2.1+ |
| 4 |
|
| 5 |
# lxc: linux Container library |
| 6 |
|
| 7 |
# Ensure that when /proc and/or /sys do not exist in the container, |
| 8 |
# it is started successfully anyway. |
| 9 |
|
| 10 |
set -ex |
| 11 |
FAIL() { |
| 12 |
echo -n "Failed " >&2 |
| 13 |
echo "$*" >&2 |
| 14 |
lxc-destroy -n lxc-test-procsys -f |
| 15 |
exit 1 |
| 16 |
} |
| 17 |
|
| 18 |
lxc-destroy -n lxc-test-procsys -f || : |
| 19 |
lxc-create -t busybox -n lxc-test-procsys |
| 20 |
rmdir /var/lib/lxc/lxc-test-procsys/rootfs/{proc,sys} |
| 21 |
|
| 22 |
lxc-start -n lxc-test-procsys |
| 23 |
lxc-wait -n lxc-test-procsys -s RUNNING || FAIL "waiting for busybox container to run" |
| 24 |
|
| 25 |
lxc-attach -n lxc-test-procsys -- sh -c 'test -f /proc/version' || FAIL "/proc/version not found" |
| 26 |
lxc-attach -n lxc-test-procsys -- sh -c 'test -d /sys/fs' || FAIL "/sys/fs not found" |
| 27 |
|
| 28 |
lxc-destroy -n lxc-test-procsys -f |
| 29 |
exit 0 |