Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
9e214906
Commit
9e214906
authored
Oct 23, 2013
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-busybox: if in userns, don't try to mknod
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
Acked-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
parent
c4d10a05
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
lxc-busybox.in
templates/lxc-busybox.in
+18
-0
No files found.
templates/lxc-busybox.in
View file @
9e214906
...
@@ -20,6 +20,17 @@
...
@@ -20,6 +20,17 @@
# License along with this library; if not, write to the Free Software
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
am_in_userns
()
{
[
-e
/proc/self/uid_map
]
||
{
echo
no
;
return
;
}
[
"
$(
wc
-l
/proc/self/uid_map |
awk
'{ print $1 }'
)
"
-eq
1
]
||
{
echo yes
;
return
;
}
line
=
$(
awk
'{ print $1 " " $2 " " $3 }'
/proc/self/uid_map
)
[
"
$line
"
=
"0 0 4294967295"
]
&&
{
echo
no
;
return
;
}
echo yes
}
in_userns
=
0
[
$(
am_in_userns
)
=
"yes"
]
&&
in_userns
=
1
install_busybox
()
install_busybox
()
{
{
rootfs
=
$1
rootfs
=
$1
...
@@ -55,6 +66,12 @@ $rootfs/usr/lib64"
...
@@ -55,6 +66,12 @@ $rootfs/usr/lib64"
pushd
$rootfs
/dev
>
/dev/null
||
return
1
pushd
$rootfs
/dev
>
/dev/null
||
return
1
# minimal devices needed for busybox
# minimal devices needed for busybox
if
[
$in_userns
-eq
1
]
;
then
for
dev
in
tty
console tty0 tty1 tty5 ram0 null urandom
;
do
touch
$rootfs
/dev/
$dev
echo
"/dev/
$dev
dev/
$dev
none bind 0 0"
>>
$path
/fstab
done
else
mknod tty
c 5 0
||
res
=
1
mknod tty
c 5 0
||
res
=
1
mknod
console c 5 1
||
res
=
1
mknod
console c 5 1
||
res
=
1
chmod
666
tty
console
||
res
=
1
chmod
666
tty
console
||
res
=
1
...
@@ -68,6 +85,7 @@ $rootfs/usr/lib64"
...
@@ -68,6 +85,7 @@ $rootfs/usr/lib64"
chmod
666 null
||
res
=
1
chmod
666 null
||
res
=
1
mknod
urandom c 1 9
||
res
=
1
mknod
urandom c 1 9
||
res
=
1
chmod
666 urandom
||
res
=
1
chmod
666 urandom
||
res
=
1
fi
popd
>
/dev/null
popd
>
/dev/null
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment