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
b0f0932a
Commit
b0f0932a
authored
Jan 22, 2014
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-download: Add interactive mode
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
c4e9c69f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
7 deletions
+36
-7
lxc-download.in
templates/lxc-download.in
+36
-7
No files found.
templates/lxc-download.in
View file @
b0f0932a
...
@@ -41,9 +41,11 @@ DOWNLOAD_USE_CACHE="false"
...
@@ -41,9 +41,11 @@ DOWNLOAD_USE_CACHE="false"
DOWNLOAD_URL
=
DOWNLOAD_URL
=
DOWNLOAD_SHOW_HTTP_WARNING
=
"true"
DOWNLOAD_SHOW_HTTP_WARNING
=
"true"
DOWNLOAD_SHOW_GPG_WARNING
=
"true"
DOWNLOAD_SHOW_GPG_WARNING
=
"true"
DOWNLOAD_READY_GPG
=
"false"
DOWNLOAD_COMPAT_LEVEL
=
1
DOWNLOAD_COMPAT_LEVEL
=
1
DOWNLOAD_LIST_IMAGES
=
"false"
DOWNLOAD_LIST_IMAGES
=
"false"
DOWNLOAD_BUILD
=
DOWNLOAD_BUILD
=
DOWNLOAD_INTERACTIVE
=
"false"
LXC_NAME
=
LXC_NAME
=
LXC_PATH
=
LXC_PATH
=
...
@@ -95,6 +97,10 @@ gpg_setup() {
...
@@ -95,6 +97,10 @@ gpg_setup() {
return
return
fi
fi
if
[
"
$DOWNLOAD_READY_GPG
"
=
"true"
]
;
then
return
fi
echo
"Setting up the GPG keyring"
echo
"Setting up the GPG keyring"
mkdir
-p
"
$DOWNLOAD_TEMP
/gpg"
mkdir
-p
"
$DOWNLOAD_TEMP
/gpg"
...
@@ -105,6 +111,8 @@ gpg_setup() {
...
@@ -105,6 +111,8 @@ gpg_setup() {
echo
"ERROR: Unable to fetch GPG key from keyserver."
echo
"ERROR: Unable to fetch GPG key from keyserver."
exit
1
exit
1
fi
fi
DOWNLOAD_READY_GPG
=
"true"
}
}
gpg_validate
()
{
gpg_validate
()
{
...
@@ -234,11 +242,9 @@ if [ "$(in_userns)" = "yes" ]; then
...
@@ -234,11 +242,9 @@ if [ "$(in_userns)" = "yes" ]; then
DOWNLOAD_MODE
=
"user"
DOWNLOAD_MODE
=
"user"
fi
fi
if
([
-z
"
$DOWNLOAD_DIST
"
]
||
[
-z
"
$DOWNLOAD_RELEASE
"
]
||
\
if
[
-z
"
$DOWNLOAD_DIST
"
]
||
[
-z
"
$DOWNLOAD_RELEASE
"
]
||
\
[
-z
"
$DOWNLOAD_ARCH
"
])
&&
[
"
$DOWNLOAD_LIST_IMAGES
"
=
"false"
]
;
then
[
-z
"
$DOWNLOAD_ARCH
"
]
;
then
echo
"ERROR: Missing required argument"
1>&2
DOWNLOAD_INTERACTIVE
=
"true"
usage
exit
1
fi
fi
# Trap all exit signals
# Trap all exit signals
...
@@ -246,7 +252,8 @@ trap cleanup EXIT HUP INT TERM
...
@@ -246,7 +252,8 @@ trap cleanup EXIT HUP INT TERM
DOWNLOAD_TEMP
=
$(
mktemp
-d
)
DOWNLOAD_TEMP
=
$(
mktemp
-d
)
# Simply list images
# Simply list images
if
[
"
$DOWNLOAD_LIST_IMAGES
"
=
"true"
]
;
then
if
[
"
$DOWNLOAD_LIST_IMAGES
"
=
"true"
]
||
\
[
"
$DOWNLOAD_INTERACTIVE
"
=
"true"
]
;
then
# Initialize GPG
# Initialize GPG
gpg_setup
gpg_setup
...
@@ -287,7 +294,29 @@ if [ "$DOWNLOAD_LIST_IMAGES" = "true" ]; then
...
@@ -287,7 +294,29 @@ if [ "$DOWNLOAD_LIST_IMAGES" = "true" ]; then
done
<
${
DOWNLOAD_TEMP
}
/index
done
<
${
DOWNLOAD_TEMP
}
/index
echo
"---"
echo
"---"
exit
1
if
[
"
$DOWNLOAD_LIST_IMAGES
"
=
"true"
]
;
then
exit
1
fi
# Interactive mode
echo
""
if
[
-z
"
$DOWNLOAD_DIST
"
]
;
then
echo
-n
"Distribution: "
read
DOWNLOAD_DIST
fi
if
[
-z
"
$DOWNLOAD_RELEASE
"
]
;
then
echo
-n
"Release: "
read
DOWNLOAD_RELEASE
fi
if
[
-z
"
$DOWNLOAD_ARCH
"
]
;
then
echo
-n
"Architecture: "
read
DOWNLOAD_ARCH
fi
echo
""
fi
fi
# Setup the cache
# Setup the cache
...
...
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