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
1927a6be
Commit
1927a6be
authored
Oct 14, 2013
by
Laurent Vallar
Committed by
Stéphane Graber
Oct 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-debian: Add --arch option
Signed-off-by:
Laurent Vallar
<
val@zbla.net
>
Acked-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
parent
b269b8ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
17 deletions
+48
-17
lxc-debian.in
templates/lxc-debian.in
+48
-17
No files found.
templates/lxc-debian.in
View file @
1927a6be
...
...
@@ -166,6 +166,7 @@ install_debian()
cache
=
"@LOCALSTATEDIR@/cache/lxc/debian"
rootfs
=
$1
release
=
$2
arch
=
$3
mkdir
-p
@LOCALSTATEDIR@/lock/subsys/
(
flock
-x
200
...
...
@@ -174,19 +175,6 @@ install_debian()
return
1
fi
if
which dpkg
>
/dev/null 2>&1
;
then
arch
=
$(
dpkg
--print-architecture
)
else
arch
=
$(
uname
-m
)
if
[
"
$arch
"
=
"i686"
]
;
then
arch
=
"i386"
elif
[
"
$arch
"
=
"x86_64"
]
;
then
arch
=
"amd64"
elif
[
"
$arch
"
=
"armv7l"
]
;
then
arch
=
"armhf"
fi
fi
echo
"Checking cache download in
$cache
/rootfs-
$release
-
$arch
... "
if
[
!
-e
"
$cache
/rootfs-
$release
-
$arch
"
]
;
then
download_debian
$cache
$arch
$release
...
...
@@ -214,11 +202,13 @@ copy_configuration()
path
=
$1
rootfs
=
$2
hostname
=
$3
arch
=
$4
grep
-q
"^lxc.rootfs"
$path
/config 2>/dev/null
||
echo
"lxc.rootfs =
$rootfs
"
>>
$path
/config
cat
<<
EOF
>>
$path
/config
lxc.tty = 4
lxc.pts = 1024
lxc.arch =
$arch
lxc.utsname =
$hostname
lxc.cap.drop = sys_module mac_admin mac_override sys_time
...
...
@@ -281,24 +271,41 @@ clean()
usage
()
{
cat
<<
EOF
$1
-h|--help -p|--path=<path> -r|--release=<suite> --clean
$1
-h|--help -p|--path=<path> [-a|--arch] [-r|--release=<release>] [-c|--clean]
release: the debian release (e.g. wheezy): defaults to current stable
arch: the container architecture (e.g. amd64): defaults to host arch
EOF
return
0
}
options
=
$(
getopt
-o
hp:n:
r:c
-l
help
,rootfs:,path:,name
:,release:,clean
--
"
$@
"
)
options
=
$(
getopt
-o
hp:n:
a:r:c
-l
help
,rootfs:,path:,name:,arch
:,release:,clean
--
"
$@
"
)
if
[
$?
-ne
0
]
;
then
usage
$(
basename
$0
)
exit
1
fi
eval set
--
"
$options
"
if
which dpkg
>
/dev/null 2>&1
;
then
arch
=
$(
dpkg
--print-architecture
)
else
arch
=
$(
uname
-m
)
if
[
"
$arch
"
=
"i686"
]
;
then
arch
=
"i386"
elif
[
"
$arch
"
=
"x86_64"
]
;
then
arch
=
"amd64"
elif
[
"
$arch
"
=
"armv7l"
]
;
then
arch
=
"armhf"
fi
fi
hostarch
=
$arch
while
true
do
case
"
$1
"
in
-h
|
--help
)
usage
$0
&&
exit
1
;;
-p
|
--path
)
path
=
$2
;
shift
2
;;
--rootfs
)
rootfs
=
$2
;
shift
2
;;
-a
|
--arch
)
arch
=
$2
;
shift
2
;;
-r
|
--release
)
release
=
$2
;
shift
2
;;
-n
|
--name
)
name
=
$2
;
shift
2
;;
-c
|
--clean
)
clean
=
$2
;
shift
2
;;
...
...
@@ -312,6 +319,30 @@ if [ ! -z "$clean" -a -z "$path" ]; then
exit
0
fi
if
[
"
$arch
"
==
"i686"
]
;
then
arch
=
i386
fi
if
[
"
$arch
"
==
"x86_64"
]
;
then
arch
=
amd64
fi
if
[
$hostarch
=
"i386"
-a
$arch
=
"amd64"
]
;
then
echo
"can't create
$arch
container on
$hostarch
"
exit
1
fi
if
[
$hostarch
=
"armhf"
-o
$hostarch
=
"armel"
]
&&
\
[
$arch
!=
"armhf"
-a
$arch
!=
"armel"
]
;
then
echo
"can't create
$arch
container on
$hostarch
"
exit
1
fi
if
[
$hostarch
=
"powerpc"
-a
$arch
!=
"powerpc"
]
;
then
echo
"can't create
$arch
container on
$hostarch
"
exit
1
fi
type
debootstrap
if
[
$?
-ne
0
]
;
then
echo
"'debootstrap' command is missing"
...
...
@@ -349,7 +380,7 @@ if [ -z "$rootfs" ]; then
fi
install_debian
$rootfs
$release
install_debian
$rootfs
$release
$arch
if
[
$?
-ne
0
]
;
then
echo
"failed to install debian"
exit
1
...
...
@@ -361,7 +392,7 @@ if [ $? -ne 0 ]; then
exit
1
fi
copy_configuration
$path
$rootfs
$name
copy_configuration
$path
$rootfs
$name
$arch
if
[
$?
-ne
0
]
;
then
echo
"failed write configuration file"
exit
1
...
...
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