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
f52c0d26
Commit
f52c0d26
authored
Jul 21, 2015
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #597 from smoser/ubuntu-cloud-vendordata
lxc-ubuntu-cloud: support passing vendor-data
parents
b9efb0c9
5d066f24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
ubuntu-cloud-prep
hooks/ubuntu-cloud-prep
+14
-2
lxc-ubuntu-cloud.in
templates/lxc-ubuntu-cloud.in
+2
-1
No files found.
hooks/ubuntu-cloud-prep
View file @
f52c0d26
...
@@ -31,13 +31,14 @@ Usage: ${0##*/} [options] root-dir
...
@@ -31,13 +31,14 @@ Usage: ${0##*/} [options] root-dir
[ -L | --nolocales ]: Do not copy host's locales into container
[ -L | --nolocales ]: Do not copy host's locales into container
[ -S | --auth-key ]: ssh public key file for datasource [ds]
[ -S | --auth-key ]: ssh public key file for datasource [ds]
[ -u | --userdata ]: user-data file for cloud-init [ds]
[ -u | --userdata ]: user-data file for cloud-init [ds]
[ -V | --vendordata ]: vendor-data file for cloud-init [ds]
EOF
EOF
}
}
prep
()
{
prep
()
{
local
short_opts
=
"Chi:L:S:u:v"
local
short_opts
=
"Chi:L:S:u:v"
local
long_opts
=
"auth-key:,cloud,help,hostid:,name:,nolocales:,create-etc-init,userdata:,verbose"
local
long_opts
=
"auth-key:,cloud,help,hostid:,name:,nolocales:,create-etc-init,userdata:,ve
ndordata:,ve
rbose"
local
getopt_out getopt_ret
local
getopt_out getopt_ret
getopt_out
=
$(
getopt
--name
"
${
0
##*/
}
"
\
getopt_out
=
$(
getopt
--name
"
${
0
##*/
}
"
\
--options
"
${
short_opts
}
"
--long
"
${
long_opts
}
"
--
"
$@
"
2>/dev/null
)
||
--options
"
${
short_opts
}
"
--long
"
${
long_opts
}
"
--
"
$@
"
2>/dev/null
)
||
...
@@ -49,7 +50,7 @@ prep() {
...
@@ -49,7 +50,7 @@ prep() {
fi
fi
local
cur
=
""
next
=
""
local
cur
=
""
next
=
""
local
userdata
=
""
hostid
=
""
authkey
=
""
locales
=
1
cloud
=
0
local
vendordata
=
""
userdata
=
""
hostid
=
""
authkey
=
""
locales
=
1
cloud
=
0
local
create_etc_init
=
0
name
=
"ubuntucloud-lxc"
local
create_etc_init
=
0
name
=
"ubuntucloud-lxc"
while
[
$#
-ne
0
]
;
do
while
[
$#
-ne
0
]
;
do
...
@@ -65,6 +66,10 @@ prep() {
...
@@ -65,6 +66,10 @@ prep() {
[
-f
"
$next
"
]
||
[
-f
"
$next
"
]
||
{
error
"--auth-key: '
$next
' not a file"
;
return
1
;
}
{
error
"--auth-key: '
$next
' not a file"
;
return
1
;
}
authkey
=
"
$next
"
;;
authkey
=
"
$next
"
;;
-V
|
--vendordata
)
[
-f
"
$next
"
]
||
{
error
"--vendordata: '
$next
' not a file"
;
return
1
;
}
vendordata
=
"
$next
"
;;
-u
|
--userdata
)
-u
|
--userdata
)
[
-f
"
$next
"
]
||
[
-f
"
$next
"
]
||
{
error
"--userdata: '
$next
' not a file"
;
return
1
;
}
{
error
"--userdata: '
$next
' not a file"
;
return
1
;
}
...
@@ -156,6 +161,13 @@ prep() {
...
@@ -156,6 +161,13 @@ prep() {
error
"failed to write user-data write to '
$seed_d
/user-data'"
;
error
"failed to write user-data write to '
$seed_d
/user-data'"
;
return
1
;
return
1
;
}
}
if
[
-n
"
$vendordata
"
]
;
then
cp
"
$vendordata
"
"
$seed_d
/vendor-data"
||
{
error
"failed copy vendordata to
$seed_d
/vendor-data"
;
return
1
;
}
fi
fi
fi
}
}
...
...
templates/lxc-ubuntu-cloud.in
View file @
f52c0d26
...
@@ -146,7 +146,7 @@ EOF
...
@@ -146,7 +146,7 @@ EOF
return
0
return
0
}
}
options
=
$(
getopt
-o
a:hp:r:n:Fi:CLS:T:ds:u:
-l
arch
:,help,rootfs:,path:,release:,name:,flush-cache,hostid:,auth-key:,cloud,no_locales,tarball:,debug,stream:,userdata:,mapped-uid:,mapped-gid:
--
"
$@
"
)
options
=
$(
getopt
-o
a:hp:r:n:Fi:CLS:T:ds:u:
-l
arch
:,help,rootfs:,path:,release:,name:,flush-cache,hostid:,auth-key:,cloud,no_locales,tarball:,debug,stream:,userdata:,
vendordata:,
mapped-uid:,mapped-gid:
--
"
$@
"
)
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
usage
$(
basename
$0
)
usage
$(
basename
$0
)
exit
1
exit
1
...
@@ -213,6 +213,7 @@ do
...
@@ -213,6 +213,7 @@ do
-L
|
--no
?locales
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--no-locales"
;
shift
1
;;
-L
|
--no
?locales
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--no-locales"
;
shift
1
;;
-i
|
--hostid
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--hostid=
$2
"
;
shift
2
;;
-i
|
--hostid
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--hostid=
$2
"
;
shift
2
;;
-u
|
--userdata
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--userdata=
$2
"
;
shift
2
;;
-u
|
--userdata
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--userdata=
$2
"
;
shift
2
;;
-V
|
--vendordata
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--vendordata=
$2
"
;
shift
2
;;
-C
|
--cloud
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--cloud"
;
shift
1
;;
-C
|
--cloud
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--cloud"
;
shift
1
;;
-S
|
--auth-key
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--auth-key=
$2
"
;
shift
2
;;
-S
|
--auth-key
)
cloneargs[
${#
cloneargs
[@]
}
]=
"--auth-key=
$2
"
;
shift
2
;;
--mapped-uid
)
mapped_uid
=
$2
;
shift
2
;;
--mapped-uid
)
mapped_uid
=
$2
;
shift
2
;;
...
...
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