lxc-test-unpriv revision ef4deb7f20dea12dd4225bbcc4ab471d0454289d
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen# lxc: linux Container library
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen# Serge Hallyn <serge.hallyn@ubuntu.com>
39ea5717264668e2c7f9f7986eb821d21785f47fTimo Sirainen# This is a test script for unprivileged containers
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen# This library is free software; you can redistribute it and/or
3954326e793bdef1e94e0ad781ed6cc7e48beebbTimo Sirainen# modify it under the terms of the GNU Lesser General Public
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen# License as published by the Free Software Foundation; either
f8ead0942a9b7c8fcf91414ed1b534d5807ca555Timo Sirainen# version 2.1 of the License, or (at your option) any later version.
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen# This library is distributed in the hope that it will be useful,
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen# but WITHOUT ANY WARRANTY; without even the implied warranty of
9c7f6dbf65ca01026e5f9c8c8b67c7e629c0b5e7Timo Sirainen# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
92d1458b00f4f236c4cec96a696253d3bbf8b05aTimo Sirainen# Lesser General Public License for more details.
8d25b6ad05b99e75613cb045a121efd51e6afbb6Timo Sirainen# You should have received a copy of the GNU Lesser General Public
8d25b6ad05b99e75613cb045a121efd51e6afbb6Timo Sirainen# License along with this library; if not, write to the Free Software
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
d3fce898d31ad40b554c91f3035a7f4d7d52ed52Timo Sirainen# This test assumes an Ubuntu host
3954326e793bdef1e94e0ad781ed6cc7e48beebbTimo Sirainen echo 'run as root'
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenwhich newuidmap >/dev/null 2>&1 || { echo "'newuidmap' command is missing" >&2; exit 1; }
d694b6009574ee6e3cfaee3834cbdbcd431affb0Timo Sirainen sed -i '/lxcunpriv/d' /run/lxc/nics /etc/lxc/lxc-usernet
d694b6009574ee6e3cfaee3834cbdbcd431affb0Timo Sirainen sed -i '/^lxcunpriv:/d' /etc/subuid /etc/subgid
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen if [ $DONE -eq 0 ]; then
d694b6009574ee6e3cfaee3834cbdbcd431affb0Timo Sirainen env http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen# create a test user
cd $HDIR